Skip to content

Commit 096b4e2

Browse files
committed
Add *Core structs for redis,netconfig,memcached
Adds a version of the structs (called "core") is meant to be used via the OpenStackControlplane. It is the same as the normal Spec's for redis, netconfig, and memcached only it is missing the containerImages. The Default() function for webhooks has been updated accordingly. Jira: OSPRH-4835
1 parent 49edc0d commit 096b4e2

File tree

9 files changed

+93
-9
lines changed

9 files changed

+93
-9
lines changed

apis/memcached/v1beta1/memcached_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@ const (
3232

3333
// MemcachedSpec defines the desired state of Memcached
3434
type MemcachedSpec struct {
35+
MemcachedSpecCore `json:",inline"`
36+
3537
// +kubebuilder:validation:Required
3638
// Name of the memcached container image to run (will be set to environmental default if empty)
3739
ContainerImage string `json:"containerImage"`
40+
}
41+
42+
// MemcachedSpecCore - this version is used by the OpenStackControlplane CR (no container images)
43+
type MemcachedSpecCore struct {
3844

3945
// +kubebuilder:validation:Optional
4046
// +kubebuilder:default=1

apis/memcached/v1beta1/memcached_webhook.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ func (spec *MemcachedSpec) Default() {
6969
if spec.ContainerImage == "" {
7070
spec.ContainerImage = memcachedDefaults.ContainerImageURL
7171
}
72+
spec.MemcachedSpecCore.Default()
73+
}
74+
75+
// Default - common validations go here (for the OpenStackControlplane which uses this one)
76+
func (spec *MemcachedSpecCore) Default() {
77+
// nothing here
7278
}
7379

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

apis/memcached/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.

apis/network/v1beta1/dnsmasq_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ type DNSMasqOption struct {
4646

4747
// DNSMasqSpec defines the desired state of DNSMasq
4848
type DNSMasqSpec struct {
49+
DNSMasqSpecCore `json:",inline"`
50+
4951
// +kubebuilder:validation:Optional
5052
// DNSMasq Container Image URL
5153
ContainerImage string `json:"containerImage"`
54+
}
55+
56+
// DNSMasqSpecCore - this version is used by the OpenStackControlplane CR (no container images)
57+
type DNSMasqSpecCore struct {
5258

5359
// +kubebuilder:validation:Optional
5460
// +kubebuilder:default=1

apis/network/v1beta1/dnsmasq_webhook.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ func (spec *DNSMasqSpec) Default() {
6363
if spec.ContainerImage == "" {
6464
spec.ContainerImage = dnsMasqDefaults.ContainerImageURL
6565
}
66+
spec.DNSMasqSpecCore.Default()
67+
}
68+
69+
// Default - common validations go here (for the OpenStackControlplane which uses this one)
70+
func (spec *DNSMasqSpecCore) Default() {
71+
// nothing here
6672
}
6773

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

apis/network/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.

apis/redis/v1beta1/redis_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@ const (
3232

3333
// RedisSpec defines the desired state of Redis
3434
type RedisSpec struct {
35+
RedisSpecCore `json:",inline"`
36+
3537
// +kubebuilder:validation:Required
3638
// Name of the redis container image to run (will be set to environmental default if empty)
3739
ContainerImage string `json:"containerImage"`
40+
}
41+
42+
// RedisSpecCore - this version is used by the OpenStackControlplane CR (no container images)
43+
type RedisSpecCore struct {
3844
// +kubebuilder:validation:Optional
3945
// +kubebuilder:default=1
4046
// Size of the redis cluster

apis/redis/v1beta1/redis_webhook.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ func (spec *RedisSpec) Default() {
6969
if spec.ContainerImage == "" {
7070
spec.ContainerImage = redisDefaults.ContainerImageURL
7171
}
72+
spec.RedisSpecCore.Default()
73+
}
74+
75+
// Default - common validations go here (for the OpenStackControlplane which uses this one)
76+
func (spec *RedisSpecCore) Default() {
77+
//nothing to validate yet
7278
}
7379

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

apis/redis/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)