From 9982fe403ee3d0e0e155260aefee0184ead301e2 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 21 Jun 2023 14:46:02 +0900 Subject: [PATCH 1/2] Enable memcached by default ... because memcached is globally used as caching backend. --- .../core.openstack.org_openstackcontrolplanes.yaml | 2 +- apis/core/v1beta1/openstackcontrolplane_types.go | 5 ++++- .../core.openstack.org_openstackcontrolplanes.yaml | 2 +- .../openstack-operator.clusterserviceversion.yaml | 11 +++++++++++ .../samples/core_v1beta1_openstackcontrolplane.yaml | 4 +++- ..._v1beta1_openstackcontrolplane_collapsed_cell.yaml | 4 +++- .../core_v1beta1_openstackcontrolplane_galera.yaml | 4 +++- ...1beta1_openstackcontrolplane_galera_3replicas.yaml | 4 +++- ...penstackcontrolplane_galera_network_isolation.yaml | 4 +++- ...beta1_openstackcontrolplane_network_isolation.yaml | 4 +++- ..._openstackcontrolplane_network_isolation_ceph.yaml | 4 +++- tests/kuttl/common/assert-sample-deployment.yaml | 4 +++- .../tests/collapsed/01-assert-collapsed-cell.yaml | 4 +++- .../galera-3replicas/01-assert-galera-3replicas.yaml | 4 +++- 14 files changed, 47 insertions(+), 13 deletions(-) diff --git a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml index 1ee9a0589..959175802 100644 --- a/apis/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/apis/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -5276,7 +5276,7 @@ spec: memcached: properties: enabled: - default: false + default: true type: boolean templates: additionalProperties: diff --git a/apis/core/v1beta1/openstackcontrolplane_types.go b/apis/core/v1beta1/openstackcontrolplane_types.go index 3a5447209..dfb77f506 100644 --- a/apis/core/v1beta1/openstackcontrolplane_types.go +++ b/apis/core/v1beta1/openstackcontrolplane_types.go @@ -108,6 +108,7 @@ type OpenStackControlPlaneSpec struct { Rabbitmq RabbitmqSection `json:"rabbitmq,omitempty"` // +kubebuilder:validation:Optional + //+operator-sdk:csv:customresourcedefinitions:type=spec // Memcached - Parameters related to the Memcached service Memcached MemcachedSection `json:"memcached,omitempty"` @@ -274,11 +275,13 @@ type RabbitmqSection struct { // MemcachedSection defines the desired state of Memcached services type MemcachedSection struct { // +kubebuilder:validation:Optional - // +kubebuilder:default=false + // +kubebuilder:default=true + // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} // Enabled - Whether Memcached services should be deployed and managed Enabled bool `json:"enabled"` // +kubebuilder:validation:Optional + //+operator-sdk:csv:customresourcedefinitions:type=spec // Templates - Overrides to use when creating the Memcached databases Templates map[string]memcachedv1.MemcachedSpec `json:"templates,omitempty"` } diff --git a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml index 1ee9a0589..959175802 100644 --- a/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml +++ b/config/crd/bases/core.openstack.org_openstackcontrolplanes.yaml @@ -5276,7 +5276,7 @@ spec: memcached: properties: enabled: - default: false + default: true type: boolean templates: additionalProperties: diff --git a/config/manifests/bases/openstack-operator.clusterserviceversion.yaml b/config/manifests/bases/openstack-operator.clusterserviceversion.yaml index b0a461d02..e3e1c4a16 100644 --- a/config/manifests/bases/openstack-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/openstack-operator.clusterserviceversion.yaml @@ -131,6 +131,17 @@ spec: - description: Templates - Overrides to use when creating the MariaDB databases displayName: Templates path: mariadb.templates + - description: Memcached - Parameters related to the Memcached service + displayName: Memcached + path: memcached + - description: Enabled - Whether Memcached services should be deployed and managed + displayName: Enabled + path: memcached.enabled + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:booleanSwitch + - description: Templates - Overrides to use when creating the Memcached databases + displayName: Templates + path: memcached.templates - description: Neutron - Overrides to use when creating the Neutron Service displayName: Neutron path: neutron diff --git a/config/samples/core_v1beta1_openstackcontrolplane.yaml b/config/samples/core_v1beta1_openstackcontrolplane.yaml index 5e59cb2e7..6395d71e3 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane.yaml @@ -42,7 +42,9 @@ spec: rabbitmq-cell1: replicas: 1 memcached: - enabled: true + templates: + memcached: + replicas: 1 placement: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml b/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml index e1dd8a0cc..9404d2aed 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_collapsed_cell.yaml @@ -24,7 +24,9 @@ spec: # cpu: 800m # memory: 1Gi memcached: - enabled: true + templates: + memcached: + replicas: 1 placement: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml index bcd4281c6..4b9df123c 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera.yaml @@ -43,7 +43,9 @@ spec: rabbitmq-cell1: replicas: 1 memcached: - enabled: true + templates: + memcached: + replicas: 1 placement: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml index 170d51aa7..2b1b54cf4 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_3replicas.yaml @@ -43,7 +43,9 @@ spec: rabbitmq-cell1: replicas: 1 memcached: - enabled: true + templates: + memcached: + replicas: 1 placement: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml index 1642ad5a4..d5f7f9f59 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_galera_network_isolation.yaml @@ -81,7 +81,9 @@ spec: secret: osp-secret replicas: 1 memcached: - enabled: true + templates: + memcached: + replicas: 1 neutron: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml index 20f9d9713..f3068c97f 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation.yaml @@ -67,7 +67,9 @@ spec: openstack-cell1: storageRequest: 500M memcached: - enabled: true + templates: + memcached: + replicas: 1 neutron: template: databaseInstance: openstack diff --git a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml index cf4742261..f1333ebcf 100644 --- a/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml +++ b/config/samples/core_v1beta1_openstackcontrolplane_network_isolation_ceph.yaml @@ -112,7 +112,9 @@ spec: openstack-cell1: storageRequest: 500M memcached: - enabled: true + templates: + memcached: + replicas: 1 neutron: template: databaseInstance: openstack diff --git a/tests/kuttl/common/assert-sample-deployment.yaml b/tests/kuttl/common/assert-sample-deployment.yaml index b6f425733..65bcf2eee 100644 --- a/tests/kuttl/common/assert-sample-deployment.yaml +++ b/tests/kuttl/common/assert-sample-deployment.yaml @@ -32,7 +32,9 @@ spec: rabbitmq-cell1: replicas: 1 memcached: - enabled: true + templates: + memcached: + replicas: 1 placement: template: databaseInstance: openstack diff --git a/tests/kuttl/tests/collapsed/01-assert-collapsed-cell.yaml b/tests/kuttl/tests/collapsed/01-assert-collapsed-cell.yaml index 3f9836ec6..745f6d251 100644 --- a/tests/kuttl/tests/collapsed/01-assert-collapsed-cell.yaml +++ b/tests/kuttl/tests/collapsed/01-assert-collapsed-cell.yaml @@ -20,7 +20,9 @@ spec: # cpu: 800m # memory: 1Gi memcached: - enabled: true + templates: + memcached: + replicas: 1 placement: template: databaseInstance: openstack diff --git a/tests/kuttl/tests/galera-3replicas/01-assert-galera-3replicas.yaml b/tests/kuttl/tests/galera-3replicas/01-assert-galera-3replicas.yaml index 24a17b762..48b82e5c4 100644 --- a/tests/kuttl/tests/galera-3replicas/01-assert-galera-3replicas.yaml +++ b/tests/kuttl/tests/galera-3replicas/01-assert-galera-3replicas.yaml @@ -40,7 +40,9 @@ spec: rabbitmq-cell1: replicas: 1 memcached: - enabled: true + templates: + memcached: + replicas: 1 placement: template: databaseInstance: openstack From 6da269d28603b66df6ff4c9b5266d51adfc6f040 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 28 Jun 2023 17:47:41 +0900 Subject: [PATCH 2/2] Require Memcached to deploy OpenStack services Memcached is required by all OpenStack services for caching. This ensures memcached is enabled in case any of OpenStack services are enabled. --- .../v1beta1/openstackcontrolplane_webhook.go | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/apis/core/v1beta1/openstackcontrolplane_webhook.go b/apis/core/v1beta1/openstackcontrolplane_webhook.go index d1b72fbc5..68dc9829f 100644 --- a/apis/core/v1beta1/openstackcontrolplane_webhook.go +++ b/apis/core/v1beta1/openstackcontrolplane_webhook.go @@ -111,41 +111,44 @@ func (r *OpenStackControlPlane) checkDepsEnabled(name string) string { switch name { case "Keystone": - if !(r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) { - reqs = "MariaDB or Galera" + if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled) { + reqs = "MariaDB or Galera, Memcached" } case "Glance": - if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Keystone.Enabled) { - reqs = "MariaDB or Galera, Keystone" + if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) { + reqs = "MariaDB or Galera, Memcached, Keystone" } case "Cinder": - if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Rabbitmq.Enabled && r.Spec.Keystone.Enabled) { - reqs = "MariaDB or Galera, Keystone, RabbitMQ" + if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled && + r.Spec.Keystone.Enabled) { + reqs = "MariaDB or Galera, Memcached, RabbitMQ, Keystone" } case "Placement": - if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Keystone.Enabled) { - reqs = "MariaDB or Galera, Keystone" + if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) { + reqs = "MariaDB or Galera, Memcached, Keystone" } case "Neutron": - if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Rabbitmq.Enabled && r.Spec.Keystone.Enabled) { - reqs = "MariaDB or Galera, Keystone, RabbitMQ" + if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled && + r.Spec.Keystone.Enabled) { + reqs = "MariaDB or Galera, RabbitMQ, Keystone" } case "Nova": - if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Rabbitmq.Enabled && r.Spec.Keystone.Enabled && - r.Spec.Placement.Enabled && r.Spec.Neutron.Enabled && r.Spec.Glance.Enabled) { - reqs = "MariaDB or Galera, Glance, Keystone, Neutron, Placement, RabbitMQ" + if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled && + r.Spec.Keystone.Enabled && r.Spec.Placement.Enabled && r.Spec.Neutron.Enabled && r.Spec.Glance.Enabled) { + reqs = "MariaDB or Galera, Memcached, RabbitMQ, Keystone, Glance Neutron, Placement" } case "Heat": - if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Rabbitmq.Enabled && r.Spec.Keystone.Enabled) { - reqs = "MariaDB or Galera, Keystone, RabbitMQ" + if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Rabbitmq.Enabled && + r.Spec.Keystone.Enabled) { + reqs = "MariaDB or Galera, Memcached, RabbitMQ, Keystone" } case "Swift": - if !(r.Spec.Keystone.Enabled) { - reqs = "Keystone" + if !(r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) { + reqs = "Memcached, Keystone" } case "Horizon": - if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Keystone.Enabled) { - reqs = "MariaDB or Galera, Keystone" + if !((r.Spec.Mariadb.Enabled || r.Spec.Galera.Enabled) && r.Spec.Memcached.Enabled && r.Spec.Keystone.Enabled) { + reqs = "MariaDB or Galera, Memcached, Keystone" } }