Skip to content

Commit b8c54ca

Browse files
authored
fixed secret deletion at the end (#318)
* fixed secret deletion at the end * updated version to 0.0.287 * updated to 0.0.288 * Update manifests/add-cluster/add-cluster.sh
1 parent 06d0ac0 commit b8c54ca

File tree

9 files changed

+27
-15
lines changed

9 files changed

+27
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Changelog:
22

3-
* Added cluster commands
3+
* Fixed cluster-add script

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.0.287
1+
VERSION=v0.0.288
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.287/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.288/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.287/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.288/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

manifests/add-cluster/add-cluster.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# INGRESS_URL (cm)
55
# CONTEXT_NAME (cm)
66
# SERVER (cm)
7+
# CSDP_TOKEN_SECRET
78

89
echo "ServiceAccount: ${SERVICE_ACCOUNT_NAME}"
910
echo "Ingress URL: ${INGRESS_URL}"
@@ -31,18 +32,18 @@ kubectl config set-credentials ${SERVICE_ACCOUNT_NAME} --token ${BEARER_TOKEN}
3132
kubectl config set-context ${CONTEXT_NAME} --cluster=${CLUSTER_NAME} --user=${SERVICE_ACCOUNT_NAME}
3233
KUBE_CONFIG_B64=$(kubectl config view --minify --flatten --output json --context=${CONTEXT_NAME} | base64 -w 0)
3334

34-
RESPONSE=$(curl -X POST ${INGRESS_URL}/app-proxy/api/clusters \
35+
STATUS_CODE=$(curl -X POST ${INGRESS_URL}/app-proxy/api/clusters \
3536
-H 'Content-Type: application/json' \
3637
-H 'Authorization: '${CSDP_TOKEN}'' \
37-
-d '{ "name": "'${CONTEXT_NAME}'", "kubeConfig": "'${KUBE_CONFIG_B64}'" }')
38-
echo $RESPONSE
39-
40-
STATUS_CODE=$(echo $RESPONSE | jq .statusCode)
38+
-d '{ "name": "'${CONTEXT_NAME}'", "kubeConfig": "'${KUBE_CONFIG_B64}'" }' \
39+
-s -o response -w "%{http_code}")
40+
cat response
41+
echo "STATUS_CODE: ${STATUS_CODE}"
4142

4243
if [ $STATUS_CODE -ge 300 ]; then
4344
echo "error creating cluster in runtime"
4445
exit $STATUS_CODE
4546
fi
4647

47-
echo "deleting token secret ${SECRET_NAME}"
48-
kubectl delete secret ${SECRET_NAME} -n ${NAMESPACE}
48+
echo "deleting token secret ${CSDP_TOKEN_SECRET}"
49+
kubectl delete secret ${CSDP_TOKEN_SECRET} -n ${NAMESPACE}

manifests/add-cluster/helm/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ description: This helm chart adds a remote cluster to an existing Codefresh runt
44

55
type: application
66

7-
version: 0.1.0
7+
version: 0.2.0
88

9-
appVersion: 0.1.0
9+
appVersion: 0.2.0

manifests/add-cluster/helm/templates/job.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ spec:
4646
configMapKeyRef:
4747
name: {{ include "csdp-add-cluster.fullname" . }}-cm
4848
key: server
49+
- name: CSDP_TOKEN_SECRET
50+
value: {{ include "csdp-add-cluster.fullname" . }}-secret
4951
resources:
5052
limits:
5153
memory: 512Mi

manifests/add-cluster/kustomize/job.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ spec:
4343
configMapKeyRef:
4444
name: csdp-add-cluster-cm
4545
key: server
46+
- name: CSDP_TOKEN_SECRET
47+
value: $(CSDP_ADD_CLUSTER_SECRET)
4648
resources:
4749
limits:
4850
memory: 512Mi

manifests/add-cluster/kustomize/kustomization.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace: kube-system
44

55
images:
66
- name: quay.io/codefresh/csdp-add-cluster
7-
newTag: 0.1.0
7+
newTag: 0.2.0
88

99
resources:
1010
- configmap.yaml
@@ -13,3 +13,10 @@ resources:
1313
- job.yaml
1414
- secret.yaml
1515
- serviceaccount.yaml
16+
17+
vars:
18+
- name: CSDP_ADD_CLUSTER_SECRET
19+
objref:
20+
apiVersion: v1
21+
kind: Secret
22+
name: csdp-add-cluster-secret

manifests/runtime.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
namespace: "{{ namespace }}"
66
spec:
77
defVersion: 1.0.1
8-
version: 0.0.287
8+
version: 0.0.288
99
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
1010
components:
1111
- name: events

0 commit comments

Comments
 (0)