Skip to content

Commit

Permalink
Merge pull request #254 from dprince/core_api
Browse files Browse the repository at this point in the history
Add OctaviaSpecCore struct
  • Loading branch information
openshift-merge-bot[bot] authored Mar 5, 2024
2 parents aa54e85 + 3a4ffad commit 2dcd200
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 37 deletions.
13 changes: 9 additions & 4 deletions api/v1beta1/amphoracontroller_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ const (

// OctaviaAmphoraControllerSpec defines common state for all Octavia Amphora Controllers
type OctaviaAmphoraControllerSpec struct {
OctaviaAmphoraControllerSpecCore `json:",inline"`

// +kubebuilder:validation:Optional
// ContainerImage - Amphora Controller Container Image URL
ContainerImage string `json:"containerImage,omitempty"`
}

// OctaviaAmphoraControllerSpecCore -
type OctaviaAmphoraControllerSpecCore struct {
// +kubebuilder:validation:Required
// MariaDB instance name
// Right now required by the maridb-operator to get the credentials from the instance to create the DB
Expand All @@ -58,10 +67,6 @@ type OctaviaAmphoraControllerSpec struct {
// ServiceAccount - service account name used internally to provide Octavia services the default SA name
ServiceAccount string `json:"serviceAccount"`

// +kubebuilder:validation:Optional
// ContainerImage - Amphora Controller Container Image URL
ContainerImage string `json:"containerImage,omitempty"`

// +kubebuilder:validation:Required
// Role - the role for the controller (one of worker, housekeeping, healthmanager)
Role string `json:"role"`
Expand Down
62 changes: 46 additions & 16 deletions api/v1beta1/octavia_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,52 @@ const (
type OctaviaSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
OctaviaSpecBase `json:",inline"`

// +kubebuilder:validation:Required
// OctaviaAPI - Spec definition for the API service of the Octavia deployment
OctaviaAPI OctaviaAPISpec `json:"octaviaAPI"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaHousekeeping OctaviaAmphoraControllerSpec `json:"octaviaHousekeeping"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaHealthManager OctaviaAmphoraControllerSpec `json:"octaviaHealthManager"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaWorker OctaviaAmphoraControllerSpec `json:"octaviaWorker"`
}

// OctaviaSpecCore - this version has no containerImages and is used by OpenStackControlplane
type OctaviaSpecCore struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
OctaviaSpecBase `json:",inline"`

// +kubebuilder:validation:Required
// OctaviaAPI - Spec definition for the API service of the Octavia deployment
OctaviaAPI OctaviaAPISpecCore `json:"octaviaAPI"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaHousekeeping OctaviaAmphoraControllerSpecCore `json:"octaviaHousekeeping"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaHealthManager OctaviaAmphoraControllerSpecCore `json:"octaviaHealthManager"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaWorker OctaviaAmphoraControllerSpecCore `json:"octaviaWorker"`
}

// OctaviaSpecBase -
type OctaviaSpecBase struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// +kubebuilder:validation:Required
// MariaDB instance name
Expand Down Expand Up @@ -97,22 +143,6 @@ type OctaviaSpec struct {
// TODO: -> implement
DefaultConfigOverwrite map[string]string `json:"defaultConfigOverwrite,omitempty"`

// +kubebuilder:validation:Required
// OctaviaAPI - Spec definition for the API service of the Octavia deployment
OctaviaAPI OctaviaAPISpec `json:"octaviaAPI"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaHousekeeping OctaviaAmphoraControllerSpec `json:"octaviaHousekeeping"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaHealthManager OctaviaAmphoraControllerSpec `json:"octaviaHealthManager"`

// +kubebuilder:validation:Optional
// OctaviaHousekeeping - Spec definition for the Octavia Housekeeping agent for the Octavia deployment
OctaviaWorker OctaviaAmphoraControllerSpec `json:"octaviaWorker"`

// +kubebuilder:validation:Optional
// +kubebuilder:default={manageLbMgmtNetworks: true, subnetIpVersion: 4}
LbMgmtNetworks OctaviaLbMgmtNetworks `json:"lbMgmtNetwork"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/octavia_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func (spec *OctaviaSpec) Default() {
}
}

// Default - set defaults for this Octavia core spec (this version is used by the OpenStackControlplane webhook)
func (spec *OctaviaSpecCore) Default() {
// nothing here yet
}

// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
//+kubebuilder:webhook:path=/validate-octavia-openstack-org-v1beta1-octavia,mutating=false,failurePolicy=fail,sideEffects=None,groups=octavia.openstack.org,resources=octavias,verbs=create;update,versions=v1beta1,name=voctavia.kb.io,admissionReviewVersions=v1

Expand Down
13 changes: 9 additions & 4 deletions api/v1beta1/octaviaapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ const (

// OctaviaAPISpec defines the desired state of OctaviaAPI
type OctaviaAPISpec struct {
OctaviaAPISpecCore `json:",inline"`

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

// OctaviaAPISpecCore -
type OctaviaAPISpecCore struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

Expand Down Expand Up @@ -63,10 +72,6 @@ type OctaviaAPISpec struct {
// ServiceAccount - service account name used internally to provide Octavia services the default SA name
ServiceAccount string `json:"serviceAccount"`

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

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
// +kubebuilder:validation:Maximum=32
Expand Down
94 changes: 81 additions & 13 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 2dcd200

Please sign in to comment.