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

Add option to skip CRDs in a Release #114

Merged
merged 1 commit into from
Dec 3, 2021

Conversation

somaritane
Copy link
Contributor

Signed-off-by: Timofey Ilinykh [email protected]

Description of your changes

This PR adds the ability to skip the installation of CRDs for a Release.
It is configured by spec.forProvider.skipCRDs field (=false by default).

The effect is equal to Helm's --skip-crds option

Fixes #107

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Tested against local dev cluster using the example chart with CRD templates (examples/sample/release-with-crds.yaml).

@somaritane
Copy link
Contributor Author

Hi @turkenh, I might need your approval for the PR-related GH workflow run, as this is my first-time contribution, thank you!

@somaritane
Copy link
Contributor Author

somaritane commented Dec 1, 2021

@turkenh Looks like go.lint make target fails on timeout for e2e-tests CI job:
https://github.com/crossplane-contrib/provider-helm/runs/4378543937?check_suite_focus=true#step:11:18

08:15:42 [ .. ] golangci-lint
level=error msg="Timeout exceeded: try increasing it by passing --timeout option"
08:17:44 [FAIL]
make[2]: *** [go.lint] Error 1
build/makelib/golang.mk:192: recipe for target 'go.lint' failed

I can try to increase the timeout in .golangci.yaml via run.timeout option (I see run.deadline = 2m there, but it was deprecated long time ago)

@turkenh
Copy link
Collaborator

turkenh commented Dec 1, 2021

@turkenh Looks like go.lint make target fails on timeout for e2e-tests CI job: https://github.com/crossplane-contrib/provider-helm/runs/4378543937?check_suite_focus=true#step:11:18

08:15:42 [ .. ] golangci-lint
level=error msg="Timeout exceeded: try increasing it by passing --timeout option"
08:17:44 [FAIL]
make[2]: *** [go.lint] Error 1
build/makelib/golang.mk:192: recipe for target 'go.lint' failed

I can try to increase the timeout in .golangci.yaml via run.timeout option (I see run.deadline = 2m there, but it was deprecated long time ago)

Just retriggered and worked fine this time.
Let's observe for a while before considering bumping timeout.

Copy link
Collaborator

@turkenh turkenh left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution @somaritane!

Looking good, just added two nits.

repository: https://charts.bitnami.com/bitnami
version: 2.0.12
namespace: argo-cd
skipCRDs: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of new example yaml, please add the optional config as commented out like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was considering that option from the beginning. But the problem with wordpress chart is that it doesn't install CRDs. As result, spec.forProvider.skipCRDs won't have any effect on deployment, and the example won't be true to life.
That's why I've added a separate example with argo-cd chart.
But sure, I can amend.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, good point.
I would still not be too worried given this file, esp. commented-out lines, are usually just to show available parameters.
Maybe we can just use argo-cd in the original release example, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, amended. Using argo-cd helm as the original release example would require extra efforts on mapping all parameter examples to real-world argo-cd deployment cases, might be an extra enhancement outside of this PR :)

@@ -74,7 +74,7 @@ type client struct {
}

// NewClient returns a new Helm Client with provided config
func NewClient(log logging.Logger, config *rest.Config, namespace string, wait bool, timeout time.Duration) (Client, error) {
func NewClient(log logging.Logger, config *rest.Config, namespace string, wait bool, timeout time.Duration, skipCRDs bool) (Client, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit:
With the number of parameters increasing in the function signature here, I believe we should switch using variadic functional options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@turkenh amended

@turkenh turkenh merged commit 0e33942 into crossplane-contrib:master Dec 3, 2021
@somaritane somaritane deleted the skip-crds-in-release branch December 3, 2021 21:20
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.

Skip CRDs in Release
2 participants