Add helm plugin scaffolding new layout#3295
Add helm plugin scaffolding new layout#3295camilamacedo86 wants to merge 3 commits intooperator-framework:masterfrom camilamacedo86:helm-external-plugin
Conversation
**Description of the change:** Just moving the SDK scaffolds for plugins to the sdk dir and allow it to be re-used. **Motivation for the change:** The SDK scaffolds will be required for other plugins. See for example #3295
| kubectl logs deployment.apps/nginx-operator-controller-manager -c manager --namespace=${test_namespace} | ||
| exit 1 | ||
| fi | ||
|
|
There was a problem hiding this comment.
This test is missing the checks that curl the metrics endpoints that currently exists in the legacy shell-based test. We need to check all the same scenarios to make sure we don't accidentally break something in the transition.
|
|
||
| // Modified from https://github.com/kubernetes-sigs/kubebuilder/tree/39224f0/test/e2e/v3 | ||
|
|
||
| package e2e |
There was a problem hiding this comment.
This file isn't testing much more than what currently exists in the new shell based file.
Rather than adding two additional helm e2e tests (which would mean we'd have 3 total e2e tests just for helm!), I think for this PR we should stick with just the shell-based test.
Then in a follow-on, we can migrate the logic to this file and remove the shell-based tests.
| function setup_kustomize { | ||
| header_text "getting kustomize" | ||
| curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash | ||
| chmod u+x kustomize | ||
| mv kustomize "$1"/bin/kustomize | ||
| } |
There was a problem hiding this comment.
Do we need this? I figured that since the make targets that require kustomize depend on it, and then the kustomize target would download it if it isn't already on the path.
Also it looks like the install_kustomize.sh script downloads the latest version of kustomize, whereas the Makefile has a hardcoded version. Shouldn't we be testing with the version that is scaffolded in the Makefile?
| @@ -0,0 +1,134 @@ | |||
| /* | |||
| Copyright 2019 The Kubernetes Authors. | |||
| Modifications copyright 2020 The Operator-SDK Authors | |||
There was a problem hiding this comment.
This looks deliberate, but I am surprised that this file wouldnt be a full Operator-SDK copyright file
There was a problem hiding this comment.
The file is copied from KB and modified then, we need to respect the license. See: https://softwareengineering.stackexchange.com/questions/157968/how-to-manage-a-copyright-notice-in-an-open-source-project
There was a problem hiding this comment.
In that case this should be:
Original work Copyright 2019 The Kubernetes Authors.
Modified work Copyright 2020 The Operator-SDK Authors
There was a problem hiding this comment.
Along with any other file that was copied with modifications.
| set -e ;\ | ||
| mkdir -p bin ;\ | ||
| curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/{{ .KustomizeVersion }}/kustomize_{{ .KustomizeVersion }}_${OS}_${ARCH}.tar.gz | tar xzf - -C bin/ ;\ | ||
| echo https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/{{ .KustomizeVersion }}/kustomize_{{ .KustomizeVersion }}_$(OS)_$(ARCH).tar.gz ;\ |
| if f.Image == "" { | ||
| f.Image = "controller:latest" | ||
| } |
There was a problem hiding this comment.
I see that we're explicitly setting f.Image in the scaffold calls, but with this defaulter removed, it is now possible to use templates.Makefile and end up with an invalid Makefile.
We either need to return an error if f.Image is not set OR we need to keep this as the default.
My preference would be to stay aligned with Kubebuilder's Go plugin, which leaves this conditional in so that f.Image is defaulted to controller:latest if it isn't explicitly set by a caller.
| #!/usr/bin/env bash | ||
|
|
||
| set -eux | ||
| set -o errexit |
There was a problem hiding this comment.
Revert this file back to the legacy Helm e2e test.
In a follow-up (when the legacy Helm scaffolding is removed) we can rename e2e-helm-new-shell.sh to e2e-helm.sh. And in a separate follow-up, we can port the actual tests from Shell-based tests to Go-based tests and update this file accordingly.
| @@ -0,0 +1,157 @@ | |||
| // Copyright 2020 The Operator-SDK Authors | |||
There was a problem hiding this comment.
Remove this file for now. In a follow-up, we can port the shell-based test to a Go-based test and reintroduce this when it covers all of the existing test scenarios.
| @@ -0,0 +1,29 @@ | |||
| // Copyright 2020 The Operator-SDK Authors | |||
There was a problem hiding this comment.
|
I am closing because I am testing in my fork. I will re-open soon. |
| } | ||
|
|
||
| // ReplaceInFile replaces all instances of old with new in the file at path. | ||
| func ReplaceInFile(path, old, new string) { |
There was a problem hiding this comment.
Where else is this being used? If it isn't revert this back to being unexported in Go e2e tests.
There was a problem hiding this comment.
I will revert it was added here to be used in both go tests. Now it will be part of a follow-up 👍
| github.com/Azure/go-autorest => github.com/Azure/go-autorest v13.3.2+incompatible // Required by OLM | ||
| github.com/mattn/go-sqlite3 => github.com/mattn/go-sqlite3 v1.10.0 | ||
| k8s.io/client-go => k8s.io/client-go v0.18.2 | ||
|
|
There was a problem hiding this comment.
Can you run make tidy before committing this?
There was a problem hiding this comment.
make tidy do not remove the space. But I fixed that 👍 Tks.
| @@ -0,0 +1,156 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
IIRC we want to add all new e2e tests as ginkgo/gomega suites. Perhaps that is too much extra code for this PR which is already large, so at least do this in a follow-up if that's how we want to proceed with e2e tests.
There was a problem hiding this comment.
Hi @estroz,
The first version was with the tests done in go like you wish 👍 . However, @joelanford asked for we keep here the same tests in the shell just for we ensure now that all is 100% then we can do a follow with the go tests as well.
|
/reopen |
|
@camilamacedo86: Failed to re-open PR: state cannot be changed. The helm-external-plugin branch was force-pushed or recreated. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Description of the change:
This PR adds the helm plugin scaffolding the files with the new layout and using the current sdk helm pkg implementation (image)
/test/e2e-helm-new/e2e_suite.goand./hack/tests/e2e-helm-new.shhack/tests/e2e-helm-new-shell.shMotivation
SDK is in a process to be integrated with KB which means that its project layouts will be aligned. More info : Integrating Kubebuilder and Operator SDK.
This PR adds the Helm Plugin which will provide the Helm project in the new layout by the command
operator-sdk init --plugins=helm.operator-sdk.io/v1`. For a further understanding see the WIP: #329 and the doc Extensible CLI and Scaffolding Plugins.Follow-ups
operator-sdk new --type and add apicommands - Done in: docs: update helm docs for the new layout #3326operator-sdk new --type=-helmremoval: helm legacy scaffold #3343