Skip to content

Conversation

soharab-ic
Copy link
Contributor

Description

  • We would be adding DISABLE_OWNER_REFERENCES env variable to executor and buildermgr which would be false by default. If user is setting cross namespace builderNamespace and functionNamespace access then they would need to set it true.
  • We would add support to set disableOwnerReference to true via helm chart.
  • We would support existing behaviour in short term but eventually we would get rid of following.
builderNamespace: ""
functionNamespace: ""
disable_owner_reference: false

Which issue(s) this PR fixes:

Fixes #3023

Testing

Checklist:

  • I ran tests as well as code linting locally to verify my changes.
  • I have done manual verification of my changes, changes working as expected.
  • I have added new tests to cover my changes.
  • My changes follow contributing guidelines of Fission.
  • I have signed all of my commits.

…deployment.

Use this env var to decide adding ownerReferences to K8s resources created by fission CRD.

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.44%. Comparing base (b8f746c) to head (67367b2).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3024      +/-   ##
==========================================
+ Coverage   44.33%   44.44%   +0.10%     
==========================================
  Files         236      236              
  Lines       24659    24702      +43     
==========================================
+ Hits        10933    10979      +46     
+ Misses      12320    12318       -2     
+ Partials     1406     1405       -1     
Flag Coverage Δ
unittests 44.44% <100.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -39,6 +39,10 @@ import (
"github.com/fission/fission/pkg/utils/uuid"
)

const (
ENV_DISABLE_OWNER_REFERENCES string = "DISABLE_OWNER_REFERENCES"
Copy link
Member

@sanketsudake sanketsudake Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a method in utils

func IsOwnerReferencesEnabled() bool {
       return os.Getenv(utils.ENV_DISABLE_OWNER_REFERENCES) != "false" 
      // use parse bool or something more sophisticated here so that we can identify 
      // False, FASLE, false etc as well. As this directly gets input from chart.
}

Once above done.

  • We should add enable_owner_references flags at struct level whereever it used. Just call util.IsOwnerReferencesEnabled function to get global value.
  • Pass flag for functions which are not methods.
  • Idea is to not read env variable every time only at struct creation time and every component has its own control.

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
## If set to true, the K8s resources created by Fission will not have OwnerReference set.
## Set to false if you want to add OwnerReference to K8s resources created by Fission.
##
## Set to true if you are using cross namespace meaning `builderNamespace` and `functionNamespace` are set.
Copy link
Member

@sanketsudake sanketsudake Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add note about deprecation.

This flag is temporary addition and would be removed in future fission releases.

Also add deprecation warning in builderNamespace and functionNamespace params.

This can be a separate PR.

sanketsudake
sanketsudake approved these changes Sep 27, 2024
@sanketsudake sanketsudake changed the title Fixed: Issue while upgrading to fission v1.20.4 from v1.20.1 using cross namespaces Fixed: Allow to disable owner references for cross namespace access with builder and function namespace Sep 27, 2024
@sanketsudake sanketsudake merged commit 2bf0002 into main Sep 27, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to create model in fission version 1.20.4 when upgrading from 1.20.1
2 participants