Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demonstrate ClusterTemplate can consume ClusterDeliveryTemplate output #1438

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2021 VMware
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---

apiVersion: v1
kind: ServiceAccount
metadata:
name: my-service-account
secrets:
- name: my-service-account-secret

---

apiVersion: v1
kind: Secret
metadata:
name: my-service-account-secret
annotations:
kubernetes.io/service-account.name: my-service-account
data:
token: "ZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklubFNWM1YxVDNSRldESnZVRE4wTUd0R1EzQmlVVlJOVWtkMFNGb3RYMGh2VUhKYU1FRnVOR0Y0WlRBaWZRLmV5SnBjM01pT2lKcmRXSmxjbTVsZEdWekwzTmxjblpwWTJWaFkyTnZkVzUwSWl3aWEzVmlaWEp1WlhSbGN5NXBieTl6WlhKMmFXTmxZV05qYjNWdWRDOXVZVzFsYzNCaFkyVWlPaUprWldaaGRXeDBJaXdpYTNWaVpYSnVaWFJsY3k1cGJ5OXpaWEoyYVdObFlXTmpiM1Z1ZEM5elpXTnlaWFF1Ym1GdFpTSTZJbTE1TFhOaExYUnZhMlZ1TFd4dVkzRndJaXdpYTNWaVpYSnVaWFJsY3k1cGJ5OXpaWEoyYVdObFlXTmpiM1Z1ZEM5elpYSjJhV05sTFdGalkyOTFiblF1Ym1GdFpTSTZJbTE1TFhOaElpd2lhM1ZpWlhKdVpYUmxjeTVwYnk5elpYSjJhV05sWVdOamIzVnVkQzl6WlhKMmFXTmxMV0ZqWTI5MWJuUXVkV2xrSWpvaU9HSXhNV1V3WldNdFlURTVOeTAwWVdNeUxXRmpORFF0T0RjelpHSmpOVE13TkdKbElpd2ljM1ZpSWpvaWMzbHpkR1Z0T25ObGNuWnBZMlZoWTJOdmRXNTBPbVJsWm1GMWJIUTZiWGt0YzJFaWZRLmplMzRsZ3hpTUtnd0QxUGFhY19UMUZNWHdXWENCZmhjcVhQMEE2VUV2T0F6ek9xWGhpUUdGN2poY3RSeFhmUVFJVEs0Q2tkVmZ0YW5SUjNPRUROTUxVMVBXNXVsV3htVTZTYkMzdmZKT3ozLVJPX3BOVkNmVW8tZURpblN1Wm53bjNzMjNjZU9KM3IzYk04cnBrMHZZZFgyRVlQRGItMnd4cjIzZ1RxUjVxZU5ULW11cS1qYktXVE8wYnRYVl9wVHNjTnFXUkZIVzJBVTVHYVBpbmNWVXg1bXExLXN0SFdOOGtjTG96OF96S2RnUnJGYV92clFjb3NWZzZCRW5MSEt2NW1fVEhaR3AybU8wYmtIV3J1Q2xEUDdLc0tMOFVaZWxvTDN4Y3dQa000VlBBb2V0bDl5MzlvUi1KbWh3RUlIcS1hX3BzaVh5WE9EQU44STcybEZpUSU="
type: kubernetes.io/service-account-token
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright 2021 VMware
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: carto.run/v1alpha1
kind: ClusterSourceTemplate
metadata:
name: example-source---cluster-template-after-deployment
spec:
template:
apiVersion: v1
kind: ConfigMap
metadata:
name: example-source-configmap
data:
player_initial_lives: "5"
player_loves: "knitting"
urlPath: data.player_initial_lives
revisionPath: data.player_loves
healthRule:
alwaysHealthy: {}

---
apiVersion: carto.run/v1alpha1
kind: ClusterDeploymentTemplate
metadata:
name: example-deployment---cluster-template-after-deployment
spec:
template:
apiVersion: v1
kind: ConfigMap
metadata:
name: example-deployment-configmap
data:
favorite_color: $(deployment.url)$
healthRule:
multiMatch:
healthy:
matchFields:
- key: .data.favorite_color
operator: Exists
messagePath: .metadata.name
unhealthy:
matchFields:
- key: .data.error
operator: Exists
messagePath: .metadata.name
---
apiVersion: carto.run/v1alpha1
kind: ClusterTemplate
metadata:
name: example-task---cluster-template-after-deployment
spec:
template:
apiVersion: v1
kind: ConfigMap
metadata:
name: example-task
data:
some_task: $(deployment.url)$
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2021 VMware
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: carto.run/v1alpha1
kind: ClusterDelivery
metadata:
name: responsible-ops---cluster-template-after-deployment
spec:
selector:
integration-test: "cluster-template-after-deployment"
resources:
- name: source-provider
templateRef:
kind: ClusterSourceTemplate
name: example-source---cluster-template-after-deployment

- name: deployer
templateRef:
kind: ClusterDeploymentTemplate
name: example-deployment---cluster-template-after-deployment
deployment:
resource: source-provider

- name: task
templateRef:
kind: ClusterTemplate
name: example-task---cluster-template-after-deployment
deployment:
resource: deployer
142 changes: 142 additions & 0 deletions tests/kuttl/delivery/cluster-template-after-deployment/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Copyright 2021 VMware
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: v1
kind: ConfigMap
metadata:
name: example-source-configmap
data:
player_initial_lives: "5"
player_loves: "knitting"

---
apiVersion: v1
kind: ConfigMap
metadata:
name: example-deployment-configmap
data:
favorite_color: "5"

---
apiVersion: v1
kind: ConfigMap
metadata:
name: example-task
data:
some_task: "5"

---
apiVersion: carto.run/v1alpha1
kind: Deliverable
metadata:
name: petclinic
status:
conditions:
- type: DeliveryReady
status: "True"
reason: Ready
- type: ResourcesSubmitted
status: "True"
reason: ResourceSubmissionComplete
- type: ResourcesHealthy
status: "True"
reason: HealthyConditionRule
- type: Ready
status: "True"
reason: Ready
deliveryRef:
name: responsible-ops---cluster-template-after-deployment
kind: ClusterDelivery
resources:
- name: source-provider
stampedRef:
apiVersion: v1
kind: ConfigMap
name: example-source-configmap
templateRef:
apiVersion: carto.run/v1alpha1
kind: ClusterSourceTemplate
name: example-source---cluster-template-after-deployment
outputs:
- name: url
preview: |
"5"
digest: sha256:11fd182657d58787e0e5b61c5da79195f8715fef7f957b9cdba2d8a581b2ca33
- name: revision
preview: |
knitting
digest: sha256:ccea367d03c124f9594e3ba0aa97e533c35a47694f62757e4dce79039ca361d7
conditions:
- type: ResourceSubmitted
status: "True"
reason: ResourceSubmissionComplete
- type: Healthy
status: "True"
reason: AlwaysHealthy
- type: Ready
status: "True"
reason: Ready
- name: deployer
stampedRef:
apiVersion: v1
kind: ConfigMap
name: example-deployment-configmap
templateRef:
apiVersion: carto.run/v1alpha1
kind: ClusterDeploymentTemplate
name: example-deployment---cluster-template-after-deployment
inputs:
- name: source-provider
outputs:
- name: url
preview: |
"5"
digest: sha256:11fd182657d58787e0e5b61c5da79195f8715fef7f957b9cdba2d8a581b2ca33
- name: revision
preview: |
knitting
digest: sha256:ccea367d03c124f9594e3ba0aa97e533c35a47694f62757e4dce79039ca361d7
conditions:
- type: ResourceSubmitted
status: "True"
reason: ResourceSubmissionComplete
- type: Healthy
status: "True"
reason: MatchedField
message: "field value: 5, message: example-deployment-configmap"
- type: Ready
status: "True"
reason: Ready
- name: task
stampedRef:
apiVersion: v1
kind: ConfigMap
name: example-task
templateRef:
apiVersion: carto.run/v1alpha1
kind: ClusterTemplate
name: example-task---cluster-template-after-deployment
inputs:
- name: deployer
conditions:
- type: ResourceSubmitted
status: "True"
reason: ResourceSubmissionComplete
- type: Healthy
status: "True"
reason: AlwaysHealthy
- type: Ready
status: "True"
reason: Ready
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2021 VMware
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: carto.run/v1alpha1
kind: Deliverable
metadata:
name: petclinic
labels:
integration-test: "cluster-template-after-deployment"
spec:
serviceAccountName: my-service-account
source:
git:
url: https://github.com/spring-projects/spring-petclinic.git