Skip to content

Commit

Permalink
chore(KFLUXVNGD-93): Update eaas-provision-space task
Browse files Browse the repository at this point in the history
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 <hmariset@redhat.com>
  • Loading branch information
hmariset committed Jan 8, 2025
1 parent bb14eed commit fe6d2f4
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions task/eaas-provision-space/0.1/eaas-provision-space.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 claims.
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 claims.
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 claims.
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 claims.
This should either be passed the value of `$(context.pipelineRun.uid)`
or `$(context.taskRun.uid)` depending on the value of `ownerKind`.
results:
Expand All @@ -45,6 +45,8 @@ spec:
value: $(params.ownerUid)
- name: TIER_NAME
value: konflux-eaas
- name: SECRET
value: $(context.taskRun.name)
script: |
#!/bin/bash
set -eo pipefail
Expand All @@ -58,27 +60,26 @@ spec:
;;
esac
cat <<EOF > space_request.yaml
apiVersion: toolchain.dev.openshift.com/v1alpha1
kind: SpaceRequest
cat <<EOF > namespace_claim.yaml
apiVersion: eaas.konflux-ci.dev/v1alpha1
kind: Namespace
metadata:
generateName: eaas-spacerequest-
name: $SECRET
namespace: $NAMESPACE
ownerReferences:
- apiVersion: tekton.dev/v1
kind: $OWNER_KIND
name: $OWNER_NAME
uid: $OWNER_UID
spec:
tierName: $TIER_NAME
targetClusterRoles:
- cluster-role.toolchain.dev.openshift.com/eaas
writeConnectionSecretToRef:
name: $SECRET-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}')
if oc wait namespaces.eaas.konflux-ci.dev "$NAME" --for=condition=Ready --timeout=5m; then
secretRef=$SECRET-secret
echo "SecretRef: $secretRef"
echo -n "$secretRef" > $(results.secretRef.path)
else
Expand Down

0 comments on commit fe6d2f4

Please sign in to comment.