Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#231 from dciabrin/memcached
Browse files Browse the repository at this point in the history
Support for Memcached in the control plane
  • Loading branch information
openshift-merge-robot authored Mar 17, 2023
2 parents 83ce028 + ac1813f commit 7236c5f
Show file tree
Hide file tree
Showing 16 changed files with 290 additions and 0 deletions.
26 changes: 26 additions & 0 deletions apis/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22268,6 +22268,32 @@ spec:
databases
type: object
type: object
memcached:
description: Memcached - Parameters related to the Memcached service
properties:
enabled:
default: false
description: Enabled - Whether Memcached services should be deployed
and managed
type: boolean
templates:
additionalProperties:
description: MemcachedSpec defines the desired state of Memcached
properties:
containerImage:
default: quay.io/tripleozedcentos9/openstack-memcached:current-tripleo
description: Name of the memcached container image to run
type: string
replicas:
default: 1
description: Size of the memcached cluster
format: int32
type: integer
type: object
description: Templates - Overrides to use when creating the Memcached
databases
type: object
type: object
neutron:
description: Neutron - Overrides to use when creating the Neutron
Service
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 @@ -27,6 +27,9 @@ const (
// OpenStackControlPlaneMariaDBReadyCondition Status=True condition which indicates if MariaDB is configured and operational
OpenStackControlPlaneMariaDBReadyCondition condition.Type = "OpenStackControlPlaneMariaDBReady"

// OpenStackControlPlaneMemcachedReadyCondition Status=True condition which indicates if Memcached is configured and operational
OpenStackControlPlaneMemcachedReadyCondition condition.Type = "OpenStackControlPlaneMemcachedReady"

// OpenStackControlPlaneKeystoneAPIReadyCondition Status=True condition which indicates if KeystoneAPI is configured and operational
OpenStackControlPlaneKeystoneAPIReadyCondition condition.Type = "OpenStackControlPlaneKeystoneAPIReady"

Expand Down Expand Up @@ -97,6 +100,18 @@ const (
// OpenStackControlPlaneMariaDBReadyErrorMessage
OpenStackControlPlaneMariaDBReadyErrorMessage = "OpenStackControlPlane MariaDB error occured %s"

// OpenStackControlPlaneMemcachedReadyInitMessage
OpenStackControlPlaneMemcachedReadyInitMessage = "OpenStackControlPlane Memcached not started"

// OpenStackControlPlaneMemcachedReadyMessage
OpenStackControlPlaneMemcachedReadyMessage = "OpenStackControlPlane Memcached completed"

// OpenStackControlPlaneMemcachedReadyRunningMessage
OpenStackControlPlaneMemcachedReadyRunningMessage = "OpenStackControlPlane Memcached in progress"

// OpenStackControlPlaneMemcachedReadyErrorMessage
OpenStackControlPlaneMemcachedReadyErrorMessage = "OpenStackControlPlane Memcached error occured %s"

// OpenStackControlPlaneKeystoneAPIReadyInitMessage
OpenStackControlPlaneKeystoneAPIReadyInitMessage = "OpenStackControlPlane KeystoneAPI not started"

Expand Down
18 changes: 18 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1"
glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1"
memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/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 @@ -88,6 +89,10 @@ type OpenStackControlPlaneSpec struct {
// Rabbitmq - Parameters related to the Rabbitmq service
Rabbitmq RabbitmqSection `json:"rabbitmq,omitempty"`

// +kubebuilder:validation:Optional
// Memcached - Parameters related to the Memcached service
Memcached MemcachedSection `json:"memcached,omitempty"`

//+operator-sdk:csv:customresourcedefinitions:type=spec
// Ovn - Overrides to use when creating the OVN Services
Ovn OvnSection `json:"ovn,omitempty"`
Expand Down Expand Up @@ -220,6 +225,18 @@ type RabbitmqSection struct {
Templates map[string]RabbitmqTemplate `json:"templates"`
}

// MemcachedSection defines the desired state of Memcached services
type MemcachedSection struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// Enabled - Whether Memcached services should be deployed and managed
Enabled bool `json:"enabled"`

// +kubebuilder:validation:Optional
// Templates - Overrides to use when creating the Memcached databases
Templates map[string]memcachedv1.MemcachedSpec `json:"templates,omitempty"`
}

// RabbitmqTemplate definition
type RabbitmqTemplate struct {
// +kubebuilder:validation:Required
Expand Down Expand Up @@ -418,6 +435,7 @@ func (instance OpenStackControlPlane) InitConditions() {
condition.UnknownCondition(OpenStackControlPlaneOVSReadyCondition, condition.InitReason, OpenStackControlPlaneOVSReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneNeutronReadyCondition, condition.InitReason, OpenStackControlPlaneNeutronReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneMariaDBReadyCondition, condition.InitReason, OpenStackControlPlaneMariaDBReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneMemcachedReadyCondition, condition.InitReason, OpenStackControlPlaneMemcachedReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneKeystoneAPIReadyCondition, condition.InitReason, OpenStackControlPlaneKeystoneAPIReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlanePlacementAPIReadyCondition, condition.InitReason, OpenStackControlPlanePlacementAPIReadyInitMessage),
condition.UnknownCondition(OpenStackControlPlaneGlanceReadyCondition, condition.InitReason, OpenStackControlPlaneGlanceReadyInitMessage),
Expand Down
24 changes: 24 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.

1 change: 1 addition & 0 deletions apis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.19
require (
github.com/openstack-k8s-operators/cinder-operator/api v0.0.0-20230315143457-cf28b9aa5fd3
github.com/openstack-k8s-operators/glance-operator/api v0.0.0-20230315114127-b6fe60836981
github.com/openstack-k8s-operators/infra-operator/apis v0.0.0-20230313171323-3a588eef4569
github.com/openstack-k8s-operators/ironic-operator/api v0.0.0-20230314203009-07dc0313f02a
github.com/openstack-k8s-operators/keystone-operator/api v0.0.0-20230316144108-f5073e746f5b
github.com/openstack-k8s-operators/lib-common/modules/common v0.0.0-20230316162802-ec9e5af1b048
Expand Down
2 changes: 2 additions & 0 deletions apis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ github.com/openstack-k8s-operators/cinder-operator/api v0.0.0-20230315143457-cf2
github.com/openstack-k8s-operators/cinder-operator/api v0.0.0-20230315143457-cf28b9aa5fd3/go.mod h1:auuZ2u46FUzMsA5odCDsKCDVtuJ7Tz8xWkyX5Qt7UxQ=
github.com/openstack-k8s-operators/glance-operator/api v0.0.0-20230315114127-b6fe60836981 h1:AJEgrusK1lOCLLboQ693Y90sYQ+ZLqDdqjo9C0hCELA=
github.com/openstack-k8s-operators/glance-operator/api v0.0.0-20230315114127-b6fe60836981/go.mod h1:Nb9Zb6XqbLc6Jc8hidXsk/tKh20r9ZJko51g2jVTPhs=
github.com/openstack-k8s-operators/infra-operator/apis v0.0.0-20230313171323-3a588eef4569 h1:KTFb/Chud/N97NZh7kKjYu33EYr94fi43WUze+/AAcM=
github.com/openstack-k8s-operators/infra-operator/apis v0.0.0-20230313171323-3a588eef4569/go.mod h1:5kG0Ct412tO3fNkZ5b3/BwwSsV7LkSNfOB/apUlbMJI=
github.com/openstack-k8s-operators/ironic-operator/api v0.0.0-20230314203009-07dc0313f02a h1:P2koKsWnk+GdFzGni+RPRPdoal/j7mIEJu1kkYG73uE=
github.com/openstack-k8s-operators/ironic-operator/api v0.0.0-20230314203009-07dc0313f02a/go.mod h1:XZmZtknXPtHUZamlrGjk/pOYv3yvfdZiOkY7sgxI3KM=
github.com/openstack-k8s-operators/keystone-operator/api v0.0.0-20230316144108-f5073e746f5b h1:HGE4a+40fDTMkBHUne2AtFUNIEYFdgKUdBGbAo4H5kM=
Expand Down
26 changes: 26 additions & 0 deletions config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22268,6 +22268,32 @@ spec:
databases
type: object
type: object
memcached:
description: Memcached - Parameters related to the Memcached service
properties:
enabled:
default: false
description: Enabled - Whether Memcached services should be deployed
and managed
type: boolean
templates:
additionalProperties:
description: MemcachedSpec defines the desired state of Memcached
properties:
containerImage:
default: quay.io/tripleozedcentos9/openstack-memcached:current-tripleo
description: Name of the memcached container image to run
type: string
replicas:
default: 1
description: Size of the memcached cluster
format: int32
type: integer
type: object
description: Templates - Overrides to use when creating the Memcached
databases
type: object
type: object
neutron:
description: Neutron - Overrides to use when creating the Neutron
Service
Expand Down
12 changes: 12 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- memcached.openstack.org
resources:
- memcacheds
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- neutron.openstack.org
resources:
Expand Down
6 changes: 6 additions & 0 deletions config/samples/core_v1beta1_openstackcontrolplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ spec:
# memory: 1Gi
rabbitmq-cell1:
replicas: 1
memcached:
enabled: true
templates:
memcached:
containerImage: quay.io/tripleozedcentos9/openstack-memcached:current-tripleo
replicas: 1
placement:
template:
databaseInstance: openstack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ spec:
# limits:
# cpu: 800m
# memory: 1Gi
memcached:
enabled: true
templates:
memcached:
containerImage: quay.io/tripleozedcentos9/openstack-memcached:current-tripleo
replicas: 1
placement:
template:
databaseInstance: openstack
Expand Down
6 changes: 6 additions & 0 deletions config/samples/core_v1beta1_openstackcontrolplane_galera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ spec:
# memory: 1Gi
rabbitmq-cell1:
replicas: 1
memcached:
enabled: true
templates:
memcached:
containerImage: quay.io/tripleozedcentos9/openstack-memcached:current-tripleo
replicas: 1
placement:
template:
databaseInstance: openstack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ spec:
openstack:
containerImage: quay.io/tripleozedcentos9/openstack-mariadb:current-tripleo
storageRequest: 500M
memcached:
enabled: true
templates:
memcached:
containerImage: quay.io/tripleozedcentos9/openstack-memcached:current-tripleo
replicas: 1
neutron:
template:
databaseInstance: openstack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ spec:
# memory: 1Gi
rabbitmq-cell1:
replicas: 1
memcached:
enabled: true
templates:
memcached:
containerImage: quay.io/tripleozedcentos9/openstack-memcached:current-tripleo
replicas: 1
placement:
template:
databaseInstance: openstack
Expand Down
10 changes: 10 additions & 0 deletions controllers/core/openstackcontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
cinderv1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1"
glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1"
clientv1beta1 "github.com/openstack-k8s-operators/infra-operator/apis/client/v1beta1"
memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/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 @@ -68,6 +69,7 @@ type OpenStackControlPlaneReconciler struct {
//+kubebuilder:rbac:groups=nova.openstack.org,resources=nova,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=mariadb.openstack.org,resources=mariadbs,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=mariadb.openstack.org,resources=galeras,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=memcached.openstack.org,resources=memcacheds,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=neutron.openstack.org,resources=neutronapis,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=ovn.openstack.org,resources=ovndbclusters,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=ovn.openstack.org,resources=ovnnorthds,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -159,6 +161,13 @@ func (r *OpenStackControlPlaneReconciler) reconcileNormal(ctx context.Context, i
return ctrlResult, nil
}

ctrlResult, err = openstack.ReconcileMemcacheds(ctx, instance, helper)
if err != nil {
return ctrl.Result{}, err
} else if (ctrlResult != ctrl.Result{}) {
return ctrlResult, nil
}

ctrlResult, err = openstack.ReconcileKeystoneAPI(ctx, instance, helper)
if err != nil {
return ctrl.Result{}, err
Expand Down Expand Up @@ -238,6 +247,7 @@ func (r *OpenStackControlPlaneReconciler) SetupWithManager(mgr ctrl.Manager) err
For(&corev1beta1.OpenStackControlPlane{}).
Owns(&mariadbv1.MariaDB{}).
Owns(&mariadbv1.Galera{}).
Owns(&memcachedv1.Memcached{}).
Owns(&keystonev1.KeystoneAPI{}).
Owns(&placementv1.PlacementAPI{}).
Owns(&glancev1.Glance{}).
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
dataplanev1beta1 "github.com/openstack-k8s-operators/dataplane-operator/api/v1beta1"
glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1"
clientv1 "github.com/openstack-k8s-operators/infra-operator/apis/client/v1beta1"
memcachedv1 "github.com/openstack-k8s-operators/infra-operator/apis/memcached/v1beta1"
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
ironicv1 "github.com/openstack-k8s-operators/ironic-operator/api/v1beta1"
keystonev1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
Expand Down Expand Up @@ -67,6 +68,7 @@ func init() {
utilruntime.Must(corev1beta1.AddToScheme(scheme))
utilruntime.Must(keystonev1.AddToScheme(scheme))
utilruntime.Must(mariadbv1.AddToScheme(scheme))
utilruntime.Must(memcachedv1.AddToScheme(scheme))
utilruntime.Must(rabbitmqclusterv1.AddToScheme(scheme))
utilruntime.Must(placementv1.AddToScheme(scheme))
utilruntime.Must(glancev1.AddToScheme(scheme))
Expand Down
Loading

0 comments on commit 7236c5f

Please sign in to comment.