Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

BundleDeployment: add and implement required installNamespace field #864

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

joelanford
Copy link
Member

In order to make it possible to add an InstallNamespace field in the operator-controller project's ClusterExtension spec, we need to add it here first (because the embedding of rukpak logic in operator-controller is still ongoing).

The logic here configures the Helm client to use the InstallNamespace as the context for the templating engine and k8s client, the result being similar to using helm --namespace <installNamespace>. The exception is that rukpak continues to store the helm release secret in its system namespace.

This commit pins rukpak to an untagged commit on main in the helm-operator-plugins repo. I can tag that commit if reviewers want to stick with a tagged release for helm-operator-plugins.

@joelanford joelanford requested a review from a team as a code owner April 25, 2024 00:54
Copy link

codecov bot commented Apr 25, 2024

Codecov Report

Attention: Patch coverage is 8.33333% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 37.27%. Comparing base (b0ed91c) to head (dc03d98).

Files Patch % Lines
...l/controllers/bundledeployment/bundledeployment.go 0.00% 9 Missing ⚠️
internal/convert/registryv1.go 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
- Coverage   37.28%   37.27%   -0.01%     
==========================================
  Files           9        9              
  Lines         853      845       -8     
==========================================
- Hits          318      315       -3     
+ Misses        491      486       -5     
  Partials       44       44              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joelanford joelanford force-pushed the install-namespace branch 4 times, most recently from 6a1a5fe to 168a689 Compare April 29, 2024 19:21
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 29, 2024
@joelanford joelanford force-pushed the install-namespace branch 2 times, most recently from 089c30b to 1828b3b Compare April 29, 2024 20:56
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 29, 2024
Copy link
Member

@varshaprasad96 varshaprasad96 left a comment

Choose a reason for hiding this comment

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

Just questions, overall the changes look good to me!
/lgtm
/approve

if strings.Contains(err.Error(), "no matches for kind") {
return true
}
return strings.Contains(err.Error(), "the server could not find the requested resource")
Copy link
Member

Choose a reason for hiding this comment

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

Was it intentional to add this? Could not find requested resource can have many reasons - given this is called after helm install, could there be any side effects?

Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed some tests failing (maybe flaking?) when I was running the e2e's. We've seen similar things before (and I can't remember specifics now), but I think the difference between "no matches for kind" and "the server could not find the requested resource" is maybe coming from the dynamic client's request to the apiserver vs the discovery interface's lookup of the rest mapping.

I don't think there are any side-effects in user facing behavior though. We just have this custom error type so that we can assert on it.

@@ -19,7 +20,7 @@ const (
)

func HandleBundleDeployment(ctx context.Context, fsys fs.FS, bd *rukpakv1alpha2.BundleDeployment) (*chart.Chart, chartutil.Values, error) {
plainFS, err := convert.RegistryV1ToPlain(fsys, bd.Spec.WatchNamespaces)
plainFS, err := convert.RegistryV1ToPlain(fsys, bd.Spec.InstallNamespace, []string{metav1.NamespaceAll})
Copy link
Member

Choose a reason for hiding this comment

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

I assume removal of watchNamespace field would be a follow up?

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean the RegistryV1ToPlain function accepting a watchNamespaces parameter? I left that in intentionally. I assume we'll still need all of that underlying logic in order to support all install modes via the Extension API.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 29, 2024
Copy link

@perdasilva perdasilva left a comment

Choose a reason for hiding this comment

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

lgtm

@joelanford joelanford added this pull request to the merge queue Apr 30, 2024
Merged via the queue into operator-framework:main with commit 77534a3 Apr 30, 2024
7 of 10 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants