Skip to content

Commit

Permalink
Create secrets credentials when generating manifest
Browse files Browse the repository at this point in the history
Signed-off-by: gabriel-farache <[email protected]>
  • Loading branch information
gabriel-farache committed Jul 15, 2024
1 parent adf06d5 commit 03d7d84
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions create-ocp-project/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions escalation/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions modify-vm-resources/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions move2kube/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions mta-v6.x/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions mta-v7.x/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions mta/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions mtv-migration/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions mtv-plan/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
1 change: 1 addition & 0 deletions request-vm-cnv/secret.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOTIFICATIONS_BEARER_TOKEN=
19 changes: 16 additions & 3 deletions scripts/gen_manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ echo -e "\nquarkus.flyway.migrate-at-start=true" >> application.properties
# https://github.com/apache/incubator-kie-tools/pull/2136
../kn workflow gen-manifest --namespace ""


if [ "$ENABLE_PERSISTENCE" = false ]; then
exit
fi

# Find the workflow file with .sw.yaml suffix since kn-cli uses the ID to generate resource names
workflow_file=$(printf '%s\n' ./*.sw.yaml 2>/dev/null | head -n 1)

Expand All @@ -45,10 +50,18 @@ SONATAFLOW_CR=manifests/01-sonataflow_${workflow_id}.yaml
yq --inplace eval '.metadata.annotations["sonataflow.org/profile"] = "prod"' "${SONATAFLOW_CR}"

yq --inplace ".spec.podTemplate.container.image=\"quay.io/orchestrator/serverless-workflow-${workflow_id}:latest\"" "${SONATAFLOW_CR}"
yq --inplace ".spec.podTemplate.container.envFrom=[{\"secretRef\": { \"name\": \"${workflow_id}-creds\"}}]" "${SONATAFLOW_CR}"

if [ "$ENABLE_PERSISTENCE" = false ]; then
exit
if test -f "secret.properties"; then
if [ ! -f kubectl ]; then
echo "Installing kubectl CLI"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
else
echo "kubectl cli already available"
fi

yq --inplace ".spec.podTemplate.container.envFrom=[{\"secretRef\": { \"name\": \"${workflow_id}-creds\"}}]" "${SONATAFLOW_CR}"
../kubectl create -n sonataflow-infra secret generic "${workflow_id}-creds" --from-env-file=secret.properties --dry-run=client -oyaml > "manifests/01-secret_${workflow_id}.yaml"
fi

yq --inplace ".spec |= (
Expand Down

0 comments on commit 03d7d84

Please sign in to comment.