Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#1054 from lmiccini/restore…
Browse files Browse the repository at this point in the history
…-redis2

Revert 2b3dcc4 (Remove redis)
  • Loading branch information
openshift-merge-bot[bot] authored Sep 11, 2024
2 parents 66f8d7d + 3f057cc commit cbcb33f
Show file tree
Hide file tree
Showing 33 changed files with 491 additions and 6 deletions.
24 changes: 24 additions & 0 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15770,6 +15770,28 @@ spec:
type: object
type: object
type: object
redis:
properties:
enabled:
default: false
type: boolean
templates:
additionalProperties:
properties:
replicas:
default: 1
format: int32
type: integer
tls:
properties:
caBundleSecretName:
type: string
secretName:
type: string
type: object
type: object
type: object
type: object
secret:
type: string
storageClass:
Expand Down Expand Up @@ -17591,6 +17613,8 @@ spec:
type: string
infraMemcachedImage:
type: string
infraRedisImage:
type: string
ironicAPIImage:
type: string
ironicConductorImage:
Expand Down
6 changes: 6 additions & 0 deletions apis/bases/core.openstack.org_openstackversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ spec:
type: string
infraMemcachedImage:
type: string
infraRedisImage:
type: string
ironicAPIImage:
type: string
ironicConductorImage:
Expand Down Expand Up @@ -328,6 +330,8 @@ spec:
type: string
infraMemcachedImage:
type: string
infraRedisImage:
type: string
ironicAPIImage:
type: string
ironicConductorImage:
Expand Down Expand Up @@ -500,6 +504,8 @@ spec:
type: string
infraMemcachedImage:
type: string
infraRedisImage:
type: string
ironicAPIImage:
type: string
ironicConductorImage:
Expand Down
15 changes: 15 additions & 0 deletions apis/core/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ const (
// OpenStackControlPlaneBarbicanReadyCondition Status=True condition which indicates if Barbican is configured and operational
OpenStackControlPlaneBarbicanReadyCondition condition.Type = "OpenStackControlPlaneBarbicanReady"

// OpenStackControlPlaneRedisReadyCondition Status=True condition which indicates if Redis is configured and operational
OpenStackControlPlaneRedisReadyCondition condition.Type = "OpenStackControlPlaneRedisReady"

// OpenStackControlPlaneExposeOctaviaReadyCondition Status=True condition which indicates if Octavia is exposed via a route
OpenStackControlPlaneExposeOctaviaReadyCondition condition.Type = "OpenStackControlPlaneExposeOctaviaReady"

Expand Down Expand Up @@ -406,6 +409,18 @@ const (
// OpenStackControlPlaneManilaReadyErrorMessage
OpenStackControlPlaneManilaReadyErrorMessage = "OpenStackControlPlane Manila error occured %s"

// OpenStackControlPlaneRedisReadyInitMessage
OpenStackControlPlaneRedisReadyInitMessage = "OpenStackControlPlane Redis not started"

// OpenStackControlPlaneRedisReadyMessage
OpenStackControlPlaneRedisReadyMessage = "OpenStackControlPlane Redis completed"

// OpenStackControlPlaneRedisReadyRunningMessage
OpenStackControlPlaneRedisReadyRunningMessage = "OpenStackControlPlane Redis in progress"

// OpenStackControlPlaneRedisReadyErrorMessage
OpenStackControlPlaneRedisReadyErrorMessage = "OpenStackControlPlane Redis error occured %s"

// OpenStackControlPlaneExposeServiceReadyInitMessage
OpenStackControlPlaneExposeServiceReadyInitMessage = "OpenStackControlPlane %s exposing service %s not started"

Expand Down
19 changes: 19 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
horizonv1 "github.com/openstack-k8s-operators/horizon-operator/api/v1beta1"
memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1"
networkv1 "github.com/openstack-k8s-operators/infra-operator/apis/network/v1beta1"
redisv1 "github.com/openstack-k8s-operators/infra-operator/apis/redis/v1beta1"
ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1"
keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
Expand Down Expand Up @@ -195,6 +196,9 @@ type OpenStackControlPlaneSpec struct {
// Barbican - Parameters related to the Barbican service
Barbican BarbicanSection `json:"barbican,omitempty"`

// Redis - Parameters related to the Redis service
Redis RedisSection `json:"redis,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OpenStack Client"
// OpenStackClient - Parameters related to the OpenStackClient
Expand Down Expand Up @@ -780,6 +784,20 @@ type BarbicanSection struct {
APIOverride Override `json:"apiOverride,omitempty"`
}

// RedisSection defines the desired state of the Redis service
type RedisSection struct {
// +kubebuilder:validation:Optional
// Enabled - Whether the Redis service should be deployed and managed
// +kubebuilder:default=false
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"}
Enabled bool `json:"enabled"`

// +kubebuilder:validation:Optional
//+operator-sdk:csv:customresourcedefinitions:type=spec
// Templates - Overrides to use when creating the Redis Resources
Templates *map[string]redisv1.RedisSpecCore `json:"templates,omitempty"`
}

// OpenStackClientSection defines the desired state of the OpenStackClient
type OpenStackClientSection struct {
// +kubebuilder:validation:Optional
Expand Down Expand Up @@ -900,6 +918,7 @@ func (instance *OpenStackControlPlane) InitConditions() {
condition.UnknownCondition(OpenStackControlPlaneOctaviaReadyCondition, condition.InitReason, OpenStackControlPlaneOctaviaReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneDesignateReadyCondition, condition.InitReason, OpenStackControlPlaneDesignateReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneBarbicanReadyCondition, condition.InitReason, OpenStackControlPlaneBarbicanReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneRedisReadyCondition, condition.InitReason, OpenStackControlPlaneRedisReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneCAReadyCondition, condition.InitReason, OpenStackControlPlaneCAReadyInitMessage),

// Also add the overall status condition as Unknown
Expand Down
26 changes: 26 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
heatv1 "github.com/openstack-k8s-operators/heat-operator/api/v1beta1"
horizonv1 "github.com/openstack-k8s-operators/horizon-operator/api/v1beta1"
memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1"
redisv1 "github.com/openstack-k8s-operators/infra-operator/apis/redis/v1beta1"
networkv1 "github.com/openstack-k8s-operators/infra-operator/apis/network/v1beta1"
ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1"
manilav1 "github.com/openstack-k8s-operators/manila-operator/api/v1beta1"
Expand Down Expand Up @@ -223,6 +224,7 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) string {
reqs = "Galera, Keystone"
}
case "Octavia":
// TODO(beagles): So far we haven't declared Redis as dependency for Octavia, but we might.
if !((r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled &&
r.Spec.Keystone.Enabled && r.Spec.Neutron.Enabled && r.Spec.Glance.Enabled && r.Spec.Nova.Enabled &&
r.Spec.Ovn.Enabled) {
Expand Down Expand Up @@ -338,6 +340,16 @@ func (r *OpenStackControlPlane) ValidateCreateServices(basePath *field.Path) (ad
}
}

if r.Spec.Redis.Enabled {
if r.Spec.Redis.Templates != nil {
err := common_webhook.ValidateDNS1123Label(
basePath.Child("redis").Child("templates"),
maps.Keys(*r.Spec.Redis.Templates),
redisv1.CrMaxLengthCorrection) // omit issue with statefulset pod label "controller-revision-hash": "<statefulset_name>-<hash>"
errors = append(errors, err...)
}
}

if r.Spec.Rabbitmq.Enabled {
if r.Spec.Rabbitmq.Templates != nil {
err := common_webhook.ValidateDNS1123Label(
Expand Down Expand Up @@ -874,6 +886,20 @@ func (r *OpenStackControlPlane) DefaultServices() {
}
r.Spec.Designate.Template.Default()
}

// Redis
if r.Spec.Redis.Enabled || r.Spec.Redis.Templates != nil {
if r.Spec.Redis.Templates == nil {
r.Spec.Redis.Templates = ptr.To(map[string]redisv1.RedisSpecCore{})
}

for key, template := range *r.Spec.Redis.Templates {
template.Default()
// By-value copy, need to update
(*r.Spec.Redis.Templates)[key] = template
}
}

}

// DefaultLabel - adding default label to the OpenStackControlPlane
Expand Down
1 change: 1 addition & 0 deletions apis/core/v1beta1/openstackversion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type ContainerTemplate struct {
HorizonImage *string `json:"horizonImage,omitempty"`
InfraDnsmasqImage *string `json:"infraDnsmasqImage,omitempty"`
InfraMemcachedImage *string `json:"infraMemcachedImage,omitempty"`
InfraRedisImage *string `json:"infraRedisImage,omitempty"`
IronicAPIImage *string `json:"ironicAPIImage,omitempty"`
IronicConductorImage *string `json:"ironicConductorImage,omitempty"`
IronicInspectorImage *string `json:"ironicInspectorImage,omitempty"`
Expand Down
33 changes: 33 additions & 0 deletions apis/core/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/openstack-k8s-operators/glance-operator/api v0.4.1-0.20240909180656-33fe3c05a637
github.com/openstack-k8s-operators/heat-operator/api v0.4.1-0.20240909065043-d5b093777de2
github.com/openstack-k8s-operators/horizon-operator/api v0.4.1-0.20240906120219-9c3e4ba4077b
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240909104215-a2e657dc0f27
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240910085802-31f905cfe219
github.com/openstack-k8s-operators/ironic-operator/api v0.4.1-0.20240909085220-4736023a2e4f
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20240906103150-990fe66f2e5d
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240905123813-174296c09ec6
Expand Down
4 changes: 2 additions & 2 deletions apis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ github.com/openstack-k8s-operators/heat-operator/api v0.4.1-0.20240909065043-d5b
github.com/openstack-k8s-operators/heat-operator/api v0.4.1-0.20240909065043-d5b093777de2/go.mod h1:w+8OpHuUfk4nEUSQfFZbYGPZEkn0c1xe3fyZ062fkDA=
github.com/openstack-k8s-operators/horizon-operator/api v0.4.1-0.20240906120219-9c3e4ba4077b h1:B4kw/FovC+mKMRA8dahi2k3x751iOuBwglu9DBz0iX4=
github.com/openstack-k8s-operators/horizon-operator/api v0.4.1-0.20240906120219-9c3e4ba4077b/go.mod h1:Q9/AUCUCA959gIq3DxzUdTWvkwqDp0lz3ujW0vTPdWg=
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240909104215-a2e657dc0f27 h1:wK77qLkj7kzEjrWbrB7Vy6mclC1QHMsbBo9z8xqF6WQ=
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240909104215-a2e657dc0f27/go.mod h1:TFh01OyR/NP5Sy7vikMIpQc80AKl0WWPyYDaJBfFiGc=
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240910085802-31f905cfe219 h1:o0epGu5XkImn5pggs/eyZMBS2Iok8wSaaTXRBwybDCk=
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240910085802-31f905cfe219/go.mod h1:TFh01OyR/NP5Sy7vikMIpQc80AKl0WWPyYDaJBfFiGc=
github.com/openstack-k8s-operators/ironic-operator/api v0.4.1-0.20240909085220-4736023a2e4f h1:Dj1KlPwlXzLyLaEDReJg3sHyo/TMN62pKH3X0L5bsZQ=
github.com/openstack-k8s-operators/ironic-operator/api v0.4.1-0.20240909085220-4736023a2e4f/go.mod h1:iQq0r9XaY6+AN9LaJIvhoetuOwnaGIhU0XkQvHLFT9M=
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20240906103150-990fe66f2e5d h1:PbTZo4RCo+RFiGZ0q/rllUXoUtxgtWAh4V0IUe3aW5k=
Expand Down
24 changes: 24 additions & 0 deletions config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15770,6 +15770,28 @@ spec:
type: object
type: object
type: object
redis:
properties:
enabled:
default: false
type: boolean
templates:
additionalProperties:
properties:
replicas:
default: 1
format: int32
type: integer
tls:
properties:
caBundleSecretName:
type: string
secretName:
type: string
type: object
type: object
type: object
type: object
secret:
type: string
storageClass:
Expand Down Expand Up @@ -17591,6 +17613,8 @@ spec:
type: string
infraMemcachedImage:
type: string
infraRedisImage:
type: string
ironicAPIImage:
type: string
ironicConductorImage:
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/core.openstack.org_openstackversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ spec:
type: string
infraMemcachedImage:
type: string
infraRedisImage:
type: string
ironicAPIImage:
type: string
ironicConductorImage:
Expand Down Expand Up @@ -328,6 +330,8 @@ spec:
type: string
infraMemcachedImage:
type: string
infraRedisImage:
type: string
ironicAPIImage:
type: string
ironicConductorImage:
Expand Down Expand Up @@ -500,6 +504,8 @@ spec:
type: string
infraMemcachedImage:
type: string
infraRedisImage:
type: string
ironicAPIImage:
type: string
ironicConductorImage:
Expand Down
2 changes: 2 additions & 0 deletions config/default/manager_default_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ spec:
value: quay.io/podified-antelope-centos9/openstack-horizon:current-podified
- name: RELATED_IMAGE_INFRA_MEMCACHED_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/openstack-memcached:current-podified
- name: RELATED_IMAGE_INFRA_REDIS_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/openstack-redis:current-podified
- name: RELATED_IMAGE_IRONIC_API_IMAGE_URL_DEFAULT
value: quay.io/podified-antelope-centos9/openstack-ironic-api:current-podified
- name: RELATED_IMAGE_IRONIC_CONDUCTOR_IMAGE_URL_DEFAULT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,14 @@ spec:
- description: Templates - Overrides to use when creating the Rabbitmq clusters
displayName: Templates
path: rabbitmq.templates
- description: Enabled - Whether the Redis service should be deployed and managed
displayName: Enabled
path: redis.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Templates - Overrides to use when creating the Redis Resources
displayName: Templates
path: redis.templates
- description: 'Secret - FIXME: make this optional'
displayName: Secret
path: secret
Expand Down
12 changes: 12 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- redis.openstack.org
resources:
- redises
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- route.openshift.io
resources:
Expand Down
Loading

0 comments on commit cbcb33f

Please sign in to comment.