Skip to content

Commit

Permalink
Merge pull request #203 from dprince/core_api
Browse files Browse the repository at this point in the history
Add GaleraSpecCore struct
  • Loading branch information
openshift-merge-bot[bot] authored Mar 7, 2024
2 parents 438dde8 + 4376f3f commit 81216f1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
11 changes: 8 additions & 3 deletions api/v1beta1/galera_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ type AdoptionRedirectSpec struct {

// GaleraSpec defines the desired state of Galera
type GaleraSpec struct {
GaleraSpecCore `json:",inline"`
// Name of the galera container image to run (will be set to environmental default if empty)
// +kubebuilder:validation:Required
ContainerImage string `json:"containerImage"`
}

// GaleraSpec defines the desired state of Galera
type GaleraSpecCore struct {
// Name of the secret to look for password keys
// +kubebuilder:validation:Required
Secret string `json:"secret"`
Expand All @@ -48,9 +56,6 @@ type GaleraSpec struct {
// Storage size allocated for the mariadb databases
// +kubebuilder:validation:Required
StorageRequest string `json:"storageRequest"`
// Name of the galera container image to run (will be set to environmental default if empty)
// +kubebuilder:validation:Required
ContainerImage string `json:"containerImage"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:default=1
// +kubebuilder:validation:Enum=1;3
Expand Down
9 changes: 8 additions & 1 deletion api/v1beta1/galera_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,18 @@ func (r *Galera) Default() {
r.Spec.Default()
}

// Default - set defaults for this MariaDB spec
// Default - set defaults for this GaleraSpec
func (spec *GaleraSpec) Default() {
// only image validations go here
if spec.ContainerImage == "" {
spec.ContainerImage = galeraDefaults.ContainerImageURL
}
spec.GaleraSpecCore.Default()
}

// Default - set defaults for the GaleraSpecCore. This version is used by OpenStackControlplane
func (spec *GaleraSpecCore) Default() {
// nothing here yet
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
Expand Down
22 changes: 19 additions & 3 deletions api/v1beta1/zz_generated.deepcopy.go

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

0 comments on commit 81216f1

Please sign in to comment.