Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Implement ability to add labels on the created secrets #6

Merged
merged 1 commit into from
Nov 8, 2021
Merged
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ Optional parameters:
This certificate should be shared with all users and each user should add it into OS or browser trust store.
The namespace is defined by `CHE_NAMESPACE` environment variable.
Default value is `self-signed-certificate`.
- `LABELS` is a space separated list of labels to add to the generated secret.
Could be empty.

Image repository is `quay.io/eclipse/che-tls-secret-creator` and could be found [here](https://quay.io/repository/eclipse/che-tls-secret-creator).
16 changes: 16 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,21 @@ if [ $? -ne 0 ]; then
exit 21
fi

# Label the resulting secrets.
# It is used to have the secret cached in the operator client.
if [ -n "$LABELS" ]; then
kubectl label secret "${CHE_SERVER_TLS_SECRET_NAME}" ${LABELS} --namespace=$CHE_NAMESPACE
if [ $? -ne 0 ]; then
echo "Error while labeling secret \"${CHE_SERVER_TLS_SECRET_NAME}\"."
exit 22
fi

kubectl label secret "${CHE_CA_CERTIFICATE_SECRET_NAME}" ${LABELS} --namespace=$CHE_NAMESPACE
if [ $? -ne 0 ]; then
echo "Error while labeling secret \"${CHE_CA_CERTIFICATE_SECRET_NAME}\"."
exit 23
fi
fi

# Log that everything is done
echo 'Che TLS secrets are created.'