-
Notifications
You must be signed in to change notification settings - Fork 66
✨ OPRUN-4090: (rukpak) extend bundle renderer to accept config opts #2166
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?
✨ OPRUN-4090: (rukpak) extend bundle renderer to accept config opts #2166
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
3577b5b
to
cb7ab21
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2166 +/- ##
==========================================
+ Coverage 72.71% 73.06% +0.35%
==========================================
Files 79 79
Lines 7378 7422 +44
==========================================
+ Hits 5365 5423 +58
+ Misses 1666 1649 -17
- Partials 347 350 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f26e1fa
to
7b919f4
Compare
3f1ce78
to
119d1d1
Compare
Carrying over a comment from slack to help other reviewers:
|
c17dec4
to
83f1974
Compare
09a3eee
to
392c4a9
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
392c4a9
to
94c7776
Compare
Pass installNamespace and watchNamespace as config values
94c7776
to
2f22efa
Compare
bundleConfig := map[string]interface{}{} | ||
bundleConfig[bundle.BundleConfigWatchNamespaceKey] = watchNamespace | ||
bundleConfig[bundle.BundleConfigInstallNamespaceKey] = ext.Spec.Namespace |
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.
bundleConfig := map[string]interface{}{} | |
bundleConfig[bundle.BundleConfigWatchNamespaceKey] = watchNamespace | |
bundleConfig[bundle.BundleConfigInstallNamespaceKey] = ext.Spec.Namespace | |
bundleConfig := map[string]interface{}{ | |
bundle.BundleConfigInstallNamespaceKey: ext.Spec.Namespace, | |
bundle.BundleConfigWatchNamespaceKey: watchNamespace, | |
} |
config := map[string]interface{}{} | ||
config[bundle.BundleConfigInstallNamespaceKey] = "install-namespace" | ||
config[bundle.BundleConfigWatchNamespaceKey] = "watch-namespace" |
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.
nit:
config := map[string]interface{}{} | |
config[bundle.BundleConfigInstallNamespaceKey] = "install-namespace" | |
config[bundle.BundleConfigWatchNamespaceKey] = "watch-namespace" | |
config := map[string]interface{}{ | |
bundle.BundleConfigInstallNamespaceKey: "install-namespace", | |
bundle.BundleConfigWatchNamespaceKey: "watch-namespace", | |
} |
same for the others
@@ -111,7 +124,7 @@ type BundleRenderer struct { | |||
ResourceGenerators []ResourceGenerator | |||
} | |||
|
|||
func (r BundleRenderer) Render(rv1 bundle.RegistryV1, installNamespace string, opts ...Option) ([]client.Object, error) { | |||
func (r BundleRenderer) Render(rv1 bundle.RegistryV1, opts ...Option) ([]client.Object, error) { |
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.
Let's not make install namespace optional here. We will always need an install namespace. So, I'd revert the changes to this package.
rv1, err := bundle.GetBundle() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// Convert config map to render options | ||
var opts []render.Option |
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.
nit:
var opts []render.Option | |
opts := []render.Option{ | |
render.WithCertificateProvider(r.CertificateProvider), | |
} |
then remove line 37
// Convert config map to render options | ||
var opts []render.Option | ||
if config != nil { | ||
if installNs, ok := config[bundlepkg.BundleConfigInstallNamespaceKey].(string); ok { |
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.
we should return an error here as installNamespace is mandatory.
if installNs, ok := config[bundlepkg.BundleConfigInstallNamespaceKey].(string); ok { | ||
opts = append(opts, render.WithInstallNamespace(installNs)) | ||
} | ||
if watchNs, ok := config[bundlepkg.BundleConfigWatchNamespaceKey].(string); ok { |
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.
let's bring back deriveDefaults and set watchNamespaces to:
- corev1.NamespaceAll iff AllNamespaces is supported
- install-namespace iff the only supported install-mode is OwnNamespace
- an error is its not set and SingleNamespace is the only supported mode
- an error if there are no supported install modes
Pass installNamespace and watchNamespace as config values
Description
Reviewer Checklist