From 07c964c06efc2cb3d2d76d65ae2409d2df9c9b83 Mon Sep 17 00:00:00 2001 From: Homaja Marisetty Date: Fri, 20 Dec 2024 14:00:55 -0500 Subject: [PATCH] chore(KFLUXVNGD-93): Update eaas-provision-space task Update eaas-provision-space task to use new claim resource instead of SpaceRequests. Jira-Url: https://issues.redhat.com/browse/KFLUXVNGD-93 Signed-off-by: Homaja Marisetty --- task/eaas-provision-space/0.1/README.md | 9 ++--- .../0.1/eaas-provision-space.yaml | 36 +++++++++---------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/task/eaas-provision-space/0.1/README.md b/task/eaas-provision-space/0.1/README.md index ec32e9bade..1760166d13 100644 --- a/task/eaas-provision-space/0.1/README.md +++ b/task/eaas-provision-space/0.1/README.md @@ -1,13 +1,14 @@ # eaas-provision-space task -Provisions an ephemeral namespace on an EaaS cluster using a SpaceRequest. This namespace can then be used to provision other ephemeral environments for testing. +Provisions an ephemeral namespace on an EaaS cluster using a namespace claim. This namespace can then be used to provision other ephemeral environments for testing. ## Parameters |name|description|default value|required| |---|---|---|---| -|ownerKind|The type of resource that should own the generated SpaceRequest. Deletion of this resource will trigger deletion of the SpaceRequest. Supported values: `PipelineRun`, `TaskRun`.|PipelineRun|false| -|ownerName|The name of the resource that should own the generated SpaceRequest. This should either be passed the value of `$(context.pipelineRun.name)` or `$(context.taskRun.name)` depending on the value of `ownerKind`.||true| -|ownerUid|The uid of the resource that should own the generated SpaceRequest. This should either be passed the value of `$(context.pipelineRun.uid)` or `$(context.taskRun.uid)` depending on the value of `ownerKind`.||true| +|ownerKind|The type of resource that should own the generated namespace claim. Deletion of this resource will trigger deletion of the namespace claim. Supported values: `PipelineRun`, `TaskRun`.|PipelineRun|false| +|ownerName|The name of the resource that should own the generated namespace claim. This should either be passed the value of `$(context.pipelineRun.name)` or `$(context.taskRun.name)` depending on the value of `ownerKind`.||true| +|ownerUid|The uid of the resource that should own the generated namespace claim. This should either be passed the value of `$(context.pipelineRun.uid)` or `$(context.taskRun.uid)` depending on the value of `ownerKind`.||true| + ## Results |name|description| diff --git a/task/eaas-provision-space/0.1/eaas-provision-space.yaml b/task/eaas-provision-space/0.1/eaas-provision-space.yaml index a71eac5ce0..9fc9b009bc 100644 --- a/task/eaas-provision-space/0.1/eaas-provision-space.yaml +++ b/task/eaas-provision-space/0.1/eaas-provision-space.yaml @@ -5,26 +5,26 @@ metadata: name: eaas-provision-space spec: description: >- - Provisions an ephemeral namespace on an EaaS cluster using a SpaceRequest. + Provisions an ephemeral namespace on an EaaS cluster using a crossplane namespace claim. This namespace can then be used to provision other ephemeral environments for testing. params: - name: ownerKind type: string default: PipelineRun description: >- - The type of resource that should own the generated SpaceRequest. + The type of resource that should own the generated namespace claim. Deletion of this resource will trigger deletion of the SpaceRequest. Supported values: `PipelineRun`, `TaskRun`. - name: ownerName type: string description: >- - The name of the resource that should own the generated SpaceRequest. + The name of the resource that should own the generated namespace claim. This should either be passed the value of `$(context.pipelineRun.name)` or `$(context.taskRun.name)` depending on the value of `ownerKind`. - name: ownerUid type: string description: >- - The uid of the resource that should own the generated SpaceRequest. + The uid of the resource that should own the generated namespace claim. This should either be passed the value of `$(context.pipelineRun.uid)` or `$(context.taskRun.uid)` depending on the value of `ownerKind`. results: @@ -43,8 +43,10 @@ spec: value: $(params.ownerName) - name: OWNER_UID value: $(params.ownerUid) - - name: TIER_NAME - value: konflux-eaas + - name: CLAIM_NAME + value: $(context.taskRun.name) + - name: SECRET + value: $(context.taskRun.name)-secret script: | #!/bin/bash set -eo pipefail @@ -58,11 +60,11 @@ spec: ;; esac - cat < space_request.yaml - apiVersion: toolchain.dev.openshift.com/v1alpha1 - kind: SpaceRequest + cat < namespace_claim.yaml + apiVersion: eaas.konflux-ci.dev/v1alpha1 + kind: Namespace metadata: - generateName: eaas-spacerequest- + name: $CLAIM_NAME namespace: $NAMESPACE ownerReferences: - apiVersion: tekton.dev/v1 @@ -70,17 +72,15 @@ spec: name: $OWNER_NAME uid: $OWNER_UID spec: - tierName: $TIER_NAME - targetClusterRoles: - - cluster-role.toolchain.dev.openshift.com/eaas + writeConnectionSecretToRef: + name: $SECRET EOF - NAME=$(oc create -f space_request.yaml -o=jsonpath='{.metadata.name}') + NAME=$(oc create -f namespace_claim.yaml -o=jsonpath='{.metadata.name}') - if oc wait spacerequests $NAME --for=condition=Ready --timeout=5m; then - secretRef=$(oc get spacerequests $NAME -o=jsonpath='{.status.namespaceAccess[0].secretRef}') - echo "SecretRef: $secretRef" - echo -n "$secretRef" > $(results.secretRef.path) + if oc wait namespaces.eaas.konflux-ci.dev "$NAME" --for=condition=Ready --timeout=5m; then + echo "SecretRef: $SECRET" + echo -n "$SECRET" > "$(results.secretRef.path)" else exit 1 fi