Skip to content

Commit f57b3a5

Browse files
Merge pull request #551 from lmiccini/drop_clusterop_squashed
Drop rabbitmq-cluster-operator dependency and manage RabbitMQ directly
2 parents e06fc1a + e4e3813 commit f57b3a5

190 files changed

Lines changed: 12601 additions & 1607 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ go.work.sum
4545
.coverage
4646
__pycache__/
4747
*.pyc
48+
49+
# claude and AI tools
50+
.claude
51+
CLAUDE.md

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,18 @@ tidy: ## Run go mod tidy on every mod file in the repo
121121
PROCS?=$(shell expr $(shell nproc --ignore 2) / 2)
122122
PROC_CMD = --procs ${PROCS}
123123

124+
# Skip instanceha tests if --focus or --skip is used (focused test run)
125+
ifeq (,$(findstring --focus,$(GINKGO_ARGS))$(findstring --skip,$(GINKGO_ARGS)))
126+
INSTANCEHA_DEP = test-instanceha
127+
else
128+
INSTANCEHA_DEP =
129+
endif
130+
124131
.PHONY: test
125-
test: manifests generate gowork fmt vet envtest ginkgo test-instanceha ## Run tests.
132+
test: manifests generate gowork fmt vet envtest ginkgo $(INSTANCEHA_DEP) ## Run tests.
126133
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) -v debug --bin-dir $(LOCALBIN) use $(ENVTEST_K8S_VERSION) -p path)" \
127134
OPERATOR_TEMPLATES="$(PWD)/templates" \
128-
$(GINKGO) --trace --cover --coverpkg=./pkg/...,./internal/...,./apis/network/v1beta1/...,./apis/rabbitmq/v1beta1/... --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./test/... ./apis/network/... ./apis/rabbitmq/... ./internal/webhook/...
135+
$(GINKGO) --trace --cover --coverpkg=./pkg/...,./internal/...,./apis/network/v1beta1/...,./apis/rabbitmq/v1beta1/... --coverprofile cover.out --covermode=atomic ${PROC_CMD} $(GINKGO_ARGS) ./test/... ./apis/network/... ./apis/rabbitmq/... ./internal/webhook/... ./internal/controller/...
129136

130137
.PHONY: test-instanceha
131138
test-instanceha: ## Run instanceha tests.

apis/bases/rabbitmq.openstack.org_rabbitmqs.yaml

Lines changed: 164 additions & 63 deletions
Large diffs are not rendered by default.

apis/go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ require (
66
github.com/go-logr/logr v1.4.3
77
github.com/onsi/gomega v1.39.1
88
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260331122750-ecff41ebb61d
9-
github.com/rabbitmq/cluster-operator/v2 v2.16.0
109
k8s.io/api v0.31.14
1110
k8s.io/apiextensions-apiserver v0.33.2
1211
k8s.io/apimachinery v0.31.14
@@ -19,6 +18,7 @@ require (
1918
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2019
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2120
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
21+
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
2222
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2323
github.com/fsnotify/fsnotify v1.9.0 // indirect
2424
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -90,9 +90,6 @@ replace k8s.io/code-generator => k8s.io/code-generator v0.31.14 //allow-merging
9090

9191
replace k8s.io/component-base => k8s.io/component-base v0.31.14 //allow-merging
9292

93-
// custom RabbitmqClusterSpecCore for OpenStackControlplane (v2.16.0_patches)
94-
replace github.com/rabbitmq/cluster-operator/v2 => github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec //allow-merging
95-
9693
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20250627150254-e9823e99808e //allow-merging
9794

9895
replace github.com/cert-manager/cmctl/v2 => github.com/cert-manager/cmctl/v2 v2.1.2-0.20241127223932-88edb96860cf //allow-merging

apis/go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
21
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
32
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
43
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ -86,8 +85,6 @@ github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyU
8685
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
8786
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260331122750-ecff41ebb61d h1:qbH09BzypLy1+N133JVgfkRmDZaQKpDLwi/InqqOzGM=
8887
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260331122750-ecff41ebb61d/go.mod h1:XUUV+h1nZC4kra5oF+cXPkviWYJ3ELhccHxnVO7CvQQ=
89-
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec h1:saovr368HPAKHN0aRPh8h8n9s9dn3d8Frmfua0UYRlc=
90-
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec/go.mod h1:Nh2NEePLjovUQof2krTAg4JaAoLacqtPTZQXK6izNfg=
9188
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
9289
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
9390
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

apis/rabbitmq/v1beta1/conditions.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ import (
1919
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2020
)
2121

22+
// RabbitMQ Condition Types used by API objects.
23+
const (
24+
// RabbitMQProxyActiveCondition indicates that the AMQP proxy sidecar is running.
25+
// Status=True means the proxy is active and must be cleared by setting the
26+
// clients-reconfigured annotation. Status=False means no proxy is running.
27+
RabbitMQProxyActiveCondition condition.Type = "RabbitMQProxyActive"
28+
)
29+
2230
// TransportURL Condition Types used by API objects.
2331
const (
2432
// TransportURLReadyCondition Status=True condition which indicates if TransportURL is configured and operational
@@ -39,6 +47,17 @@ const ()
3947

4048
// Common Messages used by API objects.
4149
const (
50+
//
51+
// RabbitMQProxyActive condition messages
52+
//
53+
54+
// RabbitMQProxyActiveMessage is the message when the proxy is active
55+
RabbitMQProxyActiveMessage = "AMQP proxy sidecar is active for queue migration. " +
56+
"To remove it, set annotation '%s: \"true\"' on the RabbitMq CR after all clients have been reconfigured for quorum queues"
57+
58+
// RabbitMQProxyInactiveMessage is the message when the proxy is not active
59+
RabbitMQProxyInactiveMessage = "AMQP proxy sidecar is not active"
60+
4261
//
4362
// TransportURLReady condition messages
4463
//
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
/*
2+
Licensed under the Apache License, Version 2.0 (the "License");
3+
you may not use this file except in compliance with the License.
4+
You may obtain a copy of the License at
5+
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
*/
14+
15+
package v1beta1
16+
17+
// DEPRECATED TYPES
18+
// These types are local mirrors of the old rabbitmq-cluster-operator types,
19+
// kept only for backward compatibility with existing CRs during migration.
20+
// They will be removed in a future release once all CRs have been migrated
21+
// to use the new explicit fields in RabbitMqSpecCore.
22+
23+
import (
24+
appsv1 "k8s.io/api/apps/v1"
25+
corev1 "k8s.io/api/core/v1"
26+
"k8s.io/apimachinery/pkg/api/resource"
27+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28+
)
29+
30+
// DeprecatedEmbeddedLabelsAnnotations is an embedded subset of the fields included in
31+
// k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta. Only labels and annotations are included.
32+
type DeprecatedEmbeddedLabelsAnnotations struct {
33+
// Map of string keys and values that can be used to organize and categorize (scope and select) objects.
34+
// +optional
35+
Labels map[string]string `json:"labels,omitempty"`
36+
// Annotations is an unstructured key value map stored with a resource.
37+
// +optional
38+
Annotations map[string]string `json:"annotations,omitempty"`
39+
}
40+
41+
// DeprecatedStatefulSetOverride mirrors the old rabbitmq-cluster-operator StatefulSet type.
42+
// Used for webhook validation of the override.statefulSet JSON field.
43+
type DeprecatedStatefulSetOverride struct {
44+
// +optional
45+
*DeprecatedEmbeddedLabelsAnnotations `json:"metadata,omitempty"`
46+
// +optional
47+
Spec *DeprecatedStatefulSetSpec `json:"spec,omitempty"`
48+
}
49+
50+
// DeprecatedStatefulSetSpec mirrors a subset of the old rabbitmq-cluster-operator StatefulSetSpec type.
51+
type DeprecatedStatefulSetSpec struct {
52+
// +optional
53+
Replicas *int32 `json:"replicas,omitempty"`
54+
// +optional
55+
Selector *metav1.LabelSelector `json:"selector,omitempty"`
56+
// +optional
57+
Template *DeprecatedPodTemplateSpec `json:"template,omitempty"`
58+
// +optional
59+
VolumeClaimTemplates []corev1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`
60+
// +optional
61+
ServiceName string `json:"serviceName,omitempty"`
62+
// +optional
63+
PodManagementPolicy appsv1.PodManagementPolicyType `json:"podManagementPolicy,omitempty"`
64+
// +optional
65+
UpdateStrategy *appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`
66+
// +optional
67+
MinReadySeconds int32 `json:"minReadySeconds,omitempty"`
68+
// +optional
69+
PersistentVolumeClaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
70+
}
71+
72+
// DeprecatedPodTemplateSpec mirrors the old rabbitmq-cluster-operator PodTemplateSpec type.
73+
type DeprecatedPodTemplateSpec struct {
74+
// +optional
75+
*DeprecatedEmbeddedObjectMeta `json:"metadata,omitempty"`
76+
// +optional
77+
Spec *corev1.PodSpec `json:"spec,omitempty"`
78+
}
79+
80+
// DeprecatedEmbeddedObjectMeta mirrors the old rabbitmq-cluster-operator EmbeddedObjectMeta type.
81+
type DeprecatedEmbeddedObjectMeta struct {
82+
// +optional
83+
Name string `json:"name,omitempty"`
84+
// +optional
85+
Namespace string `json:"namespace,omitempty"`
86+
// +optional
87+
Labels map[string]string `json:"labels,omitempty"`
88+
// +optional
89+
Annotations map[string]string `json:"annotations,omitempty"`
90+
}
91+
92+
// DeprecatedRabbitMQServiceSpec mirrors the old top-level service configuration.
93+
// DEPRECATED: Use Override.Service instead.
94+
type DeprecatedRabbitMQServiceSpec struct {
95+
// +kubebuilder:default:="ClusterIP"
96+
// +kubebuilder:validation:Enum=ClusterIP;LoadBalancer;NodePort
97+
// Type of Service to create for the cluster. Must be one of: ClusterIP, LoadBalancer, NodePort.
98+
// For more info see https://pkg.go.dev/k8s.io/api/core/v1#ServiceType
99+
// +optional
100+
Type corev1.ServiceType `json:"type,omitempty"`
101+
// Annotations to add to the Service.
102+
// +optional
103+
Annotations map[string]string `json:"annotations,omitempty"`
104+
// +optional
105+
Labels map[string]string `json:"labels,omitempty"`
106+
// +kubebuilder:validation:Enum=SingleStack;PreferDualStack;RequireDualStack
107+
// IPFamilyPolicy represents the dual-stack-ness requested or required by a Service
108+
// See also: https://pkg.go.dev/k8s.io/api/core/v1#IPFamilyPolicy
109+
// +optional
110+
IPFamilyPolicy *corev1.IPFamilyPolicy `json:"ipFamilyPolicy,omitempty"`
111+
}
112+
113+
// DeprecatedPersistenceSpec mirrors the old rabbitmq-cluster-operator RabbitmqClusterPersistenceSpec type.
114+
type DeprecatedPersistenceSpec struct {
115+
// The name of the StorageClass to claim a PersistentVolume from.
116+
StorageClassName *string `json:"storageClassName,omitempty"`
117+
// The requested size of the persistent volume attached to each Pod in the RabbitmqCluster.
118+
// The format of this field matches that defined by kubernetes/apimachinery.
119+
// See https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity for more info on the format of this field.
120+
// +kubebuilder:default:="10Gi"
121+
Storage *resource.Quantity `json:"storage,omitempty"`
122+
}
123+
124+
// DeprecatedRabbitmqConfigSpec mirrors the old rabbitmq-cluster-operator RabbitmqClusterConfigurationSpec type.
125+
type DeprecatedRabbitmqConfigSpec struct {
126+
// List of plugins to enable in addition to essential plugins: rabbitmq_management,
127+
// rabbitmq_prometheus, and rabbitmq_peer_discovery_k8s.
128+
// +optional
129+
// +kubebuilder:validation:MaxItems=100
130+
AdditionalPlugins []RabbitMQPlugin `json:"additionalPlugins,omitempty"`
131+
// Modify to add to the rabbitmq.conf file in addition to default configurations set by the operator.
132+
// Modifying this property on an existing RabbitmqCluster will trigger a StatefulSet rolling restart
133+
// and will cause rabbitmq downtime.
134+
// For more information on this config, see https://www.rabbitmq.com/configure.html#config-file
135+
// +optional
136+
// +kubebuilder:validation:MaxLength=100000
137+
AdditionalConfig string `json:"additionalConfig,omitempty"`
138+
// Specify any rabbitmq advanced.config configurations to apply to the cluster.
139+
// For more information on advanced config, see https://www.rabbitmq.com/configure.html#advanced-config-file
140+
// +optional
141+
// +kubebuilder:validation:MaxLength=100000
142+
AdvancedConfig string `json:"advancedConfig,omitempty"`
143+
// Modify to add to the rabbitmq-env.conf file. Modifying this property on an existing
144+
// RabbitmqCluster will trigger a StatefulSet rolling restart and will cause rabbitmq downtime.
145+
// For more information on env config, see https://www.rabbitmq.com/man/rabbitmq-env.conf.5.html
146+
// +optional
147+
// +kubebuilder:validation:MaxLength=100000
148+
EnvConfig string `json:"envConfig,omitempty"`
149+
// Erlang Inet configuration to apply to the Erlang VM running rabbit.
150+
// See also: https://www.erlang.org/doc/apps/erts/inet_cfg.html
151+
// +optional
152+
// +kubebuilder:validation:MaxLength=2000
153+
ErlangInetConfig string `json:"erlangInetConfig,omitempty"`
154+
}
155+
156+
// DeprecatedSecretBackendSpec mirrors the old rabbitmq-cluster-operator SecretBackend type.
157+
type DeprecatedSecretBackendSpec struct {
158+
// +optional
159+
ExternalSecret *corev1.LocalObjectReference `json:"externalSecret,omitempty"`
160+
// +optional
161+
Vault *DeprecatedVaultSpec `json:"vault,omitempty"`
162+
}
163+
164+
// DeprecatedVaultSpec mirrors the old rabbitmq-cluster-operator VaultSpec type.
165+
// VaultSpec will add Vault annotations (see https://www.vaultproject.io/docs/platform/k8s/injector/annotations)
166+
// to RabbitMQ Pods. It requires a Vault Agent Sidecar Injector
167+
// (https://www.vaultproject.io/docs/platform/k8s/injector) to be installed in the K8s cluster.
168+
type DeprecatedVaultSpec struct {
169+
// Role in Vault.
170+
// If vault.defaultUserPath is set, this role must have capability to read the pre-created default user
171+
// credential in Vault.
172+
// If vault.tls is set, this role must have capability to create and update certificates in the Vault PKI
173+
// engine for the domains "<namespace>" and "<namespace>.svc".
174+
// +optional
175+
Role string `json:"role,omitempty"`
176+
// Vault annotations that override the Vault annotations set by the cluster-operator.
177+
// For a list of valid Vault annotations, see
178+
// https://www.vaultproject.io/docs/platform/k8s/injector/annotations
179+
// +optional
180+
Annotations map[string]string `json:"annotations,omitempty"`
181+
// Path in Vault to access a KV (Key-Value) secret with the fields username and password
182+
// for the default user. For example "secret/data/rabbitmq/config".
183+
// +optional
184+
DefaultUserPath string `json:"defaultUserPath,omitempty"`
185+
// Sidecar container that updates the default user's password in RabbitMQ when it changes in Vault.
186+
// Additionally, it updates /var/lib/rabbitmq/.rabbitmqadmin.conf (used by rabbitmqadmin CLI).
187+
// Set to empty string to disable the sidecar container.
188+
// +optional
189+
DefaultUserUpdaterImage string `json:"defaultUserUpdaterImage,omitempty"`
190+
// +optional
191+
TLS *DeprecatedVaultTLSSpec `json:"tls,omitempty"`
192+
}
193+
194+
// DeprecatedVaultTLSSpec mirrors the old rabbitmq-cluster-operator VaultSpec TLS fields.
195+
type DeprecatedVaultTLSSpec struct {
196+
// Path in Vault PKI engine. For example "pki/issue/hashicorp-com". Required.
197+
// +optional
198+
PkiIssuerPath string `json:"pkiIssuerPath,omitempty"`
199+
// Specifies an optional path to retrieve the root CA from vault.
200+
// Useful if certificates are issued by an intermediate CA.
201+
// +optional
202+
PkiRootPath string `json:"pkiRootPath,omitempty"`
203+
// Specifies the requested Subject Alternative Names (SANs), in a comma-delimited list.
204+
// These will be appended to the SANs added by the cluster-operator.
205+
// +optional
206+
AltNames string `json:"altNames,omitempty"`
207+
// Specifies the requested certificate Common Name (CN).
208+
// Defaults to <serviceName>.<namespace>.svc if not provided.
209+
// +optional
210+
CommonName string `json:"commonName,omitempty"`
211+
// Specifies the requested IP Subject Alternative Names, in a comma-delimited list.
212+
// +optional
213+
IpSans string `json:"ipSans,omitempty"`
214+
}

0 commit comments

Comments
 (0)