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:
Dae Seong Kim 2018-01-16 20:41:49 +09:00
parent db2276055e
commit 717d72485b
16 changed files with 17 additions and 9 deletions

View File

@ -47,7 +47,7 @@ type: Opaque
data:
${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} )
EOF
} | kubectl create --namespace ${DEPLOYMENT_NAMESPACE} -f -
} | kubectl apply --namespace ${DEPLOYMENT_NAMESPACE} -f -
fi
}

View File

@ -49,7 +49,7 @@ type: Opaque
data:
${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} )
EOF
} | kubectl create --namespace ${DEPLOYMENT_NAMESPACE} -f -
} | kubectl apply --namespace ${DEPLOYMENT_NAMESPACE} -f -
fi
}
#create_kube_key <ceph_key> <ceph_keyring_name> <ceph_keyring_template> <kube_secret_name>
@ -71,7 +71,7 @@ type: kubernetes.io/rbd
data:
key: $( echo ${CEPH_KEYRING} | base64 | tr -d '\n' )
EOF
} | kubectl create --namespace ${DEPLOYMENT_NAMESPACE} -f -
} | kubectl apply --namespace ${DEPLOYMENT_NAMESPACE} -f -
fi
}
#create_kube_storage_key <ceph_key> <kube_secret_name>

View File

@ -37,7 +37,7 @@ type: "${secret_type}"
data:
key: $( echo ${ceph_key} )
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

View File

@ -37,7 +37,7 @@ type: "${secret_type}"
data:
key: $( echo ${ceph_key} )
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 | .[]')"

View File

@ -36,6 +36,7 @@ rules:
- get
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding

View File

@ -37,6 +37,7 @@ rules:
verbs:
- get
- create
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding

View File

@ -36,6 +36,7 @@ rules:
- get
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding

View File

@ -33,6 +33,7 @@ rules:
verbs:
- get
- create
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding

View File

@ -63,6 +63,6 @@ type: kubernetes.io/rbd
data:
key: $( echo ${ENCODED_KEYRING} )
EOF
kubectl create --namespace ${NAMESPACE} -f ${SECRET}
kubectl apply --namespace ${NAMESPACE} -f ${SECRET}
fi

View File

@ -60,6 +60,6 @@ type: kubernetes.io/rbd
data:
key: $( echo ${ENCODED_KEYRING} )
EOF
kubectl create --namespace ${NAMESPACE} -f ${SECRET}
kubectl apply --namespace ${NAMESPACE} -f ${SECRET}
fi

View File

@ -34,6 +34,7 @@ rules:
- get
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding

View File

@ -34,6 +34,7 @@ rules:
- get
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding

View File

@ -62,7 +62,7 @@ type: kubernetes.io/rbd
data:
key: $( echo ${ENCODED_KEYRING} )
EOF
kubectl create --namespace ${NAMESPACE} -f ${SECRET}
kubectl apply --namespace ${NAMESPACE} -f ${SECRET}
elif [ "x$STORAGE_BACKEND" == "xradosgw" ]; then
radosgw-admin user stats --uid="${RADOSGW_USERNAME}" || \
radosgw-admin user create \

View File

@ -34,6 +34,7 @@ rules:
- get
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding

View File

@ -57,4 +57,4 @@ type: kubernetes.io/rbd
data:
key: $( echo ${ENCODED_KEYRING} )
EOF
kubectl create --namespace ${NAMESPACE} -f ${SECRET}
kubectl apply --namespace ${NAMESPACE} -f ${SECRET}

View File

@ -34,6 +34,7 @@ rules:
- get
- create
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding