Skip to content

Commit f8efe53

Browse files
Merge pull request openstack-k8s-operators#314 from dprince/core_api
Add NeutronAPISpecCore struct
2 parents afa411c + d41c308 commit f8efe53

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

api/v1beta1/neutronapi_types.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ const (
4242

4343
// NeutronAPISpec defines the desired state of NeutronAPI
4444
type NeutronAPISpec struct {
45+
NeutronAPISpecCore `json:",inline"`
46+
// +kubebuilder:validation:Required
47+
// NeutronAPI Container Image URL (will be set to environmental default if empty)
48+
ContainerImage string `json:"containerImage"`
49+
}
50+
51+
// NeutronAPISpecCore -
52+
type NeutronAPISpecCore struct {
4553
// +kubebuilder:validation:Optional
4654
// +kubebuilder:default=neutron
4755
// ServiceUser - optional username used for this service to register in neutron
@@ -70,10 +78,6 @@ type NeutronAPISpec struct {
7078
// Memcached instance name.
7179
MemcachedInstance string `json:"memcachedInstance"`
7280

73-
// +kubebuilder:validation:Required
74-
// NeutronAPI Container Image URL (will be set to environmental default if empty)
75-
ContainerImage string `json:"containerImage"`
76-
7781
// +kubebuilder:validation:Optional
7882
// +kubebuilder:default=1
7983
// +kubebuilder:validation:Maximum=32

api/v1beta1/neutronapi_webhook.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,16 @@ func (r *NeutronAPI) Default() {
6666

6767
// Default - set defaults for this NeutronAPI spec
6868
func (spec *NeutronAPISpec) Default() {
69+
// only container image validations go here
6970
if spec.ContainerImage == "" {
7071
spec.ContainerImage = neutronAPIDefaults.ContainerImageURL
7172
}
73+
spec.NeutronAPISpecCore.Default()
74+
}
75+
76+
// Default - set defaults for this NeutronAPI spec core. This version gets used by OpenStackControlplane
77+
func (spec *NeutronAPISpecCore) Default() {
78+
// nothing here yet
7279
}
7380

7481
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)