Skip to content

Commit a6d10c7

Browse files
committed
feat: add istio's bookinfo application
Signed-off-by: Gerard Vanloo <[email protected]>
1 parent 54b4bba commit a6d10c7

File tree

12 files changed

+173
-2
lines changed

12 files changed

+173
-2
lines changed

.github/workflows/sre-integration-smoke-tests.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,44 @@ jobs:
5757
- name: Test access revoking
5858
run: |
5959
make -C sre disable_agent_access
60+
bookinfo:
61+
name: Istio Book Info Smoke Tests
62+
needs:
63+
- istio
64+
runs-on: ubuntu-24.04
65+
steps:
66+
- uses: actions/[email protected]
67+
- uses: actions/[email protected]
68+
with:
69+
python-version: '3.13'
70+
- uses: actions/[email protected]
71+
with:
72+
go-version-file: sre/dev/local_cluster/go.mod
73+
cache-dependency-path: sre/dev/local_cluster/go.sum
74+
- uses: azure/[email protected]
75+
with:
76+
version: v3.18.6
77+
- name: Install Python and Ansible dependencies
78+
run: |
79+
pip install -r sre/requirements.txt
80+
ansible-galaxy install -r sre/requirements.yaml
81+
- name: Create Kind cluster
82+
run: |
83+
make -C sre/dev/local_cluster create_single_node_cluster
84+
- name: Create group vars
85+
run: |
86+
make -C sre group_vars
87+
mv sre/tests/files/istio.yaml sre/group_vars/environment/tools.yaml
88+
mv sre/tests/files/bookinfo.yaml sre/group_vars/environment/applications.yaml
89+
- name: Install tools
90+
run: |
91+
make -C sre deploy_tools
92+
- name: Run installation smoke test
93+
run: |
94+
make -C sre deploy_applications
95+
- name: Run uninstallation smoke test
96+
run: |
97+
make -C sre undeploy_applications
6098
chaos-mesh:
6199
name: Chaos Mesh Smoke Tests
62100
runs-on: ubuntu-24.04
@@ -556,7 +594,7 @@ jobs:
556594
- name: Create group vars
557595
run: |
558596
make -C sre group_vars
559-
mv sre/tests/files/otel-demo.yaml sre/group_vars/environment/tools.yaml
597+
mv sre/tests/files/otel-demo.yaml sre/group_vars/environment/applications.yaml
560598
- name: Install tools
561599
run: |
562600
INCIDENT_NUMBER=1 make -C sre deploy_tools
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
---
22
applications:
3+
bookinfo: true
34
otel_demo: true

sre/playbooks/manage_applications.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
applications_cluster:
4141
kubeconfig: "{{ cluster.kubeconfig }}"
4242
applications_required:
43+
bookinfo:
44+
enabled: "{{ incidents_applications.bookinfo.enabled | default(applications.bookinfo) }}"
4345
otel_demo:
4446
configuration: "{{ incidents_applications.otel_demo.configuration | default({}) }}"
4547
enabled: "{{ incidents_applications.otel_demo.enabled | default(applications.otel_demo) }}"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
applications_instances:
3+
bookinfo:
4+
namespace: bookinfo

sre/roles/applications/meta/argument_specs.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ argument_specs:
2525
required: true
2626
type: dict
2727
options:
28+
bookinfo:
29+
required: false
30+
type: dict
31+
options:
32+
enabled:
33+
required: true
34+
type: bool
2835
otel_demo:
2936
required: true
3037
type: dict

sre/roles/applications/tasks/install.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
ansible.builtin.include_vars:
44
file: ../tools/defaults/main/helm_releases.yaml
55

6+
- name: Import Book Info installation tasks
7+
ansible.builtin.import_tasks:
8+
file: install_bookinfo.yaml
9+
when:
10+
- applications_required.bookinfo is defined
11+
- applications_required.bookinfo.enabled
12+
613
- name: Import OpenTelemetry Demo installation tasks
714
ansible.builtin.import_tasks:
815
file: install_otel_demo.yaml
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
- name: Create temporary directory for Git checkout
3+
ansible.builtin.tempfile:
4+
prefix: bookinfo
5+
state: directory
6+
register: applications_temporary_directory
7+
8+
- name: Checkout Istio repository using Git
9+
ansible.builtin.git:
10+
repo: https://github.com/istio/istio.git
11+
dest: "{{ applications_temporary_directory.path }}"
12+
version: 1.27.3
13+
when:
14+
- applications_temporary_directory is defined
15+
16+
- name: Create the release namespace
17+
kubernetes.core.k8s:
18+
kubeconfig: "{{ applications_cluster.kubeconfig }}"
19+
resource_definition:
20+
apiVersion: v1
21+
kind: Namespace
22+
metadata:
23+
name: "{{ applications_instances.bookinfo.namespace }}"
24+
labels:
25+
istio.io/dataplane-mode: ambient
26+
it-bench/monitoring: "true"
27+
state: present
28+
29+
- name: Create BookInfo Kubernetes objects
30+
kubernetes.core.k8s:
31+
kubeconfig: "{{ applications_cluster.kubeconfig }}"
32+
namespace: "{{ applications_instances.bookinfo.namespace }}"
33+
state: present
34+
src: "{{ applications_temporary_directory.path }}/{{ manifest_file_path }}"
35+
loop:
36+
- samples/bookinfo/platform/kube/bookinfo.yaml
37+
- samples/bookinfo/platform/kube/bookinfo-versions.yaml
38+
- samples/bookinfo/networking/bookinfo-gateway.yaml
39+
loop_control:
40+
label: manifest/{{ manifest_file_path | basename }}
41+
loop_var: manifest_file_path
42+
when:
43+
- applications_temporary_directory is defined
44+
45+
- name: Delete the temporary directory
46+
ansible.builtin.file:
47+
path: "{{ applications_temporary_directory.path }}"
48+
state: absent
49+
when:
50+
- applications_temporary_directory is defined

sre/roles/applications/tasks/uninstall.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
---
2+
- name: Import Istio's BookInfo uninstallation tasks
3+
ansible.builtin.import_tasks:
4+
file: uninstall_bookinfo.yaml
5+
when:
6+
- applications_required.bookinfo is defined
7+
- applications_required.bookinfo.enabled
8+
29
- name: Import OpenTelemetry Demo uninstallation tasks
310
ansible.builtin.import_tasks:
411
file: uninstall_otel_demo.yaml
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
---
3+
- name: Create temporary directory for Git checkout
4+
ansible.builtin.tempfile:
5+
prefix: bookinfo
6+
state: directory
7+
register: applications_temporary_directory
8+
9+
- name: Checkout Istio repository using Git
10+
ansible.builtin.git:
11+
repo: https://github.com/istio/istio.git
12+
dest: "{{ applications_temporary_directory.path }}"
13+
version: 1.27.3
14+
when:
15+
- applications_temporary_directory is defined
16+
17+
- name: Delete BookInfo Kubernetes objects
18+
kubernetes.core.k8s:
19+
kubeconfig: "{{ applications_cluster.kubeconfig }}"
20+
namespace: "{{ applications_instances.bookinfo.namespace }}"
21+
state: absent
22+
src: "{{ applications_temporary_directory.path }}/{{ manifest_file_path }}"
23+
loop:
24+
- samples/bookinfo/platform/kube/bookinfo.yaml
25+
- samples/bookinfo/platform/kube/bookinfo-versions.yaml
26+
- samples/bookinfo/networking/bookinfo-gateway.yaml
27+
loop_control:
28+
label: manifest/{{ manifest_file_path | basename }}
29+
loop_var: manifest_file_path
30+
when:
31+
- applications_temporary_directory is defined
32+
33+
- name: Delete the release namespace
34+
kubernetes.core.k8s:
35+
kubeconfig: "{{ applications_cluster.kubeconfig }}"
36+
resource_definition:
37+
apiVersion: v1
38+
kind: Namespace
39+
metadata:
40+
name: "{{ applications_instances.bookinfo.namespace }}"
41+
state: absent
42+
43+
- name: Delete the temporary directory
44+
ansible.builtin.file:
45+
path: "{{ applications_temporary_directory.path }}"
46+
state: absent
47+
when:
48+
- applications_temporary_directory is defined

sre/roles/incidents/tasks/main.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
- name: Create variables for Ansible role usage
2727
ansible.builtin.set_fact:
2828
incidents_applications:
29+
bookinfo:
30+
enabled: "{{ incidents_spec.scenario.spec.environment.applications.bookinfo.enabled | default(false) }}"
2931
otel_demo:
3032
configuration: "{{ incidents_spec.scenario.spec.environment.applications.otel_demo.configuration | default({}) }}"
31-
enabled: "{{ incidents_spec.scenario.spec.environment.applications.otel_demo.enabled }}"
33+
enabled: "{{ incidents_spec.scenario.spec.environment.applications.otel_demo.enabled | default(true) }}"
3234
incidents_tools:
3335
chaos_mesh: "{{ 'chaos-mesh' in incidents_spec.scenario.spec.environment.tools.selected }}"
3436
clickhouse: "{{ 'clickhouse' in incidents_spec.scenario.spec.environment.tools.selected or true }}"

0 commit comments

Comments
 (0)