Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh Recipe by removing setup tenant job #2311

Open
wants to merge 4 commits into
base: scripts-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions velero/backup/common-service/env.properties
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Change the following values to match your environment
OPERATOR_NS="" # Pass the namespace where the cs operator is installed
OPERATOR_NS="test-br" # Pass the namespace where the cs operator is installed

# Pass the namespace where the cs services are installed
# Leave it as empty string if the services are installed in the same namespace as the operator
SERVICES_NS=""
SERVICES_NS="test-br"
CONTROL_NS="" # Pass the control namespace if it is needed to be backed up

#Pass any additional namespaces in the tenant that are not the operator or services namespace. Comma delimited
TETHERED_NS=""
TETHERED_NS="tenant1,tenant2"

# Change to the namespace where cert-manager, licensing and LSR are installed
CERT_MANAGER_NAMESPACE="ibm-cert-manager"
Expand Down
7 changes: 4 additions & 3 deletions velero/backup/common-service/label-common-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,16 @@ function label_cs(){
function label_nss(){
title "Label Namespacescope resources"
local nss_pm="ibm-namespace-scope-operator"
${OC} label subscriptions.operators.coreos.com $nss_pm foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2>/dev/null
# Using the same label as common service operator has for both sub and crd
${OC} label subscriptions.operators.coreos.com $nss_pm foundationservices.cloudpak.ibm.com=subscription -n $OPERATOR_NS --overwrite=true 2>/dev/null
${OC} label customresourcedefinition namespacescopes.operator.ibm.com foundationservices.cloudpak.ibm.com=crd --overwrite=true 2>/dev/null
# The following resources are labeled with 'nss' are bundled together for backup
${OC} label namespacescopes.operator.ibm.com common-service foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2>/dev/null
${OC} label customresourcedefinition namespacescopes.operator.ibm.com foundationservices.cloudpak.ibm.com=nss --overwrite=true 2>/dev/null
${OC} label serviceaccount ibm-namespace-scope-operator foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2>/dev/null
${OC} label role nss-managed-role-from-$OPERATOR_NS foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2>/dev/null
${OC} label role nss-managed-role-from-$OPERATOR_NS foundationservices.cloudpak.ibm.com=nss -n $SERVICES_NS --overwrite=true 2>/dev/null
${OC} label rolebinding nss-managed-role-from-$OPERATOR_NS foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2>/dev/null
${OC} label rolebinding nss-managed-role-from-$OPERATOR_NS foundationservices.cloudpak.ibm.com=nss -n $SERVICES_NS --overwrite=true 2>/dev/null
${OC} label configmap namespace-scope foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2>/dev/null
if [[ $TETHERED_NS != "" ]]; then
for namespace in ${TETHERED_NS//,/ }
do
Expand Down
108 changes: 21 additions & 87 deletions velero/spectrum-fusion/recipes/4.0-4.5-example-recipe-multi-ns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,45 +93,20 @@ spec:
includedResourceTypes:
- customresourcedefinitions.apiextensions.k8s.io
labelSelector: foundationservices.cloudpak.ibm.com=crd
name: commonservice-crd
type: resource
- includeClusterResources: true
includedResourceTypes:
- deployments
- roles
- serviceaccounts
- rolebindings
- configmaps
labelSelector: foundationservices.cloudpak.ibm.com=cpfs-util-backup
name: setup-tenant-resources
type: resource
- includeClusterResources: true
includedResourceTypes:
- jobs
labelSelector: foundationservices.cloudpak.ibm.com=setup-tenant-job
name: setup-tenant-job-yaml
restoreStatus:
excludedResources:
- jobs
type: resource
- labelSelector: foundationservices.cloudpak.ibm.com=cpfs-util-backup
name: cpfs-util-volume
type: volume
- includeClusterResources: true
includedResourceTypes:
- customresourcedefinitions.apiextensions.k8s.io
labelSelector: foundationservices.cloudpak.ibm.com=crd
name: nss-crd
name: commonservices-crd
type: resource
- includedResourceTypes:
- commonservices.operator.ibm.com
labelSelector: foundationservices.cloudpak.ibm.com=commonservice
name: commonservice-cr
type: resource
- includedResourceTypes:
- roles
- rolebindings
- serviceaccounts
- namespacescopes.operator.ibm.com
labelSelector: foundationservices.cloudpak.ibm.com=nss
name: nss-cr
name: nss-resources
type: resource
- includedResourceTypes:
- operandrequests.operator.ibm.com
Expand Down Expand Up @@ -215,24 +190,24 @@ spec:
timeout: 600
type: check
- chks:
- condition: '{$.status.phase} == {"Running"}'
- condition: '{$.spec.replicas} == {$.status.readyReplicas}'
name: podReady
onError: fail
timeout: 1200
labelSelector: app.kubernetes.io/name=operand-deployment-lifecycle-manager
name: odlm-check
timeout: 600
name: nss-check
nameSelector: ibm-namespace-scope-operator
namespace: <operator namespace>
onError: fail
selectResource: pod
timeout: 1200
selectResource: deployment
timeout: 600
type: check
- chks:
- condition: '{$.status.phase} == {"Running"}'
name: podReady
onError: fail
timeout: 600
labelSelector: foundationservices.cloudpak.ibm.com=cpfs-util-backup
name: setup-tenant-check
labelSelector: app.kubernetes.io/name=operand-deployment-lifecycle-manager
name: odlm-check
namespace: <operator namespace>
onError: fail
selectResource: pod
Expand Down Expand Up @@ -286,42 +261,6 @@ spec:
selectResource: zen.cpd.ibm.com/v1/zenservice
timeout: 1800
type: check
- labelSelector: foundationservices.cloudpak.ibm.com=cpfs-util-backup
name: setup-tenant
namespace: <operator namespace>
onError: fail
ops:
- command: |
["/bin/bash", "-c", "/cs-br/setup_tenant.sh --operator-namespace <operator namespace> --services-namespace <service namespace> --tethered-namespaces <comma delimited (no spaces) list of Cloud Pak workload namespaces that use this foundational services instance> --license-accept -c v<foundational services version number in use i.e. 4.0, 4.1, 4.2, etc> -p <.spec.size value from commonservice cr> -i <install mode, either Manual or Automatic> -s <catalog source name> -n <catalog source namespace> -v"]
container: cpfs-util
name: setup-tenant-command
timeout: 600
selectResource: pod
type: exec
- labelSelector: foundationservices.cloudpak.ibm.com=cpfs-util-backup
name: setup-tenant-job
namespace: <operator namespace>
onError: fail
ops:
- command: |
["/bin/bash", "-c", "oc patch job setup-tenant-job -n <operator namespace> --type=\"json\" -p '[{\"op\": \"remove\", \"path\":\"/spec/suspend\"}]'"]
container: cpfs-util
name: trigger-setup-tenant-job
timeout: 600
selectResource: pod
type: exec
- chks:
- condition: '{$.status.phase} == {"Succeeded"}'
name: jobComplete
onError: fail
timeout: 600
labelSelector: foundationservices.cloudpak.ibm.com=setup-tenant-job
name: setup-tenant-job-check
namespace: <operator namespace>
onError: fail
selectResource: pod
timeout: 600
type: check
- chks:
- condition: '{$.spec.replicas} == {$.status.readyReplicas}'
name: podReady
Expand Down Expand Up @@ -424,19 +363,17 @@ spec:
- group: mongo-volume
- group: mongo-deployment
- hook: zen5-data/backup
- group: cpfs-util-volume
- group: zen
- group: zen-br-resources
- group: common-services-namespace
- group: pull-secret
- group: common-services-catalogs
- group: common-services-operatorgroups
- group: common-services-configmaps
- group: commonservice-crd
- group: commonservices-crd
- group: commonservice-cr
- group: nss-resources
- group: cs-operator-permissions
- group: setup-tenant-resources
- group: setup-tenant-job-yaml
- group: singleton-subscriptions
- group: cert-manager-resources
- group: common-services-subscriptions
Expand All @@ -453,22 +390,19 @@ spec:
- group: ow-pull-secret
- group: common-services-catalogs
- group: common-services-operatorgroups
- group: common-services-configmaps
- group: commonservice-crd
- group: cert-manager-crd
- group: singleton-subscriptions
- group: commonservice-cr
- hook: cert-manager-operator-check/podReady
- hook: cert-manager-webhook-check/podReady
- group: cert-manager-workload-resources
- group: licensing-resources
# restore common services
- group: common-services-configmaps
- group: commonservices-crd
- group: commonservice-cr
- group: nss-resources
- group: common-services-subscriptions
- group: cpfs-util-volume
- group: setup-tenant-resources
- group: setup-tenant-job-yaml
- hook: setup-tenant-check/podReady
- hook: setup-tenant-job/trigger-setup-tenant-job
- hook: setup-tenant-job-check/jobComplete
- hook: nss-check/podReady
- hook: odlm-check/podReady
- group: odlm-resources
- group: operand-resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,11 @@ spec:
labelSelector: foundationservices.cloudpak.ibm.com=crd
name: commonservice-crd
type: resource
- includeClusterResources: true
includedResourceTypes:
- customresourcedefinitions.apiextensions.k8s.io
labelSelector: foundationservices.cloudpak.ibm.com=crd
name: nss-crd
type: resource
- includedResourceTypes:
- commonservices.operator.ibm.com
labelSelector: foundationservices.cloudpak.ibm.com=commonservice
name: commonservice-cr
type: resource
- includedResourceTypes:
- namespacescopes.operator.ibm.com
labelSelector: foundationservices.cloudpak.ibm.com=nss
name: nss-cr
type: resource
- includedResourceTypes:
- operandrequests.operator.ibm.com
labelSelector: foundationservices.cloudpak.ibm.com=operand
Expand Down Expand Up @@ -177,13 +166,13 @@ spec:
- condition: '{$.status.phase} == {"Running"}'
name: podReady
onError: fail
timeout: 1200
timeout: 600
labelSelector: app.kubernetes.io/name=operand-deployment-lifecycle-manager
name: odlm-check
namespace: <operator namespace>
onError: fail
selectResource: pod
timeout: 1200
timeout: 600
type: check
- chks:
- condition: '{$.status.phase} == {"Running"}'
Expand Down
Loading