Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support helm dryrun=server #6691

Conversation

holyspectral
Copy link
Contributor

@holyspectral holyspectral commented Mar 5, 2024

Description of the change:

This is to fix #5728.
In this PR, new helm option, --dry-run=server is introduced, so lookup() can be used with helm operator.

This feature is disabled by default to keep backward compatibility. To enable this feature, specify this in watches.yaml

    dryrunOption: server

Motivation for the change:

lookup() in helm is a very useful command. However, it's not supported by helm xxx --dry-run and helm template before 3.13. This causes issues in some tools, e.g., argocd and helm operator. This could cause repetitive reconcile or frequent certificate changes depending on how lookup() is used.

Starting in Helm 3.13, helm provides a new option dryrun=server (helm/helm#9426), which enabled users to contact API server when running helm. This way, lookup() can get result from API server and work as it's intended to be.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

@openshift-ci openshift-ci bot requested review from everettraven and fabianvf March 5, 2024 03:29
@holyspectral holyspectral force-pushed the support-helm-dry-run-server branch 4 times, most recently from 5f8dfdd to 25a0bcd Compare March 5, 2024 05:23
@@ -52,6 +52,7 @@ type WatchOptions struct {
SuppressOverrideValues bool
MaxConcurrentReconciles int
Selector metav1.LabelSelector
DryrunOption string
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: CamelCase:

Suggested change
DryrunOption string
DryRunOption string

@@ -66,6 +67,7 @@ func Add(mgr manager.Manager, options WatchOptions) error {
ReconcilePeriod: options.ReconcilePeriod,
OverrideValues: options.OverrideValues,
SuppressOverrideValues: options.SuppressOverrideValues,
DryrunOption: options.DryrunOption,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same nit as above

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

I think this change looks reasonable. Would you be open to adding some test cases (either unit or e2e) that utilizes this new option to perform an action that would be allowed by this change?

@holyspectral
Copy link
Contributor Author

Fixed the CamelCase and added a simple test case.

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

The changes look good to me but looks like there are some CI failures that need to be addressed. I think doing a make generate and committing the changes should fix the failure

Signed-off-by: Sam Wang (holyspectral) <[email protected]>
@holyspectral holyspectral force-pushed the support-helm-dry-run-server branch from 9fd7159 to 9783314 Compare March 28, 2024 13:54
@holyspectral
Copy link
Contributor Author

Hi @everettraven I rebased to master branch and I can reproduce the error on my local. As your recommendation, I added these files in my latest commit and it seems to fix the issue. However, I'm not entirely sure about changing .cncf-maintainers.

.cncf-maintainers
testdata/go/v4/memcached-operator/Makefile
testdata/go/v4/monitoring/memcached-operator/Makefile
testdata/helm/memcached-operator/Makefile

Could you help to double confirm if it's okay? Thanks!

@everettraven
Copy link
Contributor

Hi @everettraven I rebased to master branch and I can reproduce the error on my local. As your recommendation, I added these files in my latest commit and it seems to fix the issue. However, I'm not entirely sure about changing .cncf-maintainers.

.cncf-maintainers
testdata/go/v4/memcached-operator/Makefile
testdata/go/v4/monitoring/memcached-operator/Makefile
testdata/helm/memcached-operator/Makefile

Could you help to double confirm if it's okay? Thanks!

@holyspectral Looks like that .cncf-maintainers change should have been made as part of #6711 but was missed and generated as part of your PR. Should be OK

@everettraven
Copy link
Contributor

According to the DCO check one of the commits is missing a sign-off: https://github.com/operator-framework/operator-sdk/pull/6691/checks?check_run_id=23201517452

Signed-off-by: Sam Wang (holyspectral) <[email protected]>
@holyspectral holyspectral force-pushed the support-helm-dry-run-server branch from 33d64bf to ba5ee97 Compare March 28, 2024 15:48
@holyspectral
Copy link
Contributor Author

holyspectral commented Mar 28, 2024

Thanks. The DCO error has been fixed now.

@holyspectral
Copy link
Contributor Author

Looks like there is still some error due to docs:

Checking 784 external links...
Ran on 171 files!


- /target/docs/best-practices/pod-security-standards/index.html
  *  External link https://github.com/operator-framework/operator-sdk/blob/master/testdata/go/v3/memcached-operator/bundle/manifests/memcached-operator.clusterserviceversion.yaml failed: 404 No error
- /target/docs/building-operators/golang/tutorial/index.html
  *  External link https://github.com/operator-framework/operator-sdk/blob/latest/testdata/go/v3/memcached-operator/controllers/memcached_controller.go failed: 404 No error
- /target/docs/upgrading-sdk-version/v1.18.0/index.html
  *  External link https://github.com/operator-framework/operator-sdk/commit/324ca13a994c7d7749708d550c0ea60d1df4cd0d failed: response code 0 means something's wrong.
             It's possible libcurl couldn't connect to the server or perhaps the request timed out.
             Sometimes, making too many requests at once also breaks things.
             Either way, the return message (if any) from the server is: Failed sending data to the peer

These are potentially related to #6664 since testdata/go/v3 is removed.

@holyspectral
Copy link
Contributor Author

v3/memcached-operator are all changed to v4/memcached-operator now. My internet connection is not good enough to complete make test-docs in my local, but at least no 404 anymore.

@everettraven can you help to take a look and rerun the test? Thanks!

@everettraven everettraven merged commit 3969b9b into operator-framework:master Mar 29, 2024
23 checks passed
@grokspawn grokspawn mentioned this pull request Apr 29, 2024
2 tasks
@hkraal
Copy link

hkraal commented May 23, 2024

@everettraven It seems that changes from this PR aren't reflected at https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/ as the memcached_controller link is still pointing to v3.

Is there any chance to update the docs?

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.

Helm Operator: charts with Helm template function "lookup" always fail at sync release.
3 participants