From 19f0d0db7bbe700e0230a7e50c0c881df40cfe5f Mon Sep 17 00:00:00 2001 From: Rashmi Gottipati Date: Thu, 23 May 2024 14:30:56 -0400 Subject: [PATCH] Address review comments Signed-off-by: Rashmi Gottipati --- api/v1alpha2/bundledeployment_types.go | 30 +++++-------------- api/v1alpha2/zz_generated.deepcopy.go | 7 +---- .../core.rukpak.io_bundledeployments.yaml | 23 ++++++-------- 3 files changed, 18 insertions(+), 42 deletions(-) diff --git a/api/v1alpha2/bundledeployment_types.go b/api/v1alpha2/bundledeployment_types.go index 0a2609bd..67404b4e 100644 --- a/api/v1alpha2/bundledeployment_types.go +++ b/api/v1alpha2/bundledeployment_types.go @@ -71,40 +71,26 @@ type BundleDeploymentSpec struct { Config runtime.RawExtension `json:"config,omitempty"` //+kubebuilder:Optional - // Preflight defines the strategy for the preflight checks (i.e. as of now, the CRD upgrade safety checks) to be enabled or disabled when attempting to install the BundleDeployment. + // Preflight defines the configuration of preflight checks. Preflight *PreflightConfig `json:"preflight,omitempty"` } -// PreflightConfig holds the config for the preflight checks. Currently, this is implemented for the -// CRDUpgradeSafety preflight check and can be extended in the future to add other preflight checks. +// PreflightConfig holds the configuration for the preflight checks. type PreflightConfig struct { //+kubebuilder:Optional + // CRDUpgradeSafety holds necessary configuration for the CRD Upgrade Safety preflight checks. CRDUpgradeSafety *CRDUpgradeSafetyPreflightConfig `json:"crdUpgradeSafety,omitempty"` } -// CRDUpgradeSafetyPreflightConfig is a custom struct that holds the necessary configuration values to -// enable or disable the CRD Upgrade Safety validations. Currently, this holds Mode -// that sets the CRD Upgrade Safety validations to either Enabled/Disabled. -// By default, this is set to "Enabled". +// CRDUpgradeSafetyPreflightConfig is the configuration for CRD upgrade safety preflight check. type CRDUpgradeSafetyPreflightConfig struct { - //+kubebuilder:validation:Enum:=Enabled;Disabled - //+kubebuilder:default:=Enabled + //+kubebuilder:default:=true //+kubebuilder:Optional - Mode *CRDUpgradeSafetyMode `json:"mode,omitempty"` + // Enabled represents the state of the CRD upgrade safety preflight check being enabled/disabled. + // The default value is true. + Enabled bool `json:"enabled,omitempty"` } -type CRDUpgradeSafetyMode string - -const ( - // CRDUpgradeSafetyModeEnabled represents the default state for the - // CRD Upgrade Safety validations by setting it to "Enabled". - CRDUpgradeSafetyModeEnabled CRDUpgradeSafetyMode = "Enabled" - - // CRDUpgradeSafetyModeDisabled represents the option for the - // CRD Upgrade Safety validations to be disabled by setting it to "Disabled". - CRDUpgradeSafetyModeDisabled CRDUpgradeSafetyMode = "Disabled" -) - // BundleDeploymentStatus defines the observed state of BundleDeployment type BundleDeploymentStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` diff --git a/api/v1alpha2/zz_generated.deepcopy.go b/api/v1alpha2/zz_generated.deepcopy.go index 034540f0..fff8c5ed 100644 --- a/api/v1alpha2/zz_generated.deepcopy.go +++ b/api/v1alpha2/zz_generated.deepcopy.go @@ -187,11 +187,6 @@ func (in *BundleSource) DeepCopy() *BundleSource { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CRDUpgradeSafetyPreflightConfig) DeepCopyInto(out *CRDUpgradeSafetyPreflightConfig) { *out = *in - if in.Mode != nil { - in, out := &in.Mode, &out.Mode - *out = new(CRDUpgradeSafetyMode) - **out = **in - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CRDUpgradeSafetyPreflightConfig. @@ -289,7 +284,7 @@ func (in *PreflightConfig) DeepCopyInto(out *PreflightConfig) { if in.CRDUpgradeSafety != nil { in, out := &in.CRDUpgradeSafety, &out.CRDUpgradeSafety *out = new(CRDUpgradeSafetyPreflightConfig) - (*in).DeepCopyInto(*out) + **out = **in } } diff --git a/manifests/base/apis/crds/core.rukpak.io_bundledeployments.yaml b/manifests/base/apis/crds/core.rukpak.io_bundledeployments.yaml index 699d2b3d..b8e1422f 100644 --- a/manifests/base/apis/crds/core.rukpak.io_bundledeployments.yaml +++ b/manifests/base/apis/crds/core.rukpak.io_bundledeployments.yaml @@ -66,23 +66,18 @@ spec: pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ type: string preflight: - description: Preflight defines the strategy for the preflight checks - (i.e. as of now, the CRD upgrade safety checks) to be enabled or - disabled when attempting to install the BundleDeployment. + description: Preflight defines the configuration of preflight checks. properties: crdUpgradeSafety: - description: |- - CRDUpgradeSafetyPreflightConfig is a custom struct that holds the necessary configuration values to - enable or disable the CRD Upgrade Safety validations. Currently, this holds Mode - that sets the CRD Upgrade Safety validations to either Enabled/Disabled. - By default, this is set to "Enabled". + description: CRDUpgradeSafety holds necessary configuration for + the CRD Upgrade Safety preflight checks. properties: - mode: - default: Enabled - enum: - - Enabled - - Disabled - type: string + enabled: + default: true + description: |- + Enabled represents the state of the CRD upgrade safety preflight check being enabled/disabled. + The default value is true. + type: boolean type: object type: object provisionerClassName: