-
Notifications
You must be signed in to change notification settings - Fork 546
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
feat: support v1 CRD objects in OLM #1416
Conversation
Are there any docs anywhere that should be updated to reflect that OLM supports |
8b63433
to
7e377cf
Compare
/approve Looks good! I think this refactor will help with csvless bundles. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ecordell, exdx The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Great job! I have a few comments:
/retest |
/hold |
/hold cancel |
switch step.Status { | ||
case v1alpha1.StepStatusPresent, v1alpha1.StepStatusCreated: | ||
doStep := true | ||
s, err := b.step(step.Status, step.Resource, step.Resource.Name) |
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 should take the whole step as a single argument.
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. I renamed the function to create
so we have create(step)
for clarity as well.
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.
Looking really good. Holding off on LGTM since there's one more change coming in (discussed offline).
I had one last minute design thought, but it doesn't need to hold this up.
|
||
// Stepper manages cluster interactions based on the step. | ||
type Stepper interface { | ||
Status() (v1alpha1.StepStatus, 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.
The naming here is a little confusing. Usually I would expect ${VERB}er to $VERB.
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
} | ||
|
||
// step is a factory that creates StepperFuncs based on the Kind provided and the install plan step. | ||
func (b *builder) step(stepStatus v1alpha1.StepStatus, resource v1alpha1.StepResource, name string) (Stepper, 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.
It seems like builder
is really the Stepper
because it's -- indirectly -- performing the step. It also needs to have knowledge of all the Stepper
implementations.
What if:
- A
Stepper
has aStep(take *v1alpha1.Step) (taken bool, err error)
method, which performs an in-place update of the given step -- returningtaken=true
if the Stepper cared to take a step. - Different
Stepper
implementations are made for specific resource types; e.g.CSV
,CRD
,CR
, etc... - A
StepperChain
Stepper
implementation is made that calls a set of steppers in order untiltaken=true
or an error is encountered -- forwarding the results along, or if no step was taken, returnstaken=false
.
I think something similar to this will let us view the stepper order and inclusion more easily; e.g.:
// On the Operator struct
o.stepper = StepperChain{
NewCRDStepper(...),
NewCSVStepper(...),
NewDefaultStepper(...),
}
// ...
// In the InstallPlan transition
taken, err := o.stepper.Step(take)
if err != nil {
// ...
}
if !taken {
// ...
}
// ...
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.
or maybe a continue bool
return would be more flexible than taken
-- the semantics would follow the namesake
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'm down to think about this more next week
We've identified a potential issues with int -> float conversion (see helm/helm#5806 for an example) going from an unstructured object to a v1 CRD. Will file a bug and resolve following feature freeze. |
46fa1e8
to
992a0c9
Compare
I believe e2e should pass now, barring flakes. |
/retest |
Stepper interface. All CRDs will be converted and handled at the v1 APIVersion.
/test e2e-aws-olm |
@exdx: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
upstream tests are passing with one known failure (external image dependency issue). /lgtm |
Description of the change:
The goal of this PR is to enable the catalog operator to fulfill install plans on bundles that contain CRDs that are in the newer
apiextensions.k8s.io/v1
group and version. The OLM operator will also need an informer based on this new version. However, we still need to support the olderv1beta1
version of CRDs as well. Most of the code from the existing reconciliation ofv1beta1
type CRDs is duplicated to support thev1
version.Additional work will be needed on the registry side to enable users to generate bundles with the new
v1
CRDs and validate them.The biggest change between
v1beta1
andv1
version CRDs are around the validation fields - inv1beta1
the validation was optional since the structural schema was not required and turned off by default. Inv1
the structural schema is required, and validation is required on each version of the supported resources. So the spec has changed around to reflect this between the two versions.Note: The
v1beta1
version of the CRD api will be served at thev1
endpoint based on the kubernetes api conventions. So performing aGET
with the v1 CRD client on a v1beta1 CRD on-cluster will return the v1 representation of that CRD.https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md#on-compatibility
Motivation for the change:
v1beta1
CRDs will be deprecated in kube as of 1.19Reviewer Checklist
/docs