Skip to content

Commit

Permalink
chore(RHTAPWATCH-1248): Provide admin user/pwd combo for ephemeral cl…
Browse files Browse the repository at this point in the history
…usters
  • Loading branch information
klakshma21 committed Sep 17, 2024
1 parent eda826e commit 914663a
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: eaas-get-ephemeral-cluster-credentials
spec:
description: >-
This StepAction queries the EaaS hub cluster to get the kubeconfig for an ephemeral cluster
This StepAction queries the EaaS hub cluster to get the kubeconfig, username, and password for an ephemeral cluster
by name. Credentials are stored in a mounted volume that must be provided as a param.
image: registry.redhat.io/openshift4/ose-cli@sha256:15da03b04318bcc842060b71e9dd6d6c2595edb4e8fdd11b0c6781eeb03ca182
params:
Expand All @@ -26,11 +26,19 @@ spec:
results:
- name: kubeconfig
description: Relative path to the kubeconfig in the mounted volume
- name: username
description: The username for the cluster
- name: passwordPath
description: Relative path to the password file in the mounted volume
- name: apiServerURL
description: API server URL of the cluster
env:
- name: CLUSTER_NAME
value: "$(params.clusterName)"
- name: CLUSTER_KUBECONFIG
value: "/credentials/$(params.clusterName)-kubeconfig"
- name: CLUSTER_PASSWORD
value: "/credentials/$(params.clusterName)-password"
- name: KUBECONFIG
value: /tmp/eaas-kubeconfig
- name: KUBECONFIG_VALUE
Expand All @@ -56,3 +64,15 @@ spec:
"${OC[@]}" get secret $SECRET -o go-template --template="{{.data.kubeconfig|base64decode}}" > $CLUSTER_KUBECONFIG
echo "Wrote kubeconfig to $CLUSTER_KUBECONFIG"
echo -n $(basename $CLUSTER_KUBECONFIG) > $(step.results.kubeconfig.path)
ADMIN_PASSWORD_SECRET=$("${OC[@]}" get cti "$CLUSTER_NAME" -o=jsonpath='{.status.adminPassword.name}')
echo "Found admin password secret: $ADMIN_PASSWORD_SECRET"
USERNAME=$("${OC[@]}" get secret "$ADMIN_PASSWORD_SECRET" -o go-template --template="{{.data.username | base64decode}}")
"${OC[@]}" get secret "$ADMIN_PASSWORD_SECRET" -o go-template --template="{{.data.password | base64decode}}" > "$CLUSTER_PASSWORD"
echo "Retrieved username"
echo "Wrote password to $CLUSTER_PASSWORD"
echo -n "$USERNAME" > "$(step.results.username.path)"
echo -n "$(basename "$CLUSTER_PASSWORD")" > "$(step.results.passwordPath.path)"
API_SERVER_URL=$("${OC[@]}" get cti "$CLUSTER_NAME" -o=jsonpath='{.status.apiServerURL}')
echo "API Server URL: $API_SERVER_URL"
echo -n "$API_SERVER_URL" > "$(step.results.apiServerURL.path)"
2 changes: 1 addition & 1 deletion task/build-vm-image/0.1/build-vm-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ spec:
name: varlibcontainers
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:c3d440309b1a24cdfa8a2c89b668ca56952185f5c50e7abfa14b2aaafd5e2846
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:0379f5c2feec921a01300b386ce9414b10acfbc4499b187700d972b2360e1585
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down
2 changes: 1 addition & 1 deletion task/buildah-oci-ta/0.1/buildah-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ spec:
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down
2 changes: 1 addition & 1 deletion task/buildah-oci-ta/0.2/buildah-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ spec:
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down
2 changes: 1 addition & 1 deletion task/buildah-remote-oci-ta/0.1/buildah-remote-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ spec:
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- $(params.CACHI2_ARTIFACT)=/var/workdir/cachi2
computeResources: {}
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
name: use-trusted-artifact
- args:
- $(params.BUILD_ARGS[*])
Expand Down
2 changes: 1 addition & 1 deletion task/buildah-remote-oci-ta/0.2/buildah-remote-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ spec:
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- $(params.CACHI2_ARTIFACT)=/var/workdir/cachi2
computeResources: {}
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
name: use-trusted-artifact
- args:
- $(params.BUILD_ARGS[*])
Expand Down
2 changes: 1 addition & 1 deletion task/git-clone-oci-ta/0.1/git-clone-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ spec:
check_symlinks
fi
- name: create-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- create
- --store
Expand Down
2 changes: 1 addition & 1 deletion task/oci-copy-oci-ta/0.1/oci-copy-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ spec:
echo -n "" >$(results.CACHI2_ARTIFACT.path)
fi
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down Expand Up @@ -226,7 +226,7 @@ spec:
cachi2 --log-level="$LOG_LEVEL" inject-files /var/workdir/cachi2/output \
--for-output-dir=/cachi2/output
- name: create-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- create
- --store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down
2 changes: 1 addition & 1 deletion task/source-build-oci-ta/0.1/source-build-oci-ta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:d6f57d97d19008437680190908fe5444cda380f9c77d0e9efde7153720412e05
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:a390d28f69d61ab38aadf78b7c9b21ed09b79687bddae4cf1d02616bef5d7da7
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
Expand Down

0 comments on commit 914663a

Please sign in to comment.