Skip to content

Commit

Permalink
Add HorizonSpecCore struct
Browse files Browse the repository at this point in the history
This version of the struct (called "core") is meant to
be used via the OpenStackControlplane. It is the same
as HorizonSpec only it is missing the containerImages.

The Default() function for webhooks has been split accordingly.

Jira: OSPRH-4835
  • Loading branch information
dprince committed Feb 28, 2024
1 parent 40f475a commit c1363cc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
6 changes: 6 additions & 0 deletions api/v1beta1/horizon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ const (

// HorizonSpec defines the desired state of Horizon
type HorizonSpec struct {
HorizonSpecCore `json:",inline"`

// +kubebuilder:validation:Required
// horizon Container Image URL
ContainerImage string `json:"containerImage"`
}

// HorizonSpecBase -
type HorizonSpecCore struct {

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
Expand Down
7 changes: 7 additions & 0 deletions api/v1beta1/horizon_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,16 @@ func (r *Horizon) Default() {

// Default - set defaults for this Horizon spec
func (spec *HorizonSpec) Default() {
// NOTE: only containerImage validations go here
if spec.ContainerImage == "" {
spec.ContainerImage = horizonDefaults.ContainerImageURL
}
spec.HorizonSpecCore.Default()
}

// Default - set defaults for this Horizon spec core (this one gets used by OpenstackControlPlane)
func (spec *HorizonSpecCore) 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 c1363cc

Please sign in to comment.