-
Notifications
You must be signed in to change notification settings - Fork 3
🐛 Fix: Handle empty chart directory correctly #289
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
base: main
Are you sure you want to change the base?
🐛 Fix: Handle empty chart directory correctly #289
Conversation
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.
Thanks a lot for the PR!
We currently have a function CheckHelmCharts that should take care of this. I believe that we forgot to update it for the case of multi-stage cluster addons. I think the proper way of handling this would be to update that function in a way that it does its job.
Can you maybe look into this?
@janiskemper if I see it correctly, |
@chess-knight true, my bad. However, my point is still the same. We have this function on purpose to check that everything is correct. Apparently, it doesn't do its job. We should fix that function rather than propagating the error in the other function |
e80d1a3
to
732b6fa
Compare
@janiskemper I added a call to helmChartNamePath to the validation method. This will show if something is wrong with the name in the helm chart. (Basically it is the same call that raises the error in this case.) However I would like to keep the propagation of errors, because it is better to get an error message if it is already available than to drop it on purpose. If there are still some unexpected errors this will definitely help debuging. |
There is the function CheckHelmCharts that has the exact same purpose that you have in mind. Can you plz check how you can add it to that function? I don't mind if you additionally return it with the other function, that should just not be needed anymore |
732b6fa
to
a5cd643
Compare
ok, moved the validation call to |
alright! Thanks for the info. Then the problem is actually that the function was not called in the clusterstackrelease controller. We have this in the clusteraddon-controller:
|
yes, I add it here pkg/release/release.go:215 to the validate method. |
My point was that we actually don't call the function in the first place in the clusterstackrelease controller. We should do that however. So can you add the above code snippet to the clusterstackrelease controller? |
a5cd643
to
092eb1c
Compare
ok, moved to internal/controller/clusterstackrelease_controller.go:155 |
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
The test Test Code / Test Code (pull_request) fails as the clusterstack used does not have a cluster-addon-values.yaml. If this patch is merged then this will no longer be optional. |
Oh I didn't realize. That file is definitely optional. The more recent versions (using multi-stage cluster addons), don't have that file AFAIK |
pkg/release/release.go
Outdated
@@ -159,6 +159,11 @@ func ensureMetadata(downloadPath, metadataFileName string) (Metadata, error) { | |||
func (r *Release) CheckHelmCharts() error { | |||
// check if the cluster class chart is present. | |||
clusterClassChartName := r.clusterClassChartName() | |||
|
|||
if _, err := r.ClusterClassChartPath(); err != nil { |
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.
isn't this the same as the one below?
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.
isn't this the same as the one below?
yes, indeed; I removed it
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.
After some refactoring the tests are green now and everything looks good to go again.
3e58172
to
65a4f6d
Compare
Currently the return of helmChartNamePath is not checked on errors. This means that the CSO tries to helm template the container which leads to cryptic error messages from helm. This commit adds a check to the clusterstackrelease_controller. Signed-off-by: Jan Klippel <[email protected]>
65a4f6d
to
c12de9b
Compare
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 this PR already is an improvement. However, we removed validation around the cluster-addon-values.yaml file. We could add it back by manually checking that the file exists before this line here:
shouldRequeue, err := r.templateAndApplyClusterAddonHelmChart(ctx, in) |
WDYT?
Currently the return of helmChartNamePath is not checked on errors. This means that the CSO tries to helm template the container which leads to cryptic error messages from helm.
This commit adds a check on errors on the call to helmChartNamePath and results in more helpful error messages by helm.
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #288
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
The log message after the patch is more helpful:
TODOs: