fix jobs to create a secret can work on upgrade
This PS fixes the jobs falling into a crash loop state when upgrading charts. 'kubectl create' command cannot overwrite if a secret already exists. But 'kubectl apply' command can do it. Change-Id: Idd6eea06892a30e36e51a9b1130fd7cd84ff65cf
This commit is contained in:
parent
db2276055e
commit
717d72485b
@ -47,7 +47,7 @@ type: Opaque
|
|||||||
data:
|
data:
|
||||||
${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} )
|
${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} )
|
||||||
EOF
|
EOF
|
||||||
} | kubectl create --namespace ${DEPLOYMENT_NAMESPACE} -f -
|
} | kubectl apply --namespace ${DEPLOYMENT_NAMESPACE} -f -
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ type: Opaque
|
|||||||
data:
|
data:
|
||||||
${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} )
|
${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} )
|
||||||
EOF
|
EOF
|
||||||
} | kubectl create --namespace ${DEPLOYMENT_NAMESPACE} -f -
|
} | kubectl apply --namespace ${DEPLOYMENT_NAMESPACE} -f -
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
#create_kube_key <ceph_key> <ceph_keyring_name> <ceph_keyring_template> <kube_secret_name>
|
#create_kube_key <ceph_key> <ceph_keyring_name> <ceph_keyring_template> <kube_secret_name>
|
||||||
@ -71,7 +71,7 @@ type: kubernetes.io/rbd
|
|||||||
data:
|
data:
|
||||||
key: $( echo ${CEPH_KEYRING} | base64 | tr -d '\n' )
|
key: $( echo ${CEPH_KEYRING} | base64 | tr -d '\n' )
|
||||||
EOF
|
EOF
|
||||||
} | kubectl create --namespace ${DEPLOYMENT_NAMESPACE} -f -
|
} | kubectl apply --namespace ${DEPLOYMENT_NAMESPACE} -f -
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
#create_kube_storage_key <ceph_key> <kube_secret_name>
|
#create_kube_storage_key <ceph_key> <kube_secret_name>
|
||||||
|
@ -37,7 +37,7 @@ type: "${secret_type}"
|
|||||||
data:
|
data:
|
||||||
key: $( echo ${ceph_key} )
|
key: $( echo ${ceph_key} )
|
||||||
EOF
|
EOF
|
||||||
} | kubectl create --namespace ${kube_namespace} -f -
|
} | kubectl apply --namespace ${kube_namespace} -f -
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! kubectl get --namespace ${DEPLOYMENT_NAMESPACE} secrets ${PVC_CEPH_CEPHFS_STORAGECLASS_USER_SECRET_NAME}; then
|
if ! kubectl get --namespace ${DEPLOYMENT_NAMESPACE} secrets ${PVC_CEPH_CEPHFS_STORAGECLASS_USER_SECRET_NAME}; then
|
||||||
|
@ -37,7 +37,7 @@ type: "${secret_type}"
|
|||||||
data:
|
data:
|
||||||
key: $( echo ${ceph_key} )
|
key: $( echo ${ceph_key} )
|
||||||
EOF
|
EOF
|
||||||
} | kubectl create --namespace ${kube_namespace} -f -
|
} | kubectl apply --namespace ${kube_namespace} -f -
|
||||||
}
|
}
|
||||||
|
|
||||||
ceph_activate_namespace ${DEPLOYMENT_NAMESPACE} "kubernetes.io/rbd" ${PVC_CEPH_RBD_STORAGECLASS_USER_SECRET_NAME} "$(echo ${CEPH_RBD_KEY} | jq -r '.data | .[]')"
|
ceph_activate_namespace ${DEPLOYMENT_NAMESPACE} "kubernetes.io/rbd" ${PVC_CEPH_RBD_STORAGECLASS_USER_SECRET_NAME} "$(echo ${CEPH_RBD_KEY} | jq -r '.data | .[]')"
|
||||||
|
@ -36,6 +36,7 @@ rules:
|
|||||||
- get
|
- get
|
||||||
- create
|
- create
|
||||||
- update
|
- update
|
||||||
|
- patch
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
|
@ -37,6 +37,7 @@ rules:
|
|||||||
verbs:
|
verbs:
|
||||||
- get
|
- get
|
||||||
- create
|
- create
|
||||||
|
- patch
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
|
@ -36,6 +36,7 @@ rules:
|
|||||||
- get
|
- get
|
||||||
- create
|
- create
|
||||||
- update
|
- update
|
||||||
|
- patch
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
|
@ -33,6 +33,7 @@ rules:
|
|||||||
verbs:
|
verbs:
|
||||||
- get
|
- get
|
||||||
- create
|
- create
|
||||||
|
- patch
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
|
@ -63,6 +63,6 @@ type: kubernetes.io/rbd
|
|||||||
data:
|
data:
|
||||||
key: $( echo ${ENCODED_KEYRING} )
|
key: $( echo ${ENCODED_KEYRING} )
|
||||||
EOF
|
EOF
|
||||||
kubectl create --namespace ${NAMESPACE} -f ${SECRET}
|
kubectl apply --namespace ${NAMESPACE} -f ${SECRET}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -60,6 +60,6 @@ type: kubernetes.io/rbd
|
|||||||
data:
|
data:
|
||||||
key: $( echo ${ENCODED_KEYRING} )
|
key: $( echo ${ENCODED_KEYRING} )
|
||||||
EOF
|
EOF
|
||||||
kubectl create --namespace ${NAMESPACE} -f ${SECRET}
|
kubectl apply --namespace ${NAMESPACE} -f ${SECRET}
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -34,6 +34,7 @@ rules:
|
|||||||
- get
|
- get
|
||||||
- create
|
- create
|
||||||
- update
|
- update
|
||||||
|
- patch
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
|
@ -34,6 +34,7 @@ rules:
|
|||||||
- get
|
- get
|
||||||
- create
|
- create
|
||||||
- update
|
- update
|
||||||
|
- patch
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
|
@ -62,7 +62,7 @@ type: kubernetes.io/rbd
|
|||||||
data:
|
data:
|
||||||
key: $( echo ${ENCODED_KEYRING} )
|
key: $( echo ${ENCODED_KEYRING} )
|
||||||
EOF
|
EOF
|
||||||
kubectl create --namespace ${NAMESPACE} -f ${SECRET}
|
kubectl apply --namespace ${NAMESPACE} -f ${SECRET}
|
||||||
elif [ "x$STORAGE_BACKEND" == "xradosgw" ]; then
|
elif [ "x$STORAGE_BACKEND" == "xradosgw" ]; then
|
||||||
radosgw-admin user stats --uid="${RADOSGW_USERNAME}" || \
|
radosgw-admin user stats --uid="${RADOSGW_USERNAME}" || \
|
||||||
radosgw-admin user create \
|
radosgw-admin user create \
|
||||||
|
@ -34,6 +34,7 @@ rules:
|
|||||||
- get
|
- get
|
||||||
- create
|
- create
|
||||||
- update
|
- update
|
||||||
|
- patch
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
|
@ -57,4 +57,4 @@ type: kubernetes.io/rbd
|
|||||||
data:
|
data:
|
||||||
key: $( echo ${ENCODED_KEYRING} )
|
key: $( echo ${ENCODED_KEYRING} )
|
||||||
EOF
|
EOF
|
||||||
kubectl create --namespace ${NAMESPACE} -f ${SECRET}
|
kubectl apply --namespace ${NAMESPACE} -f ${SECRET}
|
||||||
|
@ -34,6 +34,7 @@ rules:
|
|||||||
- get
|
- get
|
||||||
- create
|
- create
|
||||||
- update
|
- update
|
||||||
|
- patch
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
kind: RoleBinding
|
kind: RoleBinding
|
||||||
|
Loading…
x
Reference in New Issue
Block a user