-
Couldn't load subscription status.
- Fork 68
BundleDeployment creation with BundleImage #104
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
Conversation
| .PHONY: cert-mgr | ||
| cert-mgr: ## Install cert-manager | ||
| kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/$(CERT_MGR_VERSION)/cert-manager.yaml | ||
| kubectl wait --for=condition=Available --namespace=cert-manager deployment/cert-manager-webhook --timeout=60s | ||
|
|
||
| .PHONY: rukpak | ||
| rukpak: ## Install rukpak | ||
| kubectl apply -f https://github.com/operator-framework/rukpak/releases/latest/download/rukpak.yaml | ||
| kubectl wait --for=condition=Available --namespace=rukpak-system deployment/core --timeout=60s | ||
|
|
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.
Add a TODO to swap this out with whatever we come up with for the "distribution" or install script or whatever that ends up being?
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.
Updated
| Name: o.GetName(), | ||
| }, | ||
| Spec: rukpakv1alpha1.BundleDeploymentSpec{ | ||
| //TODO: Don't assume plain provisioner |
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.
+1
Long term, I envision a separate configuration API that sets up mappings from bundle properties to provisioner class names.
Mid term, perhaps we get some mileage around a property that sets the provisioner class name directly. We have to be careful with this though because I expect ProvisionerClass could end up being a new API in rukpak, which means provisionerClassName becomes a runtime thing, not something hardcoded in rukpak.
Short term, what you have here will be fine for quite awhile, I imagine.
| }, | ||
| Spec: rukpakv1alpha1.BundleSpec{ | ||
| Source: rukpakv1alpha1.BundleSource{ | ||
| // TODO: Don't assume image type |
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.
IMO, we should make that bundle path property something a bit more definitive (e.g. bundle image reference). At that point, it would be totally safe to assume that we use the rukpak image type if we have that property. And that would then leave the door open for bundles to have different properties that map to a different source type.
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.
Agreed here. I've created another issue here #108 to address this, since I was hoping it wouldn't be a blocker for our shorter term goals.
controllers/operator_controller.go
Outdated
| r.resolver = resolution.NewOperatorResolver(mgr.GetClient(), resolution.HardcodedEntitySource) | ||
|
|
||
| err := ctrl.NewControllerManagedBy(mgr). | ||
| Owns(&rukpakv1alpha1.BundleDeployment{}). |
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.
Convention/nit/my opinion: Always declare For as the first watch. Its the primary CR type. Then Owns, then Watches.
Sort of ordering from most coupling (self) to least coupling (things I watch, but don't own).
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.
Yeah, that makes sense to me too. I'll update it.
controllers/operator_controller.go
Outdated
| Scheme *runtime.Scheme | ||
|
|
||
| resolver *resolution.OperatorResolver | ||
| Resolver *resolution.OperatorResolver |
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 need to be exported? Could we just create a GetEntity(id DeppyID) function for the OperatorReconciler type?
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.
Not sure if this is answering your second question, but for the first one it was done this way to allow the resolver to be set up separately from the controller in main(), which you can see in the prototype here. This seems to make it easier to set up the catalog source cache.
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 could be done with a NewOperatorReconciler(c client, s scheme, r resolver) &OperatorReconciler function, right? Point being that once the cache is set we shouldn't allow it to be manipulated directly.
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.
Well, avoid allowing people to manipulate the resolver that is.
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.
Yeah I see your point there, I'll update 👍
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.
Updated
Makefile
Outdated
| .PHONY: cert-mgr | ||
| cert-mgr: ## Install cert-manager | ||
| kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/$(CERT_MGR_VERSION)/cert-manager.yaml | ||
| kubectl wait --for=condition=Available --namespace=cert-manager deployment/cert-manager-webhook --timeout=60s |
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 the timeouts a variable; "60s" is a reasonable default, but for some others?
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.
Updated, can now be overridden with WAIT_TIMEOUT
| kind: ClusterRole | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: manager-role |
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.
Not something you did (probably kubebuilder), but manager-role is just too generic a name for a ClusterRole
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.
Yes, it is kubebuilder - and it also gets prepended with a prefix set in config/defaults/kustomization.yaml: namePrefix: operator-controller-, so it ends up as operator-controller-manager-role. Personally I also don't like this way of doing it much but it's also kind of a pain to go through and replace all the names with different values. Plus some of them don't get prepended and I've never quite figured out the rule for when that happens...
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 avoid touching it for now, keep in mind that all kubebuilder controllers follow this convention, so there are some assumptions about the name of this role.
controllers/operator_controller.go
Outdated
| bundlePath, err := v.BundleEntity().BundlePath() | ||
| if err != nil { | ||
| return ctrl.Result{}, err | ||
| } // Create bundleDeployment |
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.
Comment should really be on next line, as it does not apply to the block it follows.
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.
Updated
|
/approve |
|
Oh, can we fix the commit header? |
Combines @perdasilva 's latest commits with a selection from @varshaprasad96 and @ankitathomas 's controller_prototype to enable the operator-controller to create bundledeployments using a (currently hard-coded) CatalogSource. Also adds additional Makefile targets to enable simpler installation of dependencies (cert-manager and rukpak). Signed-off-by: dtfranz <dfranz@redhat.com>
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
Combines @perdasilva 's latest commits with a selection from @varshaprasad96 and @ankitathomas 's controller_prototype to enable the operator-controller to create bundledeployments using a (currently hard-coded) CatalogSource. Also adds additional Makefile targets to enable simpler installation of dependencies (cert-manager and rukpak).
It should be possible to demonstrate milestone 1 by running the following two commands: