-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 helm plugin scaffolding new layout #3295
Add helm plugin scaffolding new layout #3295
Conversation
2144a66
to
006f6df
Compare
6371b1d
to
8b7f38f
Compare
bcdd1b8
to
2cb554d
Compare
456eef9
to
001281c
Compare
d07c2f2
to
522816f
Compare
**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
58895ee
to
20e0317
Compare
hack/tests/e2e-helm-new-shell.sh
Outdated
kubectl logs deployment.apps/nginx-operator-controller-manager -c manager --namespace=${test_namespace} | ||
exit 1 | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
test/e2e-helm-new/e2e_suite.go
Outdated
|
||
// Modified from https://github.com/kubernetes-sigs/kubebuilder/tree/39224f0/test/e2e/v3 | ||
|
||
package e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
050a0bf
to
959cef6
Compare
hack/lib/common.sh
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along with any other file that was copied with modifications.
|
||
kustomize: | ||
ifeq (, $(shell which kustomize 2>/dev/null)) | ||
@{ \ | ||
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 ;\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this echo
line?
if f.Image == "" { | ||
f.Image = "controller:latest" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
hack/tests/e2e-helm.sh
Outdated
@@ -1,169 +1,29 @@ | |||
#!/usr/bin/env bash | |||
|
|||
set -eux | |||
set -o errexit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
test/e2e-helm/e2e_suite.go
Outdated
@@ -0,0 +1,157 @@ | |||
// Copyright 2020 The Operator-SDK Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
test/e2e-helm/e2e_test.go
Outdated
@@ -0,0 +1,29 @@ | |||
// Copyright 2020 The Operator-SDK Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9a2f82a
to
799c08e
Compare
799c08e
to
0219e24
Compare
I am closing because I am testing in my fork. I will re-open soon. |
@@ -53,3 +57,14 @@ func (tc TestContext) UninstallOLM() { | |||
func (tc TestContext) KustomizeBuild(dir string) ([]byte, error) { | |||
return tc.Run(exec.Command("kustomize", "build", dir)) | |||
} | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will revert it was added here to be used in both go tests. Now it will be part of a follow-up 👍
@@ -55,4 +57,5 @@ replace ( | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run make tidy
before committing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. In 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.go
and./hack/tests/e2e-helm-new.sh
hack/tests/e2e-helm-new-shell.sh
Motivation
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 api
commands - Done in: docs: update helm docs for the new layout #3326operator-sdk new --type=-helm
removal: helm legacy scaffold #3343