-
Notifications
You must be signed in to change notification settings - Fork 67
⚠ minor API improvements #1250
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
⚠ minor API improvements #1250
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,8 +23,7 @@ import ( | |||||
) | ||||||
|
||||||
var ( | ||||||
ClusterExtensionGVK = SchemeBuilder.GroupVersion.WithKind("ClusterExtension") | ||||||
ClusterExtensionKind = ClusterExtensionGVK.Kind | ||||||
ClusterExtensionKind = "ClusterExtension" | ||||||
) | ||||||
|
||||||
type UpgradeConstraintPolicy string | ||||||
|
@@ -386,15 +385,15 @@ type PreflightConfig struct { | |||||
// The CRD Upgrade Safety pre-flight check safeguards from unintended | ||||||
// consequences of upgrading a CRD, such as data loss. | ||||||
// | ||||||
// This field is required if the spec.preflight field is specified. | ||||||
// This field is required if the spec.install.preflight field is specified. | ||||||
CRDUpgradeSafety *CRDUpgradeSafetyPreflightConfig `json:"crdUpgradeSafety"` | ||||||
} | ||||||
|
||||||
// CRDUpgradeSafetyPreflightConfig is the configuration for CRD upgrade safety preflight check. | ||||||
type CRDUpgradeSafetyPreflightConfig struct { | ||||||
// policy is used to configure the state of the CRD Upgrade Safety pre-flight check. | ||||||
// | ||||||
// This field is required when the spec.preflight.crdUpgradeSafety field is | ||||||
// This field is required when the spec.install.preflight.crdUpgradeSafety field is | ||||||
// specified. | ||||||
// | ||||||
// Allowed values are ["Enabled", "Disabled"]. The default value is "Enabled". | ||||||
|
@@ -485,15 +484,17 @@ type ClusterExtensionStatus struct { | |||||
// - Reason: a string representation of the reason for the current state of the condition. Typically useful for building automation around particular Type+Reason combinations. | ||||||
// - Message: a human readable message that further elaborates on the state of the condition | ||||||
// | ||||||
// The current set of condition types are: | ||||||
// - "Installed", represents whether or not the package referenced in the spec.packageName field has been installed | ||||||
// The global set of condition types are: | ||||||
// - "Installed", represents whether or not the a bundle has been installed for this ClusterExtension | ||||||
// - "Resolved", represents whether or not a bundle was found that satisfies the selection criteria outlined in the spec | ||||||
// - "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types. | ||||||
// - "PackageDeprecated", represents whether or not the package specified in the spec.packageName field has been deprecated | ||||||
// - "ChannelDeprecated", represents whether or not the channel specified in spec.channel has been deprecated | ||||||
// - "BundleDeprecated", represents whether or not the bundle installed is deprecated | ||||||
// - "Unpacked", represents whether or not the bundle contents have been successfully unpacked | ||||||
// | ||||||
// When the ClusterExtension is sourced from a catalog, the following conditions are also possible: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I grouped the
|
||||||
// - "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types | ||||||
// - "PackageDeprecated", represents whether or not the package specified in the spec.source.catalog.packageName field has been deprecated | ||||||
// - "ChannelDeprecated", represents whether or not any channel specified in spec.source.catalog.channels has been deprecated | ||||||
// - "BundleDeprecated", represents whether or not the installed bundle is deprecated | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty sure this line is not true, but want to double check. A quick glance at the code makes me think we should make the following edit as well:
Suggested change
However, I think the original sentiment of having this condition be based on the installed bundle is what we actually want. That might require a bit more conversation and consideration though, as it isn't clear to me how exactly we would assess the deprecation status of an installed bundle during subsequent reconciles after it is installed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we'd have two possibilities:
In the 2nd case, shouldn't it pick up the condition during reconcile? Maybe it's OK that we only express deprecated conditions for resolved bundles (and not worry about the the installed bundles) since either the CE will get upgraded, or if it can't/won't, we'd anyway resolve to the installed bundle? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My initial thought is that we only touch the
|
||||||
// | ||||||
// The current set of reasons are: | ||||||
// - "Success", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when unpacking a bundle's content, resolution and installation/upgrading is successful | ||||||
// - "Failed", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when an error has occurred while unpacking the contents of a bundle, during resolution or installation. | ||||||
|
@@ -511,22 +512,17 @@ type ClusterExtensionInstallStatus struct { | |||||
// | ||||||
// A "bundle" is a versioned set of content that represents the resources that | ||||||
// need to be applied to a cluster to install a package. | ||||||
// | ||||||
// This field is only updated once a bundle has been successfully installed and | ||||||
// once set will only be updated when a new version of the bundle has | ||||||
// successfully replaced the currently installed version. | ||||||
// | ||||||
//+optional | ||||||
Bundle *BundleMetadata `json:"bundle,omitempty"` | ||||||
Bundle BundleMetadata `json:"bundle"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the pointer here because the parent struct is a pointer. If the parent struct is non-nil, this field is always expected to be set. |
||||||
} | ||||||
|
||||||
type ClusterExtensionResolutionStatus struct { | ||||||
// bundle is a representation of the bundle that was identified during | ||||||
// resolution to meet all installation/upgrade constraints and is slated to be | ||||||
// installed or upgraded to. | ||||||
// | ||||||
//+optional | ||||||
Bundle *BundleMetadata `json:"bundle,omitempty"` | ||||||
// A "bundle" is a versioned set of content that represents the resources that | ||||||
// need to be applied to a cluster to install a package. | ||||||
Bundle BundleMetadata `json:"bundle"` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
} | ||||||
|
||||||
//+kubebuilder:object:root=true | ||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,14 +100,14 @@ spec: | |
The CRD Upgrade Safety pre-flight check safeguards from unintended | ||
consequences of upgrading a CRD, such as data loss. | ||
|
||
This field is required if the spec.preflight field is specified. | ||
This field is required if the spec.install.preflight field is specified. | ||
properties: | ||
policy: | ||
default: Enabled | ||
description: |- | ||
policy is used to configure the state of the CRD Upgrade Safety pre-flight check. | ||
|
||
This field is required when the spec.preflight.crdUpgradeSafety field is | ||
This field is required when the spec.install.preflight.crdUpgradeSafety field is | ||
specified. | ||
|
||
Allowed values are ["Enabled", "Disabled"]. The default value is "Enabled". | ||
|
@@ -474,15 +474,17 @@ spec: | |
- Reason: a string representation of the reason for the current state of the condition. Typically useful for building automation around particular Type+Reason combinations. | ||
- Message: a human readable message that further elaborates on the state of the condition | ||
|
||
The current set of condition types are: | ||
- "Installed", represents whether or not the package referenced in the spec.packageName field has been installed | ||
The global set of condition types are: | ||
- "Installed", represents whether or not the a bundle has been installed for this ClusterExtension | ||
- "Resolved", represents whether or not a bundle was found that satisfies the selection criteria outlined in the spec | ||
- "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types. | ||
- "PackageDeprecated", represents whether or not the package specified in the spec.packageName field has been deprecated | ||
- "ChannelDeprecated", represents whether or not the channel specified in spec.channel has been deprecated | ||
- "BundleDeprecated", represents whether or not the bundle installed is deprecated | ||
- "Unpacked", represents whether or not the bundle contents have been successfully unpacked | ||
|
||
When the ClusterExtension is sourced from a catalog, the following conditions are also possible: | ||
- "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types | ||
- "PackageDeprecated", represents whether or not the package specified in the spec.source.catalog.packageName field has been deprecated | ||
- "ChannelDeprecated", represents whether or not any channel specified in spec.source.catalog.channels has been deprecated | ||
- "BundleDeprecated", represents whether or not the installed bundle is deprecated | ||
|
||
The current set of reasons are: | ||
- "Success", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when unpacking a bundle's content, resolution and installation/upgrading is successful | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to call out the reasons for the deprecated conditions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. The "Reason" for these conditions are basically 1-to-1 with the Status. "The reason this is deprecated is because the author provided a deprecation" |
||
- "Failed", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when an error has occurred while unpacking the contents of a bundle, during resolution or installation. | ||
|
@@ -552,10 +554,6 @@ spec: | |
|
||
A "bundle" is a versioned set of content that represents the resources that | ||
need to be applied to a cluster to install a package. | ||
|
||
This field is only updated once a bundle has been successfully installed and | ||
once set will only be updated when a new version of the bundle has | ||
successfully replaced the currently installed version. | ||
properties: | ||
name: | ||
description: |- | ||
|
@@ -571,6 +569,8 @@ spec: | |
- name | ||
- version | ||
type: object | ||
required: | ||
- bundle | ||
type: object | ||
resolution: | ||
properties: | ||
|
@@ -579,6 +579,9 @@ spec: | |
bundle is a representation of the bundle that was identified during | ||
resolution to meet all installation/upgrade constraints and is slated to be | ||
installed or upgraded to. | ||
|
||
A "bundle" is a versioned set of content that represents the resources that | ||
need to be applied to a cluster to install a package. | ||
properties: | ||
name: | ||
description: |- | ||
|
@@ -594,6 +597,8 @@ spec: | |
- name | ||
- version | ||
type: object | ||
required: | ||
- bundle | ||
type: object | ||
type: object | ||
type: object | ||
|
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.
ClusterExtensionGVK
is unused, and is not really necessary for inclusion as an exported global variable in the API.Callers can construct themselves like this: