Operations
Update a project token

Update a project token

For existing core-operator based installations.

Before starting:

Core-Operator is not directly tied to usage of TOKEN so no action should be taken. Calyptia CRDs are not affected by this

For existing core-instance installations:

Helm

Important: this is only applicable if the core-instance was installed using helm charts like this:

helm install <release_name> calyptia/core-instance --set=cloudToken=<token> --set=coreInstance=<coreinstanceName>

List Helm releases:

helm ls

NAME                NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                     APP VERSION
<release_name>      default         1               2024-02-02 14:33:47.33815851 +0000 UTC  deployed        core-instance-2.4.0       v2.4.0

Pick the release name as desired:

helm upgrade <release_name> calyptia/core-instance –set=cloudToken="<new_token>"

Replace <release_name> with actual name of the release.

Verification

Important: core-instance deployment consists of two containers. It is necessary to run both commands to confirm the change.

kubectl get deploy calyptia-core-instance-<release_name> -o yaml | yq .spec.template.spec.containers[].env[3]

Newly set token should be shown as output of this command

Example of successful update:

# helm upgrade ci calyptia/core-instance --set=coreInstance=test12345 --set=cloudToken=12345
Release "ci" has been upgraded. Happy Helming!
NAME: ci
LAST DEPLOYED: Fri Feb  2 12:21:25 2024
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None
# kubectl get deploy calyptia-core-instance-ci -o yaml | yq .spec.template.spec.containers[1].env[3]
name: TOKEN
value: "12345"
# kubectl get deploy calyptia-core-instance-ci -o yaml | yq .spec.template.spec.containers[0].env[3]
name: TOKEN
value: "12345"

No further action is required. After updating the token the operator will handle replacement of the token for all pipelines.

For detailed instructions about how to validate changes, look at the Validation for Helm and Calyptia CLI at the bottom of this document.

Calyptia CLI

Important: This example is only usable if the core-instance was installed using Calyptia CLI like this:

calyptia create core_instance operator --name <core_instance_name>

List available core_instances:

calyptia get core_instances

Output should look like

NAME
4325 test

Confirm core-instance exists

kubectl get  deployment calyptia-<core_instance_name>-default-sync

Check for TOKEN value

kubectl get  deploy calyptia-<core_instance_name>-default-sync -o yaml | yq .spec.template.spec.containers[].env[3]

Result should resemble this:

name: TOKEN
value: "<OLD_TOKEN>"
name: TOKEN
value: "<OLD_TOKEN>"
kubectl edit  deploy calyptia-<core_instance_name>-default-sync

The terminal will prompt users to edit values with vim. Browse to spec.template.spec.containers using the editor navigate to both TOKEN fields and change value: field with the new token.

Example of successful update:

# kubectl get deploy calyptia-<core_instance_name>-default-sync
-o yaml | yq .spec.template.spec.containers[0].env[3]
name: TOKEN
value: "<new_token>"
# kubectl get deploy calyptia-<core_instance_name>-default-sync
-o yaml | yq .spec.template.spec.containers[1].env[3]
name: TOKEN
value: "<new_token>"

For detailed instructions on how to validate changes, look at the Validation for Helm and Calyptia CLI at the bottom of this document. Validation for Helm and Calyptia CLI:

After successful replacement of TOKEN in the deployment. Something resembling this output should be available:

kubectl get po -w
NAME                                                READY   STATUS    RESTARTS   AGE
calyptia-core-controller-manager-ddbd858f7-qkvgd    1/1     Running   0          9m17s
calyptia-test1234-default-sync-85bf467d6c-w6prs     2/2     Running   0          7m30s
calyptia-test123456-default-sync-5cf679db6d-swwxb   2/2     Running   0          5m2s
health-check-f0dc-mt4s-566695479-9985l              1/1     Running   0          4m25s
calyptia-test-default-sync-5b55d7986f-bq26h         2/2     Running   0          4m19s
health-check-8f70-dxk4-69b4bc6569-4cnww             1/1     Running   0          4m16s
pptt-tux0-6d97fb855c-7mhf8                          1/1     Running   0          76s
calyptia-test-default-sync-785f5dcc47-j8g4r         0/2     Pending   0          0s
calyptia-test-default-sync-785f5dcc47-j8g4r         0/2     Pending   0          0s
calyptia-test-default-sync-785f5dcc47-j8g4r         0/2     ContainerCreating   0          0s
calyptia-test-default-sync-785f5dcc47-j8g4r         2/2     Running             0          2s
calyptia-test-default-sync-5b55d7986f-bq26h         2/2     Terminating         0          5m31s
calyptia-test-default-sync-5b55d7986f-bq26h         0/2     Terminating         0          5m31s
pptt-tux0-6d97fb855c-7mhf8                          1/1     Terminating         0          2m29s
health-check-8f70-dxk4-69b4bc6569-4cnww             1/1     Terminating         0          5m29s
pptt-tux0-6d97fb855c-7mhf8                          0/1     Terminating         0          2m29s
health-check-8f70-dxk4-69b4bc6569-4cnww             0/1     Terminating         0          5m29s
calyptia-test-default-sync-5b55d7986f-bq26h         0/2     Terminating         0          5m32s
pptt-tux0-6d97fb855c-7mhf8                          0/1     Terminating         0          2m29s
health-check-8f70-dxk4-78fc785d55-jd7lz             0/1     Pending             0          0s
pptt-tux0-6d97fb855c-7mhf8                          0/1     Terminating         0          2m29s
pptt-tux0-6d97fb855c-7mhf8                          0/1     Terminating         0          2m29s
calyptia-test-default-sync-5b55d7986f-bq26h         0/2     Terminating         0          5m32s
calyptia-test-default-sync-5b55d7986f-bq26h         0/2     Terminating         0          5m32s
pptt-tux0-76c8cb7999-5kdtw                          0/1     Pending             0          0s
pptt-tux0-76c8cb7999-5kdtw                          0/1     Pending             0          0s
health-check-8f70-dxk4-78fc785d55-jd7lz             0/1     ContainerCreating   0          0s
pptt-tux0-76c8cb7999-5kdtw                          0/1     ContainerCreating   0          0s
pptt-tux0-76c8cb7999-5kdtw                          1/1     Running             0          1s
health-check-8f70-dxk4-78fc785d55-jd7lz             1/1     Running             0          1s

The change between statuses for pipeline pods should be visible from terminating -> pending -> running

Alternatively:

kubectl get po -l "app.kubernetes.io/component=calyptia-core"
NAME                                      READY   STATUS    RESTARTS   AGE
health-check-f0dc-mt4s-566695479-9985l    1/1     Running   0          5s
pptt-tux0-76c8cb7999-5kdtw                1/1     Running   0          4s
health-check-8f70-dxk4-78fc785d55-jd7lz   1/1     Running   0          4s

All pod AGE values should be within the time frame from the applied change to the moment of querying.

Granular example:

kubectl get pipeline
NAME                     STATUS
health-check-f0dc-mt4s   STARTED
pptt-tux0                STARTED
health-check-8f70-dxk4   STARTED

Using one of the pipeline names fetch configMap

kubectl get cm pptt-tux0 -o yaml ## replace pptt-tux0  with the name of actual pipeline
apiVersion: v1
data:
  fluent-bit.yaml: |
    service:
        plugins_file: /opt/calyptia-fluent-bit/etc/enterprise_plugins.conf
        Parsers_File: /config/parsers.conf
    customs:
        - name: calyptia
          calyptia_tls.verify: "off"
          calyptia_tls: "on"
          api_key: <new_token>

All examples may vary in some minute details where the exact position of a property in outputs might slightly differ.

Calyptia Legacy Core

Having an existing legacy core instance installed through Helm:

helm repo add calyptia https://helm.calyptia.com/
helm repo update
kubectl create namespace my-legacy-core
helm install my-legacy-core calyptia/core \
  -n my-legacy-core \
  --set name=my-legacy-core \
  --set project_token=<old-token-here> \
  --set api_url=https://cloud-api.calyptia.com

It can be updated to use a new token like this:

helm upgrade my-legacy-core calyptia/core \
  -n my-legacy-core \
  --set name=my-legacy-core \
  --set project_token=<new-token-here> \
  --set api_url=https://cloud-api.calyptia.com

No further action is required. The existing pipelines will be recreated.