Skip to content
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

WIP: Add OLM templater to support OLM's registry+v1 bundle format. #1376

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

joelanford
Copy link

What this PR does / why we need it:

This PR is a proof of concept for #1369.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?

Adds an `olmRegistry` template API to the `App` object's `spec.template` types, which gives kapp-controller the ability to install OLM registry+v1 bundles.

Additional Notes for your reviewer:

At this stage, this PR is mostly gluing some existing OLM code together and transplanting some of it here. My main goal is to get feedback about the App API changes and to see if the overall approach is something that the Carvel community thinks is on the right track. I'm not really looking (yet) for a review of the underlying "templating" code, its structure, or its repo location (don't let that stop you though! I'm open to any and all feedback)

Review Checklist:
  • Follows the developer guidelines
  • Relevant tests are added or updated
  • Relevant docs in this repo added or updated
  • Relevant carvel.dev docs added or updated in a separate PR and there's
    a link to that PR
  • Code is at least as readable and maintainable as it was before this
    change

Additional documentation e.g., Proposal, usage docs, etc.:


@joelanford
Copy link
Author

Incidentally, the first commit of this PR bumps the kubernetes deps because the second commit's dependencies pull them in.

I separated them out to help reduce noise.

If maintainers are interested in the k8s 1.27 bump as a standalone PR, I can carve that out into a separate PR.

@praveenrewar
Copy link
Member

Thank you for the PR @joelanford! I will try to take a look at it soon(ish).
cc @neil-hickey @joaopapereira

I separated them out to help reduce noise.

🙏🏻

@rohitagg2020 is working on bumping the k8s libraries and controller runtime, so you should be able to rebase on those changes in future.


func Convert(in RegistryV1, installNamespace string, targetNamespaces []string) (*Plain, error) {
if installNamespace == "" {
installNamespace = in.CSV.Annotations["operatorframework.io/suggested-namespace"]

Choose a reason for hiding this comment

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

Nit for now, but functional change: We need to use the installNamespace from AppSpec.DefaultNamespace, instead of defaulting to <packageName>-system. (This would kind of bring us to a behaviour similar to OLM v0, where the install namespace is same as where the subscription is created?).

// If the bundle supports AllNamespaces mode, default is all namespaces. Otherwise, if the
// bundle supports OwnNamespaces mode, default is the install namespace. If the bundle supports
// neither AllNamespaces nor OwnNamespace, TargetNamespaces must be specified.
TargetNamespaces []string `json:"targetNamespaces,omitempty" protobuf:"bytes,2,opt,name=targetNamespaces"`

Choose a reason for hiding this comment

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

@joelanford what is the value of having TargetNamespaces here? Can't we get it directly from csv's install modes? In rukpak's implementation, we always pass an empty slice for target namespaces when converting from plain to registry: https://github.com/operator-framework/rukpak/blob/0e327c385ca5488da4c2eca95a68d385c7e08a5f/internal/convert/registryv1.go#L172 (and this was assuming we won't support multi-ns bundles).

Are we looking to support multi namespace mode in v1, and accept that option from Operator API which would then be passed here?

Follow up thought on that, if that's the case, we should handle it for the Helm and plain bundles also somehow. And probably App is the right place to expose it? Though we would not want App API to be showcased as "operator" specific.

PackageName string `json:"operators.operatorframework.io.bundle.package.v1" yaml:"operators.operatorframework.io.bundle.package.v1"`

// Channels are a comma separated list of the declared channels for the bundle, ala `stable` or `alpha`.
Channels string `json:"operators.operatorframework.io.bundle.channels.v1" yaml:"operators.operatorframework.io.bundle.channels.v1"`

Choose a reason for hiding this comment

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

Hmm.. these concepts are to be supported in other types of bundles too. The same question from the previous thought, what is the right place to expose this if it is generic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants