Skip to content

Commit 41a4387

Browse files
committed
Merge branch 'master' into disableSecurityFeat
2 parents 2ad53de + 8422aa2 commit 41a4387

File tree

9 files changed

+53
-171
lines changed

9 files changed

+53
-171
lines changed

Jenkinsfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pipeline {
1515
OPERATOR_VERSION = getVersion()
1616
OPERATOR_CONTAINER_IMAGE_CANDIDATE_NAME = "${env.DOCKER_REGISTRY}/${DOCKER_ACCOUNT}/${env.OPERATOR_NAME}-nightly:${env.OPERATOR_VERSION}"
1717
OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME = "${env.DOCKER_REGISTRY}/${DOCKER_ACCOUNT}/${env.OPERATOR_NAME}-bundle-nightly:${env.OPERATOR_VERSION}"
18-
OPERATOR_CATALOG_IMAGE_CANDIDATE_NAME = "${env.DOCKER_REGISTRY}/${DOCKER_ACCOUNT}/${env.OPERATOR_NAME}-catalog-nightly:${env.OPERATOR_VERSION}"
1918

2019
// Variable names used in the operator make file.
2120
VERSION="${env.OPERATOR_VERSION}"
@@ -59,10 +58,9 @@ pipeline {
5958

6059
dir("${env.GO_REPO}") {
6160
// Changing directory again otherwise operator generates binary with the symlink name
62-
sh "cd ${GO_REPO} && make docker-buildx IMG=${OPERATOR_CONTAINER_IMAGE_CANDIDATE_NAME}"
63-
sh "cd ${GO_REPO} && make bundle IMG=${OPERATOR_CONTAINER_IMAGE_CANDIDATE_NAME}"
64-
sh "cd ${GO_REPO} && make bundle-build bundle-push BUNDLE_IMG=${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} IMG=${OPERATOR_CONTAINER_IMAGE_CANDIDATE_NAME}"
65-
sh "cd ${GO_REPO} && make docker-buildx-catalog CATALOG_IMG=${OPERATOR_CATALOG_IMAGE_CANDIDATE_NAME} IMG=${OPERATOR_CONTAINER_IMAGE_CANDIDATE_NAME}"
61+
sh "cd ${GO_REPO} && make docker-buildx"
62+
sh "cd ${GO_REPO} && make bundle"
63+
sh "cd ${GO_REPO} && make bundle-build bundle-push"
6664
}
6765
}
6866
}
@@ -161,7 +159,7 @@ pipeline {
161159
// Run all cluster-related test cases
162160
sh "rsync -aK ${env.WORKSPACE}/../../aerospike-kubernetes-operator-resources/secrets/ config/samples/secrets"
163161
sh "set +x; docker login --username AWS 568976754000.dkr.ecr.ap-south-1.amazonaws.com -p \$(aws ecr get-login-password --region ap-south-1); set -x"
164-
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -c ${OPERATOR_CATALOG_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t cluster-test"
162+
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t cluster-test"
165163

166164
}
167165
}
@@ -176,7 +174,7 @@ pipeline {
176174
// Run all backup-related test cases, including backup, backup-service, and restore test suites
177175
sh "rsync -aK ${env.WORKSPACE}/../../aerospike-kubernetes-operator-resources/secrets/ config/samples/secrets"
178176
sh "set +x; docker login --username AWS 568976754000.dkr.ecr.ap-south-1.amazonaws.com -p \$(aws ecr get-login-password --region ap-south-1); set -x"
179-
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -c ${OPERATOR_CATALOG_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t backup-test"
177+
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t backup-test"
180178

181179
}
182180
}
@@ -191,7 +189,7 @@ pipeline {
191189
// Run all-test cases
192190
sh "rsync -aK ${env.WORKSPACE}/../../aerospike-kubernetes-operator-resources/secrets/ config/samples/secrets"
193191
sh "set +x; docker login --username AWS 568976754000.dkr.ecr.ap-south-1.amazonaws.com -p \$(aws ecr get-login-password --region ap-south-1); set -x"
194-
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -c ${OPERATOR_CATALOG_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t all-test"
192+
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t all-test"
195193

196194
}
197195
}
@@ -208,11 +206,11 @@ pipeline {
208206
sh "set +x; docker login --username AWS 568976754000.dkr.ecr.ap-south-1.amazonaws.com -p \$(aws ecr get-login-password --region ap-south-1); set -x"
209207
if(env.RUN_SMOKE_TEST == 'true') {
210208
// Run smoke test
211-
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -c ${OPERATOR_CATALOG_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t cluster-test -f 'Sample files validation|UpdateAerospikeCluster'"
209+
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t cluster-test -f 'Sample files validation|UpdateAerospikeCluster'"
212210
}
213211
else if(env.RUN_SAMPLE_FILES_TEST == 'true') {
214212
// Run sample-files test cases
215-
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -c ${OPERATOR_CATALOG_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t cluster-test -f 'Sample files validation'"
213+
sh "./test/test.sh -b ${OPERATOR_BUNDLE_IMAGE_CANDIDATE_NAME} -r ${AEROSPIKE_CUSTOM_INIT_REGISTRY} -n ${AEROSPIKE_CUSTOM_INIT_REGISTRY_NAMESPACE} -i ${AEROSPIKE_CUSTOM_INIT_NAME_TAG} -t cluster-test -f 'Sample files validation'"
216214
}
217215
}
218216
}

README.md

Lines changed: 8 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ make bundle
114114
make bundle-build bundle-push
115115
```
116116

117-
### Build catalog image and publish
118-
119-
```shell
120-
make docker-buildx-catalog
121-
```
122-
123117
### Deploy operator with OLM
124118

125119
Install OLM if not already done
@@ -134,78 +128,19 @@ Create **aerospike** namespace if it does not exist
134128
kubectl create namespace aerospike
135129
```
136130

137-
### Deploy the operator using custom CatalogSource:
131+
### Deploy the operator targeting a single namespace
138132

139-
#### Deploy custom CatalogSource:
133+
Run the operator bundle
140134

141135
```shell
142-
kubectl apply -f - <<EOF
143-
apiVersion: operators.coreos.com/v1alpha1
144-
kind: CatalogSource
145-
metadata:
146-
name: aerospike
147-
namespace: aerospike
148-
spec:
149-
displayName: Aerospike operator
150-
publisher: Aerospike operator
151-
sourceType: grpc
152-
image: "${CATALOG_IMG}"
153-
updateStrategy:
154-
registryPoll:
155-
interval: 10m
156-
EOF
136+
operator-sdk run bundle $BUNDLE_IMG --namespace=aerospike
157137
```
158138

159-
#### Create Operator Group for the targeted namespaces:
160-
161-
- Targeting single namespace
162-
```shell
163-
kubectl apply -f - <<EOF
164-
apiVersion: operators.coreos.com/v1
165-
kind: OperatorGroup
166-
metadata:
167-
name: test-operator-group
168-
namespace: test
169-
spec:
170-
targetNamespaces:
171-
- aerospike
172-
upgradeStrategy: Default
173-
EOF
174-
```
175-
176-
- Targeting multiple namespaces
177-
Assuming you want the operator to target two other namespaces ns1 and ns2, create operator group with MultiNamespace install mode.
178-
```shell
179-
```shell
180-
kubectl apply -f - <<EOF
181-
apiVersion: operators.coreos.com/v1
182-
kind: OperatorGroup
183-
metadata:
184-
name: test-operator-group
185-
namespace: test
186-
spec:
187-
targetNamespaces:
188-
- ns1
189-
- ns2
190-
upgradeStrategy: Default
191-
EOF
192-
```
139+
### Deploy the operator targeting multiple namespaces
140+
Assuming you want the operator to target two other namespaces ns1 and ns2, deploy the operator with MultiNamespace install mode.
193141

194-
#### Create Subscription to deploy operator:
195142
```shell
196-
kubectl apply -f - <<EOF
197-
apiVersion: operators.coreos.com/v1alpha1
198-
kind: Subscription
199-
metadata:
200-
name: aerospike-kubernetes-operator
201-
namespace: test
202-
spec:
203-
channel: stable
204-
installPlanApproval: Automatic
205-
name: aerospike-kubernetes-operator
206-
source: aerospike
207-
sourceNamespace: aerospike
208-
EOF
143+
operator-sdk run bundle $BUNDLE_IMG --namespace=aerospike --install-mode MultiNamespace=ns1,ns2
209144
```
210145

211146
### Deploy your Aerospike clusters
@@ -239,13 +174,13 @@ The operator tests create and use 4 namespaces
239174
Run the entire test suite
240175

241176
```shell
242-
./test/test.sh -b $BUNDLE_IMG -c $CATALOG_IMG
177+
./test/test.sh -b $BUNDLE_IMG
243178
```
244179

245180
Run tests matching a regex
246181

247182
```shell
248-
./test/test.sh -b $BUNDLE_IMG -c $CATALOG_IMG '-ginkgo.focus=".*MultiCluster.*"'
183+
./test/test.sh -b $BUNDLE_IMG '-ginkgo.focus=".*MultiCluster.*"'
249184
```
250185

251186
## Architecture

test/cluster/cluster_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,8 @@ func ValidateAerospikeBenchmarkConfigs(ctx goctx.Context) {
236236

237237
By("Validating benchmarking is disabled")
238238

239-
aeroCluster, err := getCluster(k8sClient, ctx, clusterNamespacedName)
240-
Expect(err).ToNot(HaveOccurred())
241-
242-
pod := aeroCluster.Status.Pods["deploy-cluster-benchmark-0-0"]
243-
nsConfs, err := getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName, "namespaces", &pod)
239+
nsConfs, err := getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
240+
"namespaces", aeroCluster.Name+"-0-0")
244241
Expect(err).ToNot(HaveOccurred())
245242
Expect(nsConfs["test"].(lib.Stats)["enable-benchmarks-read"]).To(BeFalse())
246243

@@ -254,7 +251,8 @@ func ValidateAerospikeBenchmarkConfigs(ctx goctx.Context) {
254251
err = updateCluster(k8sClient, ctx, aeroCluster)
255252
Expect(err).ToNot(HaveOccurred())
256253

257-
nsConfs, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName, "namespaces", &pod)
254+
nsConfs, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
255+
"namespaces", aeroCluster.Name+"-0-0")
258256
Expect(err).ToNot(HaveOccurred())
259257
Expect(nsConfs["test"].(lib.Stats)["enable-benchmarks-read"]).To(BeTrue())
260258

@@ -266,7 +264,8 @@ func ValidateAerospikeBenchmarkConfigs(ctx goctx.Context) {
266264
err = updateCluster(k8sClient, ctx, aeroCluster)
267265
Expect(err).ToNot(HaveOccurred())
268266

269-
nsConfs, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName, "namespaces", &pod)
267+
nsConfs, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
268+
"namespaces", aeroCluster.Name+"-0-0")
270269
Expect(err).ToNot(HaveOccurred())
271270
Expect(nsConfs["test"].(lib.Stats)["enable-benchmarks-read"]).To(BeTrue())
272271

@@ -281,7 +280,8 @@ func ValidateAerospikeBenchmarkConfigs(ctx goctx.Context) {
281280
err = updateCluster(k8sClient, ctx, aeroCluster)
282281
Expect(err).ToNot(HaveOccurred())
283282

284-
nsConfs, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName, "namespaces", &pod)
283+
nsConfs, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
284+
"namespaces", aeroCluster.Name+"-0-0")
285285
Expect(err).ToNot(HaveOccurred())
286286
Expect(nsConfs["test"].(lib.Stats)["enable-benchmarks-read"]).To(BeFalse())
287287
},

test/cluster/dynamic_config_test.go

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,9 @@ var _ = Describe(
143143

144144
By("Fetch and verify dynamic configs")
145145

146-
pod := aeroCluster.Status.Pods[aeroCluster.Name+"-0-0"]
147-
148146
// Fetch and verify service section config
149147
conf, err := getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
150-
"service", &pod)
148+
"service", aeroCluster.Name+"-0-0")
151149
Expect(err).ToNot(HaveOccurred())
152150

153151
cv, ok := conf["proto-fd-max"]
@@ -157,7 +155,7 @@ var _ = Describe(
157155

158156
// Fetch and verify security section config
159157
conf, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
160-
"security", &pod)
158+
"security", aeroCluster.Name+"-0-0")
161159
Expect(err).ToNot(HaveOccurred())
162160

163161
reportDataOp, ok := conf["log.report-data-op[0]"].(string)
@@ -167,7 +165,7 @@ var _ = Describe(
167165

168166
// Fetch and verify xdr section config
169167
conf, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
170-
"xdr", &pod)
168+
"xdr", aeroCluster.Name+"-0-0")
171169
Expect(err).ToNot(HaveOccurred())
172170

173171
Expect(conf["dcs"]).To(HaveLen(2))
@@ -192,11 +190,9 @@ var _ = Describe(
192190

193191
By("Fetch and verify dynamic configs")
194192

195-
pod = aeroCluster.Status.Pods[aeroCluster.Name+"-0-0"]
196-
197193
// Fetch and verify service section config
198194
conf, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
199-
"service", &pod)
195+
"service", aeroCluster.Name+"-0-0")
200196
Expect(err).ToNot(HaveOccurred())
201197
cv, ok = conf["proto-fd-max"]
202198
Expect(ok).To(BeTrue())
@@ -205,15 +201,15 @@ var _ = Describe(
205201

206202
// Fetch and verify security section config
207203
conf, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
208-
"security", &pod)
204+
"security", aeroCluster.Name+"-0-0")
209205
Expect(err).ToNot(HaveOccurred())
210206

211207
_, ok = conf["log.report-data-op[0]"].(string)
212208
Expect(ok).ToNot(BeTrue())
213209

214210
// Fetch and verify xdr section config
215211
conf, err = getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
216-
"xdr", &pod)
212+
"xdr", aeroCluster.Name+"-0-0")
217213
Expect(err).ToNot(HaveOccurred())
218214

219215
Expect(conf["dcs"]).To(HaveLen(1))
@@ -244,10 +240,8 @@ var _ = Describe(
244240

245241
By("Fetch and verify static configs")
246242

247-
pod := aeroCluster.Status.Pods[aeroCluster.Name+"-0-0"]
248-
249243
conf, err := getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
250-
"security", &pod)
244+
"security", aeroCluster.Name+"-0-0")
251245
Expect(err).ToNot(HaveOccurred())
252246

253247
enableQuotas, ok := conf["enable-quotas"].(bool)
@@ -276,9 +270,8 @@ var _ = Describe(
276270

277271
By("Fetch and verify static configs")
278272

279-
pod = aeroCluster.Status.Pods[aeroCluster.Name+"-0-0"]
280-
281-
info, err := requestInfoFromNode(logger, k8sClient, ctx, clusterNamespacedName, "namespace/mem", &pod)
273+
info, err := requestInfoFromNode(logger, k8sClient, ctx, clusterNamespacedName,
274+
"namespace/mem", aeroCluster.Name+"-0-0")
282275
Expect(err).ToNot(HaveOccurred())
283276

284277
confs := strings.Split(info["namespace/mem"], ";")
@@ -316,10 +309,8 @@ var _ = Describe(
316309

317310
By("Fetch and verify static configs")
318311

319-
pod := aeroCluster.Status.Pods[aeroCluster.Name+"-0-0"]
320-
321312
conf, err := getAerospikeConfigFromNode(logger, k8sClient, ctx, clusterNamespacedName,
322-
"service", &pod)
313+
"service", aeroCluster.Name+"-0-0")
323314
Expect(err).ToNot(HaveOccurred())
324315

325316
cv, ok := conf["proto-fd-max"]
@@ -690,9 +681,8 @@ var _ = Describe(
690681

691682
By("Fetch and verify dynamic configs")
692683

693-
pod := aeroCluster.Status.Pods[aeroCluster.Name+"-1-0"]
694-
695-
info, err := requestInfoFromNode(logger, k8sClient, ctx, clusterNamespacedName, "namespace/test", &pod)
684+
info, err := requestInfoFromNode(logger, k8sClient, ctx, clusterNamespacedName,
685+
"namespace/test", aeroCluster.Name+"-1-0")
696686
Expect(err).ToNot(HaveOccurred())
697687

698688
confs := strings.Split(info["namespace/test"], ";")
@@ -703,7 +693,8 @@ var _ = Describe(
703693
}
704694
}
705695

706-
info, err = requestInfoFromNode(logger, k8sClient, ctx, clusterNamespacedName, "namespace/test1", &pod)
696+
info, err = requestInfoFromNode(logger, k8sClient, ctx, clusterNamespacedName,
697+
"namespace/test1", aeroCluster.Name+"-1-0")
707698
Expect(err).ToNot(HaveOccurred())
708699

709700
confs = strings.Split(info["namespace/test1"], ";")

test/cluster/rack_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func validateAerospikeConfigServiceUpdate(
9292
// TODO:
9393
// We may need to check for all keys in aerospikeConfig in rack
9494
// but we know that we are changing for service only for now
95-
svcConfs, err := getAerospikeConfigFromNode(log, k8sClient, ctx, clusterNamespacedName, "service", &pod)
95+
svcConfs, err := getAerospikeConfigFromNode(log, k8sClient, ctx, clusterNamespacedName, "service", podName)
9696
if err != nil {
9797
return err
9898
}

test/cluster/utils.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,13 +602,15 @@ func contains(elems []string, v string) bool {
602602
}
603603

604604
func getAerospikeConfigFromNode(log logr.Logger, k8sClient client.Client, ctx goctx.Context,
605-
clusterNamespacedName types.NamespacedName, configContext string, pod *asdbv1.AerospikePodStatus) (lib.Stats, error) {
605+
clusterNamespacedName types.NamespacedName, configContext, podName string) (lib.Stats, error) {
606606
aeroCluster, err := getCluster(k8sClient, ctx, clusterNamespacedName)
607607
if err != nil {
608608
return nil, err
609609
}
610610

611-
host, err := createHost(pod)
611+
pod := aeroCluster.Status.Pods[podName]
612+
613+
host, err := createHost(&pod)
612614
if err != nil {
613615
return nil, err
614616
}
@@ -626,13 +628,15 @@ func getAerospikeConfigFromNode(log logr.Logger, k8sClient client.Client, ctx go
626628
}
627629

628630
func requestInfoFromNode(log logr.Logger, k8sClient client.Client, ctx goctx.Context,
629-
clusterNamespacedName types.NamespacedName, cmd string, pod *asdbv1.AerospikePodStatus) (map[string]string, error) {
631+
clusterNamespacedName types.NamespacedName, cmd, podName string) (map[string]string, error) {
630632
aeroCluster, err := getCluster(k8sClient, ctx, clusterNamespacedName)
631633
if err != nil {
632634
return nil, err
633635
}
634636

635-
host, err := createHost(pod)
637+
pod := aeroCluster.Status.Pods[podName]
638+
639+
host, err := createHost(&pod)
636640
if err != nil {
637641
return nil, err
638642
}

0 commit comments

Comments
 (0)