diff --git a/stepactions/eaas-create-ephemeral-cluster-hypershift-aws/0.1/eaas-create-ephemeral-cluster-hypershift-aws.yaml b/stepactions/eaas-create-ephemeral-cluster-hypershift-aws/0.1/eaas-create-ephemeral-cluster-hypershift-aws.yaml index cde56d3ca..feb2f1e44 100644 --- a/stepactions/eaas-create-ephemeral-cluster-hypershift-aws/0.1/eaas-create-ephemeral-cluster-hypershift-aws.yaml +++ b/stepactions/eaas-create-ephemeral-cluster-hypershift-aws/0.1/eaas-create-ephemeral-cluster-hypershift-aws.yaml @@ -6,7 +6,8 @@ spec: description: >- This StepAction provisions an ephemeral cluster using Hypershift with 3 worker nodes in AWS. It does so by creating a ClusterTemplateInstance in a space on an EaaS cluster. - image: registry.redhat.io/openshift4/ose-cli@sha256:15da03b04318bcc842060b71e9dd6d6c2595edb4e8fdd11b0c6781eeb03ca182 + image: public.ecr.aws/bitnami/kubectl:1.31.2@sha256:df433ab6de9adfb0223df79167719099726f946a68c1784d7739a8b6b63cd137 + workingDir: /opt/bitnami params: - name: eaasSpaceSecretRef type: string @@ -32,10 +33,18 @@ spec: type: string default: 30m description: How long to wait for cluster provisioning to complete. + - name: imageContentSources + type: string + default: "" + description: >- + Alternate registry information containing a list of sources and their mirrors in yaml format. + See: https://hypershift-docs.netlify.app/how-to/disconnected/image-content-sources results: - name: clusterName description: The name of the generated ClusterTemplateInstance resource. env: + - name: HOME + value: /opt/bitnami - name: INSTANCE_TYPE value: "$(params.instanceType)" - name: VERSION @@ -51,40 +60,45 @@ spec: value: "$(params.insecureSkipTLSVerify)" - name: TIMEOUT value: "$(params.timeout)" + - name: IMAGE_CONTENT_SOURCES + value: "$(params.imageContentSources)" script: | #!/bin/bash set -eo pipefail cat < cti.yaml + --- apiVersion: clustertemplate.openshift.io/v1alpha1 kind: ClusterTemplateInstance metadata: generateName: cluster- spec: clusterTemplateRef: hypershift-aws-cluster - parameters: - - name: instanceType - value: $INSTANCE_TYPE - - name: version - value: $VERSION - - name: timeout - value: $TIMEOUT + parameters: [] EOF + yq -i '.spec.parameters += {"name": "instanceType", "value": strenv(INSTANCE_TYPE)}' cti.yaml + yq -i '.spec.parameters += {"name": "version", "value": strenv(VERSION)}' cti.yaml + yq -i '.spec.parameters += {"name": "timeout", "value": strenv(TIMEOUT)}' cti.yaml + yq -i '.spec.parameters += {"name": "imageContentSources", "value": strenv(IMAGE_CONTENT_SOURCES)}' cti.yaml + + echo "Creating the following resource:" + cat cti.yaml + trap 'rm -f "$KUBECONFIG"' EXIT echo "$KUBECONFIG_VALUE" > $KUBECONFIG - OC=(oc --insecure-skip-tls-verify="$INSECURE_SKIP_TLS_VERIFY") - CTI_NAME=$("${OC[@]}" create -f cti.yaml -o=jsonpath='{.metadata.name}') + KUBECTL=(kubectl --insecure-skip-tls-verify="$INSECURE_SKIP_TLS_VERIFY") + CTI_NAME=$("${KUBECTL[@]}" create -f cti.yaml -o=jsonpath='{.metadata.name}') echo "Created ClusterTemplateInstance $CTI_NAME" echo -n $CTI_NAME > $(step.results.clusterName.path) echo "Waiting for ClusterTemplateInstance to be ready ($TIMEOUT timeout)" - if "${OC[@]}" wait cti "$CTI_NAME" --for=jsonpath='{.status.phase}'=Ready --timeout="$TIMEOUT"; then + if "${KUBECTL[@]}" wait cti "$CTI_NAME" --for=jsonpath='{.status.phase}'=Ready --timeout="$TIMEOUT"; then echo "Successfully provisioned $CTI_NAME" exit 0 else - "${OC[@]}" get cti "$CTI_NAME" -o yaml + "${KUBECTL[@]}" get cti "$CTI_NAME" -o yaml echo "Failed to provision $CTI_NAME" exit 1 fi