-
Notifications
You must be signed in to change notification settings - Fork 48
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
Update and clean up library helpers #101
Update and clean up library helpers #101
Conversation
Pull Request Test Coverage Report for Build 1238557586
💛 - Coveralls |
64e2199
to
2fbbfbd
Compare
pkg/watches/watches.go
Outdated
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/yaml" | ||
) | ||
|
||
type Watch struct { | ||
schema.GroupVersionKind `json:",inline"` | ||
ChartPath string `json:"chart"` | ||
ChartDir string `json:"chart"` |
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 is to be consistent with the terminology we use in Helm operator.
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.
/cc @joelanford thoughts on this breaking API change?
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 think we accept either a chart directory or a chart tar.gz file, hence the name ChartPath
over ChartDir
. If we only handle chart directories, this change seems fine.
@@ -153,13 +153,6 @@ func addInitCustomizations(projectName string) error { | |||
return err | |||
} | |||
|
|||
// Remove the webhook option for the componentConfig since webhooks are not supported by helm |
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.
Removing this part of the code which commented out the webhooks out of config files. Since webhooks can be used with Go API, we can leave it here.
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.
/lgtm
I think this all looks good to me, plus tests look like they're running. Probably should hold off on merge until Joe responds about the one breaking change.
Signed-off-by: varshaprasad96 <[email protected]>
Signed-off-by: varshaprasad96 <[email protected]>
2fbbfbd
to
b953788
Compare
Signed-off-by: varshaprasad96 <[email protected]>
0200d74
to
fb4695a
Compare
pkg/plugins/hybrid/v1alpha/testdata/memcached-operator/Dockerfile
Outdated
Show resolved
Hide resolved
@@ -46,7 +46,8 @@ const ( | |||
hybridOperatorVersion = "0.0.1" | |||
|
|||
// helmPluginVersion is the operator-framework/helm-operator-plugin version to be used in the project | |||
helmPluginVersion = "dc6c589504b2884e68dff6dc0e5e87ce8c24702f" | |||
// This is the SHA of the latest commit on master, which will be used to scaffold the 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.
Does this mean every PR that merges to master needs to update this line?
Could we instead inject the value at build time similar to how we inject version information?
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.
See
helm-operator-plugins/pkg/plugins/v1/scaffolds/init.go
Lines 90 to 95 in dc6c589
func mustGetScaffoldVersion() string { | |
if version.ScaffoldVersion == "" || version.ScaffoldVersion == version.Unknown { | |
panic("helm-operator scaffold version is unknown; it must be set during build or by importing this plugin via go modules") | |
} | |
return version.ScaffoldVersion | |
} |
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.
@joelanford This is really helpful! But right now, the tests configured in Makefile build SDK locally and replace the plugin with the local path to test it out and it breaks since we don't import it as dependency in go.mod. Ill create an issue to track this, so that we can make this modification and change the way test is written too?
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.
That seems reasonable for now.
But I'm curious if this needs to be resolved before the next release. I might not be fully understanding how this works, but it seems like it will never be possible for the commit SHA on this line to match the SHA of the commit that this line is in.
And if that's true, it means that when we go to tag this repo, this line will actually point to an older commit, and users will end up importing the library at that older commit.
I'm also curious if that test will actually test the current commit. It seems like it will always test the commit that's in this line?
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.
Hmm. Yeah, that's true. Can we let this be an input through operator-sdk where we provide the release to scaffold, till its used as a phase 1 plugin? This doesn't seem to be the ideal way to do so, I think.
But on a longer run even with phase 2 plugins this could be an issue because we have the library and plugin in the same place.
Yes, the test uses the current changes committed to scaffold and check if we are able to build an image. Thinking about it, how would we modify the tests to get the current commit and scaffold? If we cannot put the current commit at this place, the generated testdata and tests will always be verifying the previous commit.
2e70709
to
df1367d
Compare
pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerfile.go
Outdated
Show resolved
Hide resolved
Signed-off-by: varshaprasad96 <[email protected]>
99f53ea
to
1919ebf
Compare
@joelanford @fabianvf I have opened an issue and created a follow up task in jira to capture the work on removing the current test in Makefile. Can we merge this PR if it looks good? |
@varshaprasad96 Just the one last question about bumping the envtest k8s version. Otherwise... /lgtm |
Oh also, did you see this comment? #101 (comment) |
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.
/lgtm
Pending the last open discussion with Joe
Merging this PR. Will add a TODO to investigate on having a separate helmConfig to disallow users setting webhooks host, port and cert Dir through controller-runtime config. |
This PR does the following:
internal/cmd/run/cmd.go
with the changes made to operator flags.example/
repository as thetestdata/
folder present in respective plugins folder has the sample operator.testdata/
with the changes made to the scaffolding.The sample testdata present in the PR has been updated with the changes made in the scaffolding code in this PR.