Skip to content

Commit

Permalink
Merge pull request #405 from dprince/core_api
Browse files Browse the repository at this point in the history
Add IronicSpecCore struct
  • Loading branch information
openshift-merge-bot[bot] authored Feb 29, 2024
2 parents c793741 + 3a4bba1 commit 28e3aee
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
13 changes: 9 additions & 4 deletions api/v1beta1/ironic_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,20 @@ const (

// IronicSpec defines the desired state of Ironic
type IronicSpec struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// Whether to deploy a standalone Ironic.
Standalone bool `json:"standalone"`
IronicSpecCore `json:",inline"`

// +kubebuilder:validation:Optional
// +kubebuilder:default={}
// Images - Container images for all ironic services
Images IronicImages `json:"images"`
}

// IronicSpec defines the desired state of Ironic
type IronicSpecCore struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// Whether to deploy a standalone Ironic.
Standalone bool `json:"standalone"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=ironic
Expand Down
9 changes: 9 additions & 0 deletions api/v1beta1/ironic_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ func (r *Ironic) Default() {
// Default - Exported function wrapping non-exported defaulter functions,
// this function can be called externally to default an ironic spec.
func (spec *IronicSpec) Default() {
// only validate default images in this function
if spec.Images.API == "" {
spec.Images.API = imageDefaults.API
}
Expand All @@ -522,4 +523,12 @@ func (spec *IronicSpec) Default() {
if spec.Images.IronicPythonAgent == "" {
spec.Images.IronicPythonAgent = imageDefaults.IronicPythonAgent
}
spec.IronicSpecCore.Default()
}

// Default - Exported function wrapping non-exported defaulter functions,
// this function can be called externally to default an ironic spec.
// NOTE: this version is called by OpenStackControlplane
func (spec *IronicSpecCore) Default() {
// nothing here yet, core validations go here
}
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 28e3aee

Please sign in to comment.