Skip to content

Commit 3f057cc

Browse files
committed
Revert 2b3dcc4 (Remove redis)
This commit reverts 2b3dcc4 (Remove redis) and adapts it to use openstackversion and newer improvements.
1 parent 66f8d7d commit 3f057cc

33 files changed

+491
-6
lines changed

apis/bases/core.openstack.org_openstackcontrolplanes.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15770,6 +15770,28 @@ spec:
1577015770
type: object
1577115771
type: object
1577215772
type: object
15773+
redis:
15774+
properties:
15775+
enabled:
15776+
default: false
15777+
type: boolean
15778+
templates:
15779+
additionalProperties:
15780+
properties:
15781+
replicas:
15782+
default: 1
15783+
format: int32
15784+
type: integer
15785+
tls:
15786+
properties:
15787+
caBundleSecretName:
15788+
type: string
15789+
secretName:
15790+
type: string
15791+
type: object
15792+
type: object
15793+
type: object
15794+
type: object
1577315795
secret:
1577415796
type: string
1577515797
storageClass:
@@ -17591,6 +17613,8 @@ spec:
1759117613
type: string
1759217614
infraMemcachedImage:
1759317615
type: string
17616+
infraRedisImage:
17617+
type: string
1759417618
ironicAPIImage:
1759517619
type: string
1759617620
ironicConductorImage:

apis/bases/core.openstack.org_openstackversions.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ spec:
127127
type: string
128128
infraMemcachedImage:
129129
type: string
130+
infraRedisImage:
131+
type: string
130132
ironicAPIImage:
131133
type: string
132134
ironicConductorImage:
@@ -328,6 +330,8 @@ spec:
328330
type: string
329331
infraMemcachedImage:
330332
type: string
333+
infraRedisImage:
334+
type: string
331335
ironicAPIImage:
332336
type: string
333337
ironicConductorImage:
@@ -500,6 +504,8 @@ spec:
500504
type: string
501505
infraMemcachedImage:
502506
type: string
507+
infraRedisImage:
508+
type: string
503509
ironicAPIImage:
504510
type: string
505511
ironicConductorImage:

apis/core/v1beta1/conditions.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ const (
132132
// OpenStackControlPlaneBarbicanReadyCondition Status=True condition which indicates if Barbican is configured and operational
133133
OpenStackControlPlaneBarbicanReadyCondition condition.Type = "OpenStackControlPlaneBarbicanReady"
134134

135+
// OpenStackControlPlaneRedisReadyCondition Status=True condition which indicates if Redis is configured and operational
136+
OpenStackControlPlaneRedisReadyCondition condition.Type = "OpenStackControlPlaneRedisReady"
137+
135138
// OpenStackControlPlaneExposeOctaviaReadyCondition Status=True condition which indicates if Octavia is exposed via a route
136139
OpenStackControlPlaneExposeOctaviaReadyCondition condition.Type = "OpenStackControlPlaneExposeOctaviaReady"
137140

@@ -406,6 +409,18 @@ const (
406409
// OpenStackControlPlaneManilaReadyErrorMessage
407410
OpenStackControlPlaneManilaReadyErrorMessage = "OpenStackControlPlane Manila error occured %s"
408411

412+
// OpenStackControlPlaneRedisReadyInitMessage
413+
OpenStackControlPlaneRedisReadyInitMessage = "OpenStackControlPlane Redis not started"
414+
415+
// OpenStackControlPlaneRedisReadyMessage
416+
OpenStackControlPlaneRedisReadyMessage = "OpenStackControlPlane Redis completed"
417+
418+
// OpenStackControlPlaneRedisReadyRunningMessage
419+
OpenStackControlPlaneRedisReadyRunningMessage = "OpenStackControlPlane Redis in progress"
420+
421+
// OpenStackControlPlaneRedisReadyErrorMessage
422+
OpenStackControlPlaneRedisReadyErrorMessage = "OpenStackControlPlane Redis error occured %s"
423+
409424
// OpenStackControlPlaneExposeServiceReadyInitMessage
410425
OpenStackControlPlaneExposeServiceReadyInitMessage = "OpenStackControlPlane %s exposing service %s not started"
411426

apis/core/v1beta1/openstackcontrolplane_types.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
horizonv1 "github.com/openstack-k8s-operators/horizon-operator/api/v1beta1"
2828
memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1"
2929
networkv1 "github.com/openstack-k8s-operators/infra-operator/apis/network/v1beta1"
30+
redisv1 "github.com/openstack-k8s-operators/infra-operator/apis/redis/v1beta1"
3031
ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1"
3132
keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
3233
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
@@ -195,6 +196,9 @@ type OpenStackControlPlaneSpec struct {
195196
// Barbican - Parameters related to the Barbican service
196197
Barbican BarbicanSection `json:"barbican,omitempty"`
197198

199+
// Redis - Parameters related to the Redis service
200+
Redis RedisSection `json:"redis,omitempty"`
201+
198202
// +kubebuilder:validation:Optional
199203
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OpenStack Client"
200204
// OpenStackClient - Parameters related to the OpenStackClient
@@ -780,6 +784,20 @@ type BarbicanSection struct {
780784
APIOverride Override `json:"apiOverride,omitempty"`
781785
}
782786

787+
// RedisSection defines the desired state of the Redis service
788+
type RedisSection struct {
789+
// +kubebuilder:validation:Optional
790+
// Enabled - Whether the Redis service should be deployed and managed
791+
// +kubebuilder:default=false
792+
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
793+
Enabled bool `json:"enabled"`
794+
795+
// +kubebuilder:validation:Optional
796+
//+operator-sdk:csv:customresourcedefinitions:type=spec
797+
// Templates - Overrides to use when creating the Redis Resources
798+
Templates *map[string]redisv1.RedisSpecCore `json:"templates,omitempty"`
799+
}
800+
783801
// OpenStackClientSection defines the desired state of the OpenStackClient
784802
type OpenStackClientSection struct {
785803
// +kubebuilder:validation:Optional
@@ -900,6 +918,7 @@ func (instance *OpenStackControlPlane) InitConditions() {
900918
condition.UnknownCondition(OpenStackControlPlaneOctaviaReadyCondition, condition.InitReason, OpenStackControlPlaneOctaviaReadyInitMessage),
901919
condition.UnknownCondition(OpenStackControlPlaneDesignateReadyCondition, condition.InitReason, OpenStackControlPlaneDesignateReadyInitMessage),
902920
condition.UnknownCondition(OpenStackControlPlaneBarbicanReadyCondition, condition.InitReason, OpenStackControlPlaneBarbicanReadyInitMessage),
921+
condition.UnknownCondition(OpenStackControlPlaneRedisReadyCondition, condition.InitReason, OpenStackControlPlaneRedisReadyInitMessage),
903922
condition.UnknownCondition(OpenStackControlPlaneCAReadyCondition, condition.InitReason, OpenStackControlPlaneCAReadyInitMessage),
904923

905924
// Also add the overall status condition as Unknown

apis/core/v1beta1/openstackcontrolplane_webhook.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import (
4646
heatv1 "github.com/openstack-k8s-operators/heat-operator/api/v1beta1"
4747
horizonv1 "github.com/openstack-k8s-operators/horizon-operator/api/v1beta1"
4848
memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1"
49+
redisv1 "github.com/openstack-k8s-operators/infra-operator/apis/redis/v1beta1"
4950
networkv1 "github.com/openstack-k8s-operators/infra-operator/apis/network/v1beta1"
5051
ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1"
5152
manilav1 "github.com/openstack-k8s-operators/manila-operator/api/v1beta1"
@@ -223,6 +224,7 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) string {
223224
reqs = "Galera, Keystone"
224225
}
225226
case "Octavia":
227+
// TODO(beagles): So far we haven't declared Redis as dependency for Octavia, but we might.
226228
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
227229
r.Spec.Keystone.Enabled && r.Spec.Neutron.Enabled && r.Spec.Glance.Enabled && r.Spec.Nova.Enabled &&
228230
r.Spec.Ovn.Enabled) {
@@ -338,6 +340,16 @@ func (r *OpenStackControlPlane) ValidateCreateServices(basePath *field.Path) (ad
338340
}
339341
}
340342

343+
if r.Spec.Redis.Enabled {
344+
if r.Spec.Redis.Templates != nil {
345+
err := common_webhook.ValidateDNS1123Label(
346+
basePath.Child("redis").Child("templates"),
347+
maps.Keys(*r.Spec.Redis.Templates),
348+
redisv1.CrMaxLengthCorrection) // omit issue with statefulset pod label "controller-revision-hash": "<statefulset_name>-<hash>"
349+
errors = append(errors, err...)
350+
}
351+
}
352+
341353
if r.Spec.Rabbitmq.Enabled {
342354
if r.Spec.Rabbitmq.Templates != nil {
343355
err := common_webhook.ValidateDNS1123Label(
@@ -874,6 +886,20 @@ func (r *OpenStackControlPlane) DefaultServices() {
874886
}
875887
r.Spec.Designate.Template.Default()
876888
}
889+
890+
// Redis
891+
if r.Spec.Redis.Enabled || r.Spec.Redis.Templates != nil {
892+
if r.Spec.Redis.Templates == nil {
893+
r.Spec.Redis.Templates = ptr.To(map[string]redisv1.RedisSpecCore{})
894+
}
895+
896+
for key, template := range *r.Spec.Redis.Templates {
897+
template.Default()
898+
// By-value copy, need to update
899+
(*r.Spec.Redis.Templates)[key] = template
900+
}
901+
}
902+
877903
}
878904

879905
// DefaultLabel - adding default label to the OpenStackControlPlane

apis/core/v1beta1/openstackversion_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ type ContainerTemplate struct {
113113
HorizonImage *string `json:"horizonImage,omitempty"`
114114
InfraDnsmasqImage *string `json:"infraDnsmasqImage,omitempty"`
115115
InfraMemcachedImage *string `json:"infraMemcachedImage,omitempty"`
116+
InfraRedisImage *string `json:"infraRedisImage,omitempty"`
116117
IronicAPIImage *string `json:"ironicAPIImage,omitempty"`
117118
IronicConductorImage *string `json:"ironicConductorImage,omitempty"`
118119
IronicInspectorImage *string `json:"ironicInspectorImage,omitempty"`

apis/core/v1beta1/zz_generated.deepcopy.go

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

apis/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/openstack-k8s-operators/glance-operator/api v0.4.1-0.20240909180656-33fe3c05a637
1414
github.com/openstack-k8s-operators/heat-operator/api v0.4.1-0.20240909065043-d5b093777de2
1515
github.com/openstack-k8s-operators/horizon-operator/api v0.4.1-0.20240906120219-9c3e4ba4077b
16-
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240909104215-a2e657dc0f27
16+
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240910085802-31f905cfe219
1717
github.com/openstack-k8s-operators/ironic-operator/api v0.4.1-0.20240909085220-4736023a2e4f
1818
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20240906103150-990fe66f2e5d
1919
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240905123813-174296c09ec6

apis/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ github.com/openstack-k8s-operators/heat-operator/api v0.4.1-0.20240909065043-d5b
102102
github.com/openstack-k8s-operators/heat-operator/api v0.4.1-0.20240909065043-d5b093777de2/go.mod h1:w+8OpHuUfk4nEUSQfFZbYGPZEkn0c1xe3fyZ062fkDA=
103103
github.com/openstack-k8s-operators/horizon-operator/api v0.4.1-0.20240906120219-9c3e4ba4077b h1:B4kw/FovC+mKMRA8dahi2k3x751iOuBwglu9DBz0iX4=
104104
github.com/openstack-k8s-operators/horizon-operator/api v0.4.1-0.20240906120219-9c3e4ba4077b/go.mod h1:Q9/AUCUCA959gIq3DxzUdTWvkwqDp0lz3ujW0vTPdWg=
105-
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240909104215-a2e657dc0f27 h1:wK77qLkj7kzEjrWbrB7Vy6mclC1QHMsbBo9z8xqF6WQ=
106-
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240909104215-a2e657dc0f27/go.mod h1:TFh01OyR/NP5Sy7vikMIpQc80AKl0WWPyYDaJBfFiGc=
105+
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240910085802-31f905cfe219 h1:o0epGu5XkImn5pggs/eyZMBS2Iok8wSaaTXRBwybDCk=
106+
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240910085802-31f905cfe219/go.mod h1:TFh01OyR/NP5Sy7vikMIpQc80AKl0WWPyYDaJBfFiGc=
107107
github.com/openstack-k8s-operators/ironic-operator/api v0.4.1-0.20240909085220-4736023a2e4f h1:Dj1KlPwlXzLyLaEDReJg3sHyo/TMN62pKH3X0L5bsZQ=
108108
github.com/openstack-k8s-operators/ironic-operator/api v0.4.1-0.20240909085220-4736023a2e4f/go.mod h1:iQq0r9XaY6+AN9LaJIvhoetuOwnaGIhU0XkQvHLFT9M=
109109
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20240906103150-990fe66f2e5d h1:PbTZo4RCo+RFiGZ0q/rllUXoUtxgtWAh4V0IUe3aW5k=

config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15770,6 +15770,28 @@ spec:
1577015770
type: object
1577115771
type: object
1577215772
type: object
15773+
redis:
15774+
properties:
15775+
enabled:
15776+
default: false
15777+
type: boolean
15778+
templates:
15779+
additionalProperties:
15780+
properties:
15781+
replicas:
15782+
default: 1
15783+
format: int32
15784+
type: integer
15785+
tls:
15786+
properties:
15787+
caBundleSecretName:
15788+
type: string
15789+
secretName:
15790+
type: string
15791+
type: object
15792+
type: object
15793+
type: object
15794+
type: object
1577315795
secret:
1577415796
type: string
1577515797
storageClass:
@@ -17591,6 +17613,8 @@ spec:
1759117613
type: string
1759217614
infraMemcachedImage:
1759317615
type: string
17616+
infraRedisImage:
17617+
type: string
1759417618
ironicAPIImage:
1759517619
type: string
1759617620
ironicConductorImage:

0 commit comments

Comments
 (0)