Skip to content

Commit 4e4fa73

Browse files
committed
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 <[email protected]>
1 parent edd2c29 commit 4e4fa73

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

task/eaas-provision-space/0.1/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# eaas-provision-space task
22

3-
Provisions an ephemeral namespace on an EaaS cluster using a SpaceRequest. This namespace can then be used to provision other ephemeral environments for testing.
3+
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.
44

55
## Parameters
66
|name|description|default value|required|
77
|---|---|---|---|
8-
|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|
9-
|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|
10-
|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|
8+
|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|
9+
|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|
10+
|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|
11+
1112

1213
## Results
1314
|name|description|

task/eaas-provision-space/0.1/eaas-provision-space.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ metadata:
55
name: eaas-provision-space
66
spec:
77
description: >-
8-
Provisions an ephemeral namespace on an EaaS cluster using a SpaceRequest.
8+
Provisions an ephemeral namespace on an EaaS cluster using a crossplane namespace claim.
99
This namespace can then be used to provision other ephemeral environments for testing.
1010
params:
1111
- name: ownerKind
1212
type: string
1313
default: PipelineRun
1414
description: >-
15-
The type of resource that should own the generated SpaceRequest.
15+
The type of resource that should own the generated namespace claim.
1616
Deletion of this resource will trigger deletion of the SpaceRequest.
1717
Supported values: `PipelineRun`, `TaskRun`.
1818
- name: ownerName
1919
type: string
2020
description: >-
21-
The name of the resource that should own the generated SpaceRequest.
21+
The name of the resource that should own the generated namespace claim.
2222
This should either be passed the value of `$(context.pipelineRun.name)`
2323
or `$(context.taskRun.name)` depending on the value of `ownerKind`.
2424
- name: ownerUid
2525
type: string
2626
description: >-
27-
The uid of the resource that should own the generated SpaceRequest.
27+
The uid of the resource that should own the generated namespace claim.
2828
This should either be passed the value of `$(context.pipelineRun.uid)`
2929
or `$(context.taskRun.uid)` depending on the value of `ownerKind`.
3030
results:
@@ -43,8 +43,10 @@ spec:
4343
value: $(params.ownerName)
4444
- name: OWNER_UID
4545
value: $(params.ownerUid)
46-
- name: TIER_NAME
47-
value: konflux-eaas
46+
- name: CLAIM_NAME
47+
value: $(context.taskRun.name)
48+
- name: SECRET
49+
value: $(context.taskRun.name)-secret
4850
script: |
4951
#!/bin/bash
5052
set -eo pipefail
@@ -58,29 +60,27 @@ spec:
5860
;;
5961
esac
6062
61-
cat <<EOF > space_request.yaml
62-
apiVersion: toolchain.dev.openshift.com/v1alpha1
63-
kind: SpaceRequest
63+
cat <<EOF > namespace_claim.yaml
64+
apiVersion: eaas.konflux-ci.dev/v1alpha1
65+
kind: Namespace
6466
metadata:
65-
generateName: eaas-spacerequest-
67+
name: $CLAIM_NAME
6668
namespace: $NAMESPACE
6769
ownerReferences:
6870
- apiVersion: tekton.dev/v1
6971
kind: $OWNER_KIND
7072
name: $OWNER_NAME
7173
uid: $OWNER_UID
7274
spec:
73-
tierName: $TIER_NAME
74-
targetClusterRoles:
75-
- cluster-role.toolchain.dev.openshift.com/eaas
75+
writeConnectionSecretToRef:
76+
name: $SECRET
7677
EOF
7778
78-
NAME=$(oc create -f space_request.yaml -o=jsonpath='{.metadata.name}')
79+
NAME=$(oc create -f namespace_claim.yaml -o=jsonpath='{.metadata.name}')
7980
80-
if oc wait spacerequests $NAME --for=condition=Ready --timeout=5m; then
81-
secretRef=$(oc get spacerequests $NAME -o=jsonpath='{.status.namespaceAccess[0].secretRef}')
82-
echo "SecretRef: $secretRef"
83-
echo -n "$secretRef" > $(results.secretRef.path)
81+
if oc wait namespaces.eaas.konflux-ci.dev "$NAME" --for=condition=Ready --timeout=5m; then
82+
echo "SecretRef: $SECRET"
83+
echo -n "$SECRET" > "$(results.secretRef.path)"
8484
else
8585
exit 1
8686
fi

0 commit comments

Comments
 (0)