Skip to content

Add-cluster-insecure #198

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

Merged
merged 6 commits into from
Mar 13, 2023
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
5 changes: 3 additions & 2 deletions add-cluster/add-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ BEARER_TOKEN=$(kubectl get secret ${SECRET_NAME} -n ${NAMESPACE} -o jsonpath='{.
CLUSTER_NAME=$(echo ${SERVER} | sed s/'http[s]\?:\/\/'//)
if [[ $SKIP_TLS_VALIDATION == 'true' ]]
then
kubectl config set-cluster "${CLUSTER_NAME}" --server="${SERVER}" || exit 1
kubectl config set-cluster "${CLUSTER_NAME}" --server="${SERVER}" --insecure-skip-tls-verify=true || exit 1
else
# Reference the internal certificate authority (CA)
kubectl config set-cluster "${CLUSTER_NAME}" --server="${SERVER}" --certificate-authority="${SERVICEACCOUNT}/ca.crt" || exit 1
fi

kubectl config set-credentials "${SERVICE_ACCOUNT_NAME}" --token "${BEARER_TOKEN}" || exit 1
kubectl config set-context "${CONTEXT_NAME}" --cluster="${CLUSTER_NAME}" --user="${SERVICE_ACCOUNT_NAME}" || exit 1

Expand Down Expand Up @@ -84,4 +85,4 @@ if [[ $STATUS_CODE -ge 300 ]]; then
fi

echo "deleting token secret ${CSDP_TOKEN_SECRET}"
kubectl delete secret ${CSDP_TOKEN_SECRET} -n ${NAMESPACE} || echo "warning: failed deleting secret ${CSDP_TOKEN_SECRET}. you can safely delete this secret manually later with: kubectl delete secret ${CSDP_TOKEN_SECRET} -n ${NAMESPACE}"
kubectl delete secret ${CSDP_TOKEN_SECRET} -n ${NAMESPACE} || echo "warning: failed deleting secret ${CSDP_TOKEN_SECRET}. you can safely delete this secret manually later with: kubectl delete secret ${CSDP_TOKEN_SECRET} -n ${NAMESPACE}"
2 changes: 1 addition & 1 deletion add-cluster/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ type: application

version: 0.2.0

appVersion: 0.6.0
appVersion: 0.7.0
2 changes: 1 addition & 1 deletion add-cluster/kustomize/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace: kube-system

images:
- name: quay.io/codefresh/csdp-add-cluster
newTag: 0.6.0
newTag: 0.7.0

resources:
- configmap.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- -c
- |
/bin/sh <<'EOF'
if [ $(ls /app/config/tls) ]; then
if [ "$(ls /app/config/tls)" ]; then
echo "concatenating certs into /app/config/all/all.cer"
cat /app/config/tls/* >> /app/config/all/all.cer
else
Expand Down