-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This action plugin is a direct replacement of the edpm_kustomize role. It takes a path to the file you want to kustomize and applies a set of kustomizations given though it's kustomizations parameter or through file ones placed on the same directory where the target manifest is placed.
- Loading branch information
1 parent
c987b0c
commit 299054e
Showing
24 changed files
with
2,333 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
ci_framework/tests/integration/targets/kustomize/files/a-sorting-kustomization.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-1 | ||
value: "cifmw-label-1-value" | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-2 | ||
value: "cifmw-label-2-value" | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-3 | ||
value: "cifmw-label-3-value" | ||
target: | ||
kind: Deployment |
13 changes: 13 additions & 0 deletions
13
ci_framework/tests/integration/targets/kustomize/files/b-sorting-kustomization.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-1 | ||
value: "cifmw-label-1-value-override-b" | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-2 | ||
value: "cifmw-label-2-value-override-b" | ||
target: | ||
kind: Deployment |
13 changes: 13 additions & 0 deletions
13
ci_framework/tests/integration/targets/kustomize/files/c-sorting-kustomization.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-2 | ||
value: "cifmw-label-2-value-override-c" | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-3 | ||
value: "cifmw-label-3-value-override-c" | ||
target: | ||
kind: Deployment |
10 changes: 10 additions & 0 deletions
10
ci_framework/tests/integration/targets/kustomize/files/cm-kustomization-1.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-1 | ||
value: "cifmw-label-1-value" | ||
target: | ||
kind: ConfigMap |
10 changes: 10 additions & 0 deletions
10
ci_framework/tests/integration/targets/kustomize/files/cm-kustomization-2.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-2 | ||
value: "cifmw-label-2-value" | ||
target: | ||
kind: ConfigMap |
10 changes: 10 additions & 0 deletions
10
ci_framework/tests/integration/targets/kustomize/files/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-1 | ||
value: "cifmw-label-1-value" | ||
target: | ||
kind: Deployment |
10 changes: 10 additions & 0 deletions
10
ci_framework/tests/integration/targets/kustomize/files/kustomization.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-2 | ||
value: "cifmw-label-2-value" | ||
target: | ||
kind: Deployment |
20 changes: 20 additions & 0 deletions
20
...amework/tests/integration/targets/kustomize/files/multiple-kustomizations-in-one-file.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-4 | ||
value: "cifmw-label-4-value" | ||
target: | ||
kind: Deployment | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-5 | ||
value: "cifmw-label-5-value" | ||
target: | ||
kind: Deployment |
10 changes: 10 additions & 0 deletions
10
ci_framework/tests/integration/targets/kustomize/files/single-kustomization-file-1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-3 | ||
value: "cifmw-label-3-value" | ||
target: | ||
kind: Deployment |
10 changes: 10 additions & 0 deletions
10
ci_framework/tests/integration/targets/kustomize/files/single-kustomization-file-2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
patches: | ||
- patch: |- | ||
- op: replace | ||
path: /metadata/labels/cifmw-label-6 | ||
value: "cifmw-label-6-value" | ||
target: | ||
kind: Deployment |
11 changes: 11 additions & 0 deletions
11
ci_framework/tests/integration/targets/kustomize/files/testing-cm.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: testing-cm | ||
labels: | ||
app: test | ||
data: | ||
test1.properties: | | ||
test-var=test-value | ||
test2.properties: | | ||
test-var2=test-value2 |
24 changes: 24 additions & 0 deletions
24
ci_framework/tests/integration/targets/kustomize/files/testing-combined-manifests.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: testing-secret | ||
labels: | ||
app: test | ||
data: | ||
.secret-file: dmFsdWUtMg0KDQo= | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: testing-job | ||
labels: | ||
app: test | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: pi | ||
image: perl:5.34.0 | ||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] | ||
restartPolicy: Never | ||
backoffLimit: 4 |
21 changes: 21 additions & 0 deletions
21
ci_framework/tests/integration/targets/kustomize/files/testing-deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: testing-deployment | ||
labels: | ||
app: nginx | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: nginx | ||
template: | ||
metadata: | ||
labels: | ||
app: nginx | ||
spec: | ||
containers: | ||
- name: nginx | ||
image: nginx:1.14.2 | ||
ports: | ||
- containerPort: 80 |
53 changes: 53 additions & 0 deletions
53
ci_framework/tests/integration/targets/kustomize/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
- name: "Create a directory to download each kustomization tool" | ||
ansible.builtin.tempfile: | ||
state: directory | ||
suffix: cifmw-ci-kustomize-bins-dir | ||
register: _ci_kustomize_temporal_bins_dir | ||
|
||
- name: Set files dir as a fact | ||
vars: | ||
role_test_dir: "{{ ansible_env.HOME }}/code/ansible_collections/cifmw/general/tests/integration/targets/kustomize" | ||
ansible.builtin.set_fact: | ||
ci_kustomize_scenarios_dir_path: "{{ role_test_dir }}/tasks/scenarios" | ||
ci_kustomize_files_dir_path: "{{ role_test_dir }}/files" | ||
ci_kustomize_oc_bin_path: "{{ _ci_kustomize_temporal_bins_dir.path }}/oc" | ||
ci_kustomize_kustomize_bin_path: "{{ _ci_kustomize_temporal_bins_dir.path }}/kustomize" | ||
|
||
- name: Create OC and kustomize binaries path | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
loop: | ||
- "{{ ci_kustomize_oc_bin_path }}" | ||
- "{{ ci_kustomize_kustomize_bin_path }}" | ||
|
||
- name: Fetch oc from OCP mirror | ||
ansible.builtin.unarchive: | ||
src: https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/openshift-client-linux.tar.gz | ||
dest: "{{ ci_kustomize_oc_bin_path }}" | ||
remote_src: true | ||
|
||
- name: Fetch kustomize from sigs Github | ||
ansible.builtin.unarchive: | ||
src: https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.1.1/kustomize_v5.1.1_linux_amd64.tar.gz | ||
dest: "{{ ci_kustomize_kustomize_bin_path }}" | ||
remote_src: true | ||
|
||
- name: Recursively find scenario files | ||
ansible.builtin.find: | ||
paths: "{{ ci_kustomize_scenarios_dir_path }}" | ||
patterns: '*.yml' | ||
register: ci_kustomize_scenarios_find | ||
|
||
- name: Run scenario file | ||
ansible.builtin.include_tasks: "{{ scenario_path }}" | ||
loop: "{{ ci_kustomize_scenarios_find.files | map(attribute='path') }}" | ||
loop_control: | ||
label: "{{ scenario_path }}" | ||
loop_var: "scenario_path" | ||
|
||
- name: "Delete the temporal bins directory" | ||
ansible.builtin.file: | ||
path: "{{ _ci_kustomize_temporal_bins_dir.path }}" | ||
state: absent |
Oops, something went wrong.