diff --git a/api/v1beta1/horizon_types.go b/api/v1beta1/horizon_types.go index 71b27b24..16f7172c 100644 --- a/api/v1beta1/horizon_types.go +++ b/api/v1beta1/horizon_types.go @@ -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 diff --git a/api/v1beta1/horizon_webhook.go b/api/v1beta1/horizon_webhook.go index 1d4bdb3f..37e38ea8 100644 --- a/api/v1beta1/horizon_webhook.go +++ b/api/v1beta1/horizon_webhook.go @@ -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. diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 4acd9318..e1847d6d 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -123,6 +123,22 @@ func (in *HorizonList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HorizonSpec) DeepCopyInto(out *HorizonSpec) { + *out = *in + in.HorizonSpecCore.DeepCopyInto(&out.HorizonSpecCore) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizonSpec. +func (in *HorizonSpec) DeepCopy() *HorizonSpec { + if in == nil { + return nil + } + out := new(HorizonSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HorizonSpecCore) DeepCopyInto(out *HorizonSpecCore) { *out = *in if in.Replicas != nil { in, out := &in.Replicas, &out.Replicas @@ -148,12 +164,12 @@ func (in *HorizonSpec) DeepCopyInto(out *HorizonSpec) { in.TLS.DeepCopyInto(&out.TLS) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizonSpec. -func (in *HorizonSpec) DeepCopy() *HorizonSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizonSpecCore. +func (in *HorizonSpecCore) DeepCopy() *HorizonSpecCore { if in == nil { return nil } - out := new(HorizonSpec) + out := new(HorizonSpecCore) in.DeepCopyInto(out) return out }