Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Add optional field to BundleDeployment API to enable/disable CRD upgr…
Browse files Browse the repository at this point in the history
…ade safety preflight checks

Signed-off-by: Rashmi Gottipati <chowdary.grashmi@gmail.com>
  • Loading branch information
rashmigottipati committed May 23, 2024
1 parent 96043d4 commit bd8fd4a
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
34 changes: 34 additions & 0 deletions api/v1alpha2/bundledeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,42 @@ type BundleDeploymentSpec struct {
//
// config is provisioner specific configurations
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 *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.
type PreflightConfig struct {
//+kubebuilder:Optional
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".
type CRDUpgradeSafetyPreflightConfig struct {
//+kubebuilder:validation:Enum:=Enabled;Disabled
//+kubebuilder:default:=Enabled
//+kubebuilder:Optional
Mode *CRDUpgradeSafetyMode `json:"mode,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"`
Expand Down
45 changes: 45 additions & 0 deletions api/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions manifests/base/apis/crds/core.rukpak.io_bundledeployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ spec:
maxLength: 63
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.
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".
properties:
mode:
default: Enabled
enum:
- Enabled
- Disabled
type: string
type: object
type: object
provisionerClassName:
description: provisionerClassName sets the name of the provisioner
that should reconcile this BundleDeployment.
Expand Down

0 comments on commit bd8fd4a

Please sign in to comment.