-
Notifications
You must be signed in to change notification settings - Fork 86
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
Bump v1beta1 with a Conversion Webhook for Management Policies #154
Conversation
Signed-off-by: Hasan Turken <[email protected]>
Signed-off-by: Hasan Turken <[email protected]>
Signed-off-by: Hasan Turken <[email protected]>
Signed-off-by: Hasan Turken <[email protected]>
Signed-off-by: Hasan Turken <[email protected]>
Signed-off-by: Hasan Turken <[email protected]>
Looks like we need to have at least v1beta1 for conversion, otherwise getting: invalid: spec.conversion.conversionReviewVersions: Invalid value: []string{"v1alpha2"}: must include at least one of v1, v1beta1 Signed-off-by: Hasan Turken <[email protected]>
9190592
to
45f4834
Compare
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.
Added a few comments, really like the direction!
case ObserveCreateUpdate: | ||
dst.Spec.ManagementPolicies = xpv1.ManagementPolicies{xpv1.ManagementActionObserve, xpv1.ManagementActionCreate, xpv1.ManagementActionUpdate} |
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.
Should we include LateInitialize here? What was the default behaviour of ObserveCreateUpdate, did it do some LateInitialization?
// TODO(turkenh): Should we default to something here instead of erroring out? | ||
return errors.New("unsupported management policy") |
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 could play it safe and make it observe-only but still it would be good to inform the users somehow that it happened.
I would be ok with erroring out to make it simple
@@ -0,0 +1,21 @@ | |||
/* | |||
Copyright 2020 The Crossplane Authors. |
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.
Copyright 2020 The Crossplane Authors. | |
Copyright 2023 The Crossplane Authors. |
some other places as well
// Package type metadata. | ||
const ( | ||
Group = "kubernetes.crossplane.io" | ||
Version = "v1alpha1" |
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.
Version = "v1alpha1" | |
Version = "v1beta1" |
// A ManagementPolicy determines what should happen to the underlying external | ||
// resource when a managed resource is created, updated, deleted, or observed. | ||
// +kubebuilder:validation:Enum=Default;ObserveCreateUpdate;ObserveDelete;Observe | ||
type ManagementPolicy string | ||
|
||
const ( | ||
// Default means the provider can fully manage the resource. | ||
Default ManagementPolicy = "Default" | ||
// ObserveCreateUpdate means the provider can observe, create, or update | ||
// the resource, but can not delete it. | ||
ObserveCreateUpdate ManagementPolicy = "ObserveCreateUpdate" | ||
// ObserveDelete means the provider can observe or delete the resource, but | ||
// can not create and update it. | ||
ObserveDelete ManagementPolicy = "ObserveDelete" | ||
// Observe means the provider can only observe the resource. | ||
Observe ManagementPolicy = "Observe" | ||
|
||
// ObjectActionCreate means to create an Object | ||
ObjectActionCreate ObjectAction = "Create" | ||
// ObjectActionUpdate means to update an Object | ||
ObjectActionUpdate ObjectAction = "Update" | ||
// ObjectActionDelete means to delete an Object | ||
ObjectActionDelete ObjectAction = "Delete" | ||
) |
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.
should this be removed for v1beta1
?
- jsonPath: .metadata.creationTimestamp | ||
name: AGE | ||
type: date | ||
name: v1alpha2 |
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.
Should this be v1beta1
?
@lsviben as we discussed offline, please continue with a new PR as it will make things easier. |
Description of your changes
WIP to bump Object API from v1alpha1 to v1beta1 with a conversion webhook for migrating
spec.managementPolicy
to XP runtime'sspec.managementPolicies
Fixes: #162
I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested
WIP