-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add kuttl steps in manila-multibackend to validate share cleanup
This patch introduces an additional kuttl step to validate the share cleanup code that has been introduced. In particular, after scaling down share0, the current code patches the top-level manila CR and removes the entry, resulting in a cleanup of share0, that is not part of the deployment anymore. Signed-off-by: Francesco Pantano <[email protected]>
- Loading branch information
Showing
4 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
# Check for: | ||
# | ||
# - 1 manilaAPI | ||
# - 2 manilaScheduler | ||
# - 3 manilaShares | ||
# - 4 extraMounts | ||
|
||
apiVersion: manila.openstack.org/v1beta1 | ||
kind: Manila | ||
metadata: | ||
name: manila | ||
spec: | ||
customServiceConfig: | | ||
[DEFAULT] | ||
debug = true | ||
databaseInstance: openstack | ||
databaseAccount: manila | ||
manilaAPI: | ||
customServiceConfig: | | ||
[DEFAULT] | ||
enabled_share_protocols=nfs,cephfs,cifs | ||
replicas: 1 | ||
resources: {} | ||
manilaScheduler: | ||
customServiceConfig: '# add your customization here' | ||
replicas: 1 | ||
resources: {} | ||
manilaShares: | ||
share1: | ||
replicas: 1 | ||
customServiceConfig: | | ||
[DEFAULT] | ||
enabled_share_backends=cephfsnfs | ||
[cephfsnfs] | ||
driver_handles_share_servers=False | ||
share_backend_name=cephfs | ||
share_driver=manila.share.drivers.cephfs.driver.CephFSDriver | ||
cephfs_auth_id=openstack | ||
cephfs_cluster_name=ceph | ||
cephfs_nfs_cluster_id=cephfs | ||
cephfs_protocol_helper_type=NFS | ||
passwordSelectors: | ||
service: ManilaPassword | ||
preserveJobs: false | ||
rabbitMqClusterName: rabbitmq | ||
secret: osp-secret | ||
serviceUser: manila | ||
status: | ||
conditions: | ||
- message: Setup complete | ||
reason: Ready | ||
status: "True" | ||
type: Ready | ||
- message: CronJob completed | ||
reason: Ready | ||
status: "True" | ||
type: CronJobReady | ||
- message: DB create completed | ||
reason: Ready | ||
status: "True" | ||
type: DBReady | ||
- message: DBsync completed | ||
reason: Ready | ||
status: "True" | ||
type: DBSyncReady | ||
- message: Input data complete | ||
reason: Ready | ||
status: "True" | ||
type: InputReady | ||
- message: Setup complete | ||
reason: Ready | ||
status: "True" | ||
type: ManilaAPIReady | ||
- message: Setup complete | ||
reason: Ready | ||
status: "True" | ||
type: ManilaSchedulerReady | ||
- message: Deployment completed | ||
reason: Ready | ||
status: "True" | ||
type: ManilaShareReady | ||
- message: MariaDBAccount creation complete | ||
reason: Ready | ||
status: "True" | ||
type: MariaDBAccountReady | ||
- message: " Memcached instance has been provisioned" | ||
reason: Ready | ||
status: "True" | ||
type: MemcachedReady | ||
- message: NetworkAttachments completed | ||
reason: Ready | ||
status: "True" | ||
type: NetworkAttachmentsReady | ||
- message: RabbitMqTransportURL successfully created | ||
reason: Ready | ||
status: "True" | ||
type: RabbitMqTransportURLReady | ||
- message: RoleBinding created | ||
reason: Ready | ||
status: "True" | ||
type: RoleBindingReady | ||
- message: Role created | ||
reason: Ready | ||
status: "True" | ||
type: RoleReady | ||
- message: ServiceAccount created | ||
reason: Ready | ||
status: "True" | ||
type: ServiceAccountReady | ||
- message: Service config create completed | ||
reason: Ready | ||
status: "True" | ||
type: ServiceConfigReady | ||
databaseHostname: openstack.manila-kuttl-tests.svc | ||
manilaAPIReadyCount: 1 | ||
manilaSchedulerReadyCount: 1 | ||
manilaSharesReadyCounts: | ||
share1: 1 | ||
transportURLSecret: rabbitmq-transport-url-manila-manila-transport | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: manila-db-purge | ||
spec: | ||
jobTemplate: | ||
metadata: | ||
labels: | ||
service: manila | ||
spec: | ||
completions: 1 | ||
parallelism: 1 | ||
template: | ||
spec: | ||
containers: | ||
- args: | ||
- -c | ||
- /usr/bin/manila-manage --config-dir /etc/manila/manila.conf.d | ||
db purge 30 | ||
command: | ||
- /bin/bash | ||
name: manila-db-purge | ||
volumeMounts: | ||
- mountPath: /etc/manila/manila.conf.d | ||
name: db-purge-config-data | ||
readOnly: true | ||
serviceAccount: manila-manila | ||
serviceAccountName: manila-manila | ||
volumes: | ||
- name: db-purge-config-data | ||
secret: | ||
defaultMode: 420 | ||
items: | ||
- key: 00-config.conf | ||
path: 00-config.conf | ||
secretName: manila-config-data | ||
schedule: 1 0 * * * | ||
suspend: false | ||
--- | ||
apiVersion: manila.openstack.org/v1beta1 | ||
kind: ManilaShare | ||
metadata: | ||
name: manila-share-share1 | ||
spec: | ||
databaseAccount: manila | ||
passwordSelectors: | ||
service: ManilaPassword | ||
replicas: 1 | ||
resources: {} | ||
secret: osp-secret | ||
serviceAccount: manila-manila | ||
serviceUser: manila | ||
transportURLSecret: rabbitmq-transport-url-manila-manila-transport | ||
status: | ||
conditions: | ||
- message: Setup complete | ||
reason: Ready | ||
status: "True" | ||
type: Ready | ||
- message: Deployment completed | ||
reason: Ready | ||
status: "True" | ||
type: DeploymentReady | ||
- message: Input data complete | ||
reason: Ready | ||
status: "True" | ||
type: InputReady | ||
- message: NetworkAttachments completed | ||
reason: Ready | ||
status: "True" | ||
type: NetworkAttachmentsReady | ||
- message: Service config create completed | ||
reason: Ready | ||
status: "True" | ||
type: ServiceConfigReady | ||
- message: Input data complete | ||
reason: Ready | ||
status: "True" | ||
type: TLSInputReady | ||
readyCount: 1 | ||
--- | ||
# when using image digests the containerImage URLs are SHA's so we verify them with a script | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
commands: | ||
- script: | | ||
tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' | ||
imageTuples=$(oc get -n openstack-operators deployment manila-operator-controller-manager -o go-template="$tupleTemplate") | ||
# format of imageTuple is: RELATED_IMAGE_MANILA_<service>#<image URL with SHA> separated by newlines | ||
for ITEM in $(echo $imageTuples); do | ||
# it is an image | ||
if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then | ||
NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_MANILA_\([^_]*\)_.*|\1|') | ||
IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') | ||
template='{{.spec.containerImage}}' | ||
case $NAME in | ||
API) | ||
SERVICE_IMAGE=$(oc get -n $NAMESPACE manilaapi manila-api -o go-template="$template") | ||
;; | ||
SHARE) | ||
SERVICE_IMAGE=$(oc get -n $NAMESPACE manilashares manila-share-share1 -o go-template="$template") | ||
;; | ||
SCHEDULER) | ||
SERVICE_IMAGE=$(oc get -n $NAMESPACE manilascheduler manila-scheduler -o go-template="$template") | ||
;; | ||
esac | ||
if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then | ||
echo "$NAME image does not equal $VALUE" | ||
exit 1 | ||
fi | ||
fi | ||
done | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: | | ||
oc patch manila -n $NAMESPACE manila --type='json' -p='[{"op": "remove", "path": "/spec/manilaShares/share0"}]' |
File renamed without changes.
File renamed without changes.