Skip to content

Commit 481aba7

Browse files
feat(docs): add CLI migration note (#590)
1 parent 4faae6d commit 481aba7

File tree

4 files changed

+120
-6
lines changed

4 files changed

+120
-6
lines changed

charts/cf-runtime/Chart.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
description: A Helm chart for Codefresh Runner
33
name: cf-runtime
4-
version: 7.9.0
4+
version: 7.9.1
55
keywords:
66
- codefresh
77
- runner
@@ -17,10 +17,8 @@ annotations:
1717
artifacthub.io/containsSecurityUpdates: "true"
1818
# Supported kinds: `added`, `changed`, `deprecated`, `removed`, `fixed`, `security`:
1919
artifacthub.io/changes: |
20-
- kind: changed
21-
description: "Added ability to specify .Values.runtime.engine.runtimeImages as a maps with registry, repository, tag and digest."
22-
- kind: fixed
23-
description: "Fixed empty lines in misc templates."
20+
- kind: added
21+
description: "Added documentation on migrating from CLI installation"
2422
dependencies:
2523
- name: cf-common
2624
repository: oci://quay.io/codefresh/charts

charts/cf-runtime/README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Codefresh Runner
22

3-
![Version: 7.9.0](https://img.shields.io/badge/Version-7.9.0-informational?style=flat-square)
3+
![Version: 7.9.1](https://img.shields.io/badge/Version-7.9.1-informational?style=flat-square)
44

55
Helm chart for deploying [Codefresh Runner](https://codefresh.io/docs/docs/installation/codefresh-runner/) to Kubernetes.
66

@@ -32,6 +32,7 @@ Helm chart for deploying [Codefresh Runner](https://codefresh.io/docs/docs/insta
3232
- [ARM](#arm)
3333
- [Openshift](#openshift)
3434
- [On-premise](#on-premise)
35+
- [Migrating from CLI-based installation to Helm chart](#migrating-from-cli-based-installation-to-helm-chart)
3536

3637
## Prerequisites
3738

@@ -1087,6 +1088,46 @@ helm upgrade --install cf-runtime oci://quay.io/codefresh/cf-runtime -f values.y
10871088

10881089
Go to [https://<YOUR_ONPREM_DOMAIN_HERE>/admin/runtime-environments/system](https://<YOUR_ONPREM_DOMAIN_HERE>/admin/runtime-environments/system) to see the runtime. Assign it to the required account(s).
10891090

1091+
## Migrating from CLI-based installation to Helm chart
1092+
1093+
If you have previously installed Codefresh Runner via CLI, you can migrate to the Helm chart by following these steps:
1094+
1095+
Get Agent and Runtime from existing installation:
1096+
1097+
```console
1098+
NAMESPACE=codefresh
1099+
AGENT_NAME=$(kubectl -n $NAMESPACE get deploy runner -o json | jq -r '.spec.template.spec.containers[].env[] | select(.name == "AGENT_ID") | .value')
1100+
RUNTIME_NAME=$(kubectl -n $NAMESPACE get secret runnerconf -o json | jq -r '.data | to_entries | .[0].value' | base64 -d | grep 'name:' | cut -d':' -f2 | tr -d ' ')
1101+
echo "AGENT_NAME: $AGENT_NAME"
1102+
echo "RUNTIME_NAME: $RUNTIME_NAME"
1103+
```
1104+
1105+
Delete the legacy k8s resources created via CLI with `./scripts/delete-legacy-cli-resources.sh` script:
1106+
1107+
⚠️⚠️⚠️ **DO NOT DELETE `runner` secret!** ⚠️⚠️⚠️
1108+
1109+
```console
1110+
NAMESPACE=codefresh
1111+
./scripts/delete-legacy-cli-resources.sh $NAMESPACE
1112+
```
1113+
1114+
Fill Agent and Runtime names in the `values.yaml` file:
1115+
1116+
```console
1117+
cat << EOF > my-values.yaml
1118+
global:
1119+
agentName: $AGENT_NAME
1120+
runtimeName: $RUNTIME_NAME
1121+
agentTokenSecretKeyRef:
1122+
name: runner
1123+
key: codefresh.token
1124+
EOF
1125+
```
1126+
1127+
⚠️ Any customizations in runtime-environment spec done via CLI (like `nodeSelector`, `tolerations`, `podLabels`, etc) should be added to the `values.yaml` file as well.
1128+
1129+
Install the Helm chart
1130+
10901131
## Requirements
10911132

10921133
| Repository | Name | Version |

charts/cf-runtime/README.md.gotmpl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Helm chart for deploying [Codefresh Runner](https://codefresh.io/docs/docs/insta
3232
- [ARM](#arm)
3333
- [Openshift](#openshift)
3434
- [On-premise](#on-premise)
35+
- [Migrating from CLI-based installation to Helm chart](#migrating-from-cli-based-installation-to-helm-chart)
3536

3637
## Prerequisites
3738

@@ -1089,6 +1090,47 @@ helm upgrade --install cf-runtime oci://quay.io/codefresh/cf-runtime -f values.y
10891090

10901091
Go to [https://<YOUR_ONPREM_DOMAIN_HERE>/admin/runtime-environments/system](https://<YOUR_ONPREM_DOMAIN_HERE>/admin/runtime-environments/system) to see the runtime. Assign it to the required account(s).
10911092

1093+
1094+
## Migrating from CLI-based installation to Helm chart
1095+
1096+
If you have previously installed Codefresh Runner via CLI, you can migrate to the Helm chart by following these steps:
1097+
1098+
Get Agent and Runtime from existing installation:
1099+
1100+
```console
1101+
NAMESPACE=codefresh
1102+
AGENT_NAME=$(kubectl -n $NAMESPACE get deploy runner -o json | jq -r '.spec.template.spec.containers[].env[] | select(.name == "AGENT_ID") | .value')
1103+
RUNTIME_NAME=$(kubectl -n $NAMESPACE get secret runnerconf -o json | jq -r '.data | to_entries | .[0].value' | base64 -d | grep 'name:' | cut -d':' -f2 | tr -d ' ')
1104+
echo "AGENT_NAME: $AGENT_NAME"
1105+
echo "RUNTIME_NAME: $RUNTIME_NAME"
1106+
```
1107+
1108+
Delete the legacy k8s resources created via CLI with `./scripts/delete-legacy-cli-resources.sh` script:
1109+
1110+
⚠️⚠️⚠️ **DO NOT DELETE `runner` secret!** ⚠️⚠️⚠️
1111+
1112+
```console
1113+
NAMESPACE=codefresh
1114+
./scripts/delete-legacy-cli-resources.sh $NAMESPACE
1115+
```
1116+
1117+
Fill Agent and Runtime names in the `values.yaml` file:
1118+
1119+
```console
1120+
cat << EOF > my-values.yaml
1121+
global:
1122+
agentName: $AGENT_NAME
1123+
runtimeName: $RUNTIME_NAME
1124+
agentTokenSecretKeyRef:
1125+
name: runner
1126+
key: codefresh.token
1127+
EOF
1128+
```
1129+
1130+
⚠️ Any customizations in runtime-environment spec done via CLI (like `nodeSelector`, `tolerations`, `podLabels`, etc) should be added to the `values.yaml` file as well.
1131+
1132+
Install the Helm chart
1133+
10921134
{{ template "chart.requirementsSection" . }}
10931135

10941136
{{ template "chart.valuesSection" . }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
NAMESPACE=${1}
4+
5+
if [ -z "$NAMESPACE" ]; then
6+
echo "Usage: $0 <namespace>"
7+
exit 1
8+
fi
9+
10+
KINDS=(
11+
"deployment"
12+
"daemonset"
13+
"configmap"
14+
"secret"
15+
"serviceaccount"
16+
"role"
17+
"rolebinding"
18+
"clusterrole"
19+
"clusterrolebinding"
20+
"storageclass"
21+
)
22+
23+
for kind in "${KINDS[@]}"; do
24+
echo "Deleting $kind resources in namespace: $NAMESPACE"
25+
kubectl delete "$kind" -n "$NAMESPACE" -l 'app in (runner, venona, dind-volume-provisioner, dind-lv-monitor, app-proxy)' --ignore-not-found
26+
done
27+
28+
# Delete unlabeled resources
29+
kubectl -n $NAMESPACE delete secret $(kubectl get sa runner -o json | jq -r '.secrets.[].name')
30+
kubectl -n $NAMESPACE delete runnerconf
31+
kubectl -n $NAMESPACE delete sa runner
32+
kubectl -n $NAMESPACE delete role codefresh-engine runner
33+
kubectl -n $NAMESPACE delete rolebinding codefresh-engine runner

0 commit comments

Comments
 (0)