Skip to content

Commit 7b118dd

Browse files
author
Alan Christie
committed
ci: DM objects now part of separate play (site_dm)
1 parent 6d314bb commit 7b118dd

File tree

7 files changed

+79
-38
lines changed

7 files changed

+79
-38
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ needs. Then deploy, using Ansible, from the root of the project: -
9393
export PARAMS=parameters
9494
ansible-playbook -e @${PARAMS}.yaml site.yaml
9595

96+
That deploys the operator and its CRD to your chosen operator namespace.
97+
To deploy the Data Manager RBAC objects you need to run the
98+
`site_dm.yaml` playbook: -
99+
100+
ansible-playbook -e @${PARAMS}.yaml site_dm.yaml
101+
102+
> If deploying to multiple Data Managers you should just need one operator
103+
and then deploy RBACs to each DM namespace. Remember to also adjust the
104+
annotations of for CRD so each DM namespace recognises it as a valid
105+
application.
106+
96107
To remove the operator (assuming there are no operator-derived instances)...
97108

98109
ansible-playbook -e @${PARAMS}.yaml -e jo_state=absent site.yaml

roles/operator/tasks/deploy.yaml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,5 @@
11
---
22

3-
# Check the Data Manager Namespace and Service Account exists...
4-
5-
- name: Get Data Manager Namespace ({{ jo_dmapi_namespace }})
6-
kubernetes.core.k8s_info:
7-
kind: Namespace
8-
name: "{{ jo_dmapi_namespace }}"
9-
register: ns_result
10-
11-
- name: Assert Namespace ({{ jo_dmapi_namespace }})
12-
assert:
13-
that:
14-
- ns_result.resources|length == 1
15-
16-
- name: Get Data Manager ServiceAccount
17-
kubernetes.core.k8s_info:
18-
kind: ServiceAccount
19-
name: data-manager
20-
namespace: "{{ jo_dmapi_namespace }}"
21-
register: sa_result
22-
23-
- name: Assert ServiceAccount
24-
assert:
25-
that:
26-
- sa_result.resources|length == 1
27-
28-
- name: Deploy Data Manager API Operator RBAC
29-
kubernetes.core.k8s:
30-
definition: "{{ lookup('template', 'rbac-data-manager.yaml.j2') }}"
31-
wait: yes
32-
33-
# Now we can (safely) deploy the operator
34-
353
- name: Deploy CRD
364
kubernetes.core.k8s:
375
definition: "{{ lookup('template', 'crd.yaml.j2') }}"

roles/operator/tasks/dm.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
3+
# A ply to deploy objects to the chosen Data Manager namespace.
4+
# In this case it's a Role and RoleBinding
5+
6+
- include_tasks: prep.yaml
7+
8+
# Check the Data Manager Namespace and Service Account exists...
9+
10+
- name: Deploy DataManager RBAC objects
11+
block:
12+
13+
- name: Get Data Manager Namespace ({{ jo_dmapi_namespace }})
14+
kubernetes.core.k8s_info:
15+
kind: Namespace
16+
name: "{{ jo_dmapi_namespace }}"
17+
register: ns_result
18+
19+
- name: Assert Namespace ({{ jo_dmapi_namespace }})
20+
assert:
21+
that:
22+
- ns_result.resources|length == 1
23+
24+
- name: Get Data Manager ServiceAccount
25+
kubernetes.core.k8s_info:
26+
kind: ServiceAccount
27+
name: data-manager
28+
namespace: "{{ jo_dmapi_namespace }}"
29+
register: sa_result
30+
31+
- name: Assert ServiceAccount
32+
assert:
33+
that:
34+
- sa_result.resources|length == 1
35+
36+
- name: Deploy Data Manager API Operator RBAC
37+
kubernetes.core.k8s:
38+
definition: "{{ lookup('template', 'rbac-data-manager.yaml.j2') }}"
39+
wait: yes
40+
41+
module_defaults:
42+
group/k8s:
43+
kubeconfig: "{{ jo_kubeconfig }}"

roles/operator/tasks/main.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
- include_tasks: prep.yaml
44

5+
- name: Assert operator version defined
6+
assert:
7+
that:
8+
- jo_image_tag|length > 0
9+
- jo_image_tag != 'SetMe'
10+
511
- name: Deploy using Kubernetes config
612
block:
713

roles/operator/tasks/prep.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,3 @@
2323
that:
2424
- jo_kubeconfig|length > 0
2525
- jo_kubeconfig != 'SetMe'
26-
27-
- name: Assert operator version defined
28-
assert:
29-
that:
30-
- jo_image_tag|length > 0
31-
- jo_image_tag != 'SetMe'

site_dm.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- hosts: localhost
3+
tasks:
4+
- include_role:
5+
name: operator
6+
tasks_from: dm.yaml

xchem-dev-test-parameters.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
3+
jo_image_tag: 19.2.1
4+
jo_dmapi_namespace: data-manager-api-test
5+
6+
jo_ingress_domain: data-manager.xchem-dev.diamond.ac.uk
7+
jo_ingress_tls_secret: data-manager-api-tls
8+
jo_namespaces: data-manager-api-dev:data-manager-api-integration:data-manager-api-test
9+
jo_pod_node_selector_key: informaticsmatters.com/purpose
10+
jo_pod_node_selector_value: core
11+
jo_fallback_node_selector_key: informaticsmatters.com/purpose
12+
13+
jo_kubeconfig: "{{ lookup('env', 'KUBECONFIG') }}"

0 commit comments

Comments
 (0)