Skip to content

Commit eae5a8b

Browse files
Merge pull request #5 from InformaticsMatters/sc-2884
Cluster-wide operator
2 parents 8a35f49 + b60f91f commit eae5a8b

30 files changed

+191
-156
lines changed

.github/workflows/build-latest.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030
steps:
3131
- name: Checkout
3232
uses: actions/checkout@v2
33-
- name: Set up Python 3.9
33+
- name: Set up Python 3.10
3434
uses: actions/setup-python@v2
3535
with:
36-
python-version: 3.9
36+
python-version: '3.10'
3737
- name: Install dependencies
3838
run: |
3939
python -m pip install --upgrade pip
@@ -45,6 +45,10 @@ jobs:
4545
pre-commit run --all-files
4646
pylint operator/*.py
4747
ansible-lint
48+
- name: Set up QEMU
49+
uses: docker/setup-qemu-action@v1
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v1
4852
- name: Login to DockerHub
4953
uses: docker/login-action@v1
5054
with:
@@ -54,5 +58,6 @@ jobs:
5458
uses: docker/build-push-action@v2
5559
with:
5660
context: operator
61+
platforms: linux/amd64,linux/arm64
5762
push: true
5863
tags: informaticsmatters/data-manager-jupyter-operator:latest

.github/workflows/build-stable.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ jobs:
3636
uses: actions/checkout@v2
3737
- name: Inject slug/short variables
3838
uses: rlespinasse/[email protected]
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v1
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v1
3943
- name: Login to DockerHub
4044
uses: docker/login-action@v1
4145
with:
@@ -45,6 +49,7 @@ jobs:
4549
uses: docker/build-push-action@v2
4650
with:
4751
context: operator
52+
platforms: linux/amd64,linux/arm64
4853
push: true
4954
tags: |
5055
informaticsmatters/data-manager-jupyter-operator:${{ env.GITHUB_REF_SLUG }}

.github/workflows/build-tag.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
uses: actions/checkout@v2
3333
- name: Inject slug/short variables
3434
uses: rlespinasse/[email protected]
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v1
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v1
3539
- name: Login to DockerHub
3640
uses: docker/login-action@v1
3741
with:
@@ -41,5 +45,6 @@ jobs:
4145
uses: docker/build-push-action@v2
4246
with:
4347
context: operator
48+
platforms: linux/amd64,linux/arm64
4449
push: true
4550
tags: informaticsmatters/data-manager-jupyter-operator:${{ env.GITHUB_REF_SLUG }}

.github/workflows/build.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jobs:
3232
steps:
3333
- name: Checkout
3434
uses: actions/checkout@v2
35-
- name: Set up Python 3.9
35+
- name: Set up Python 3.10
3636
uses: actions/setup-python@v2
3737
with:
38-
python-version: 3.9
38+
python-version: '3.10'
3939
- name: Install dependencies
4040
run: |
4141
python -m pip install --upgrade pip
@@ -46,7 +46,12 @@ jobs:
4646
run: |
4747
pre-commit run --all-files
4848
ansible-lint
49+
- name: Set up QEMU
50+
uses: docker/setup-qemu-action@v1
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v1
4953
- name: Build
5054
uses: docker/build-push-action@v2
5155
with:
5256
context: operator
57+
platforms: linux/amd64,linux/arm64

README.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
[![Data Manager: Application](https://img.shields.io/badge/data%20manager-application-000000?labelColor=dc332e)]()
44
[![Dev Stage: 1](https://img.shields.io/badge/dev%20stage-★☆☆%20%281%29-000000?labelColor=dc332e)](https://github.com/InformaticsMatters/code-repository-development-stages)
55

6+
![Architecture](https://img.shields.io/badge/architecture-amd64%20%7C%20arm64-lightgrey)
7+
68
[![build](https://github.com/informaticsmatters/data-manager-jupyter-operator/actions/workflows/build.yaml/badge.svg)](https://github.com/informaticsmatters/data-manager-jupyter-operator/actions/workflows/build.yaml)
79
[![build latest](https://github.com/informaticsmatters/data-manager-jupyter-operator/actions/workflows/build-latest.yaml/badge.svg)](https://github.com/informaticsmatters/data-manager-jupyter-operator/actions/workflows/build-latest.yaml)
810
[![build tag](https://github.com/informaticsmatters/data-manager-jupyter-operator/actions/workflows/build-tag.yaml/badge.svg)](https://github.com/informaticsmatters/data-manager-jupyter-operator/actions/workflows/build-tag.yaml)
@@ -59,40 +61,41 @@ current health of your clone with: -
5961
The operator container, residing in the `operator` directory,
6062
is automatically built and pushed to Docker Hub using GitHub Actions.
6163

62-
You can build the image yourself using docker-compose.
63-
The following will build an operator image with the tag `19.0.0-alpha.1`: -
64+
You can build and push the image yourself using docker-compose.
65+
The following will build an operator image with the tag `19.2.0-alpha.1`: -
6466

65-
$ export IMAGE_TAG=19.0.0-alpha.1
66-
$ docker-compose build
67+
export IMAGE_TAG=19.2.0-alpha.1
68+
docker-compose build
69+
dcoker-compose push
6770

6871
## Deploying into the Data Manager API
6972
We use [Ansible] 3 and community modules in [Ansible Galaxy] as the deployment
7073
mechanism, using the `operator` Ansible role in this repository and a
7174
Kubernetes config (KUBECONFIG). All of this is done via a suitable Python
7275
environment using the requirements in the root of the project...
7376

74-
$ python -m venv ~/.venv/data-manager-jupyter-operator
75-
$ source ~/.venv/data-manager-jupyter-operator/bin/activate
76-
$ pip install --upgrade pip
77-
$ pip install -r requirements.txt
78-
$ ansible-galaxy install -r requirements.yaml
77+
python -m venv venv
78+
source venv/bin/activate
79+
pip install --upgrade pip
80+
pip install -r requirements.txt
81+
ansible-galaxy install -r requirements.yaml
7982

8083
Set your KUBECONFIG for the cluster and verify its right: -
8184

82-
$ export KUBECONFIG=~/k8s-config/local-config
83-
$ kubectl get no
85+
export KUBECONFIG=~/k8s-config/local-config
86+
kubectl get no
8487
[...]
8588

8689
Now, create a parameter file (i.e. `parameters.yaml`) based on the project's
8790
`example-parameters.yaml`, setting values for the operator that match your
8891
needs. Then deploy, using Ansible, from the root of the project: -
8992

90-
$ export PARAMS=parameters
91-
$ ansible-playbook -e @${PARAMS}.yaml site.yaml
93+
export PARAMS=parameters
94+
ansible-playbook -e @${PARAMS}.yaml site.yaml
9295

9396
To remove the operator (assuming there are no operator-derived instances)...
9497

95-
$ ansible-playbook -e @${PARAMS}.yaml -e jo_state=absent site.yaml
98+
ansible-playbook -e @${PARAMS}.yaml -e jo_state=absent site.yaml
9699

97100
> The current Data Manager API assumes that once an Application (operator)
98101
has been installed it is not removed. So, removing the operator here
@@ -105,9 +108,9 @@ are held in this repository.
105108

106109
To deploy: -
107110

108-
$ export KUBECONFIG=~/k8s-config/config-aws-im-main-eks
109-
$ export PARAMS=staging
110-
$ ansible-playbook -e @${PARAMS}-parameters.yaml site.yaml
111+
export KUBECONFIG=~/k8s-config/config-aws-im-main-eks
112+
export PARAMS=staging
113+
ansible-playbook -e @${PARAMS}-parameters.yaml site.yaml
111114

112115
> You will need the vault password, held in the company's KeePass under
113116
`data-manager-jupyter-operator -> Ansible Vault Password`
@@ -162,7 +165,7 @@ Data Manager's **Namespace**.
162165
Typical **Role** and **RoleBinding** definitions are provided in this
163166
repository. Once you define yours you'll just need to create them: -
164167

165-
$ kubectl create -f data-manager-rbac.yaml
168+
kubectl create -f data-manager-rbac.yaml
166169

167170
With this done the application should be visible through the Data Manager API's
168171
**/application** REST endpoint.

doc/LOCAL-DEPLOYMENT.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ You will now need: -
99

1010
- This repository (but you'll have that already)
1111
- Python 3
12-
- [lens]
12+
- A [kubectl] that matches your cluster
1313

1414
## Create an environment for the Ansible playbooks
1515
You will need a Python virtual environment for ansible playbook execution.
@@ -18,17 +18,16 @@ this one.
1818

1919
You must use Python 3: -
2020

21-
python -m venv ~/.venv/ansible
21+
python -m venv venv
2222

23-
source ~/.venv/ansible/bin/activate
24-
pip install wheel
23+
source venv/bin/activate
2524
pip install -r requirements.txt
2625

2726
## Deploy the Jupyter Operator
2827
From the root of your clone of the `data-manager-jupyter-operator` repository,
2928
and within the Ansible environment you created in the previous step,
30-
create a suitable Ansible parameter file called `parameters.yaml` using the
31-
`parameters-template.yaml` file as a guide, replacing the `SetMe` lines.
29+
copy the `local-parameters.yaml` file to `parameters.yaml` and change the variables
30+
to suit your local cluster.
3231

3332
> You will need a KUBECONFIG file, and refer to it using the `jo_kubeconfig`
3433
variable and make sure `kubectl get no` returns nodes you expect.
@@ -37,10 +36,18 @@ Now deploy the Job Operator: -
3736

3837
ansible-playbook site.yaml -e @parameters.yaml
3938

40-
> You can check the deployment progress using [Lens].
39+
The operator should deploy to the namespace `data-manager-jupyter-operator`.
40+
Run: -
41+
42+
kubectl get po -n data-manager-jupyter-operator
43+
44+
To see something like this...
45+
46+
NAME READY STATUS RESTARTS AGE
47+
jupyter-operator-6895bc77f9-9pg44 1/1 Running 0 35s
4148

4249
---
4350

4451
[docker desktop]: https://www.docker.com/products/docker-desktop
45-
[lens]: https://k8slens.dev
46-
[minikube]: https://minikube.sigs.k8s.io/docs/start/
52+
[kubectl]: https://kubernetes.io/docs/tasks/tools
53+
[minikube]: https://minikube.sigs.k8s.io/docs/start

docker-compose.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
# You can control some of the behaviour of the build
66
# with environment variables: -
77
#
8-
# - IMAGE_TAG The image version tag (default 19.0.0)
8+
# - IMAGE_TAG The image version tag (default 19.2.0)
99
#
1010
# Note: The image tag MUST use the major version of the
1111
# kubernetes package the operator is built against.
1212
# The minor/patch values are free for your use.
1313
#
1414
# i.e.: -
1515
#
16-
# IMAGE_TAG=19.0.0-alpha.1 docker-compose build
17-
# IMAGE_TAG=19.0.0-alpha.1 docker-compose push
16+
# IMAGE_TAG=19.3.0-alpha.1 docker-compose build
17+
# IMAGE_TAG=19.3.0-alpha.1 docker-compose push
1818

1919
version: '3.8'
2020

2121
services:
2222
operator:
2323
build:
2424
context: operator
25-
image: informaticsmatters/data-manager-jupyter-operator:${IMAGE_TAG:-19.0.0}
25+
image: informaticsmatters/data-manager-jupyter-operator:${IMAGE_TAG:-19.2.0}

docker-desktop-parameters.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
jo_ingress_domain: kubernetes.docker.internal
44
jo_ingress_tls_secret: data-manager-api-tls
55
jo_dmapi_namespace: data-manager-api
6-
jo_image_tag: 19.1.2
6+
jo_image_tag: 19.2.0
77
jo_namespaces: data-manager-api
88

99
jo_kubeconfig: "{{ lookup('env', 'KUBECONFIG') }}"

integration-parameters.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
22

3+
jo_image_tag: 19.2.0
4+
jo_dmapi_namespace: data-manager-api-integration
5+
36
jo_ingress_domain: squonk.it
47
jo_ingress_tls_secret: data-manager-api-tls
5-
jo_dmapi_name: integration
6-
jo_image_tag: 19.0.2
78
jo_namespaces: data-manager-api-staging:data-manager-api-integration:data-manager-api-production
89

910
jo_kubeconfig: "{{ lookup('env', 'KUBECONFIG') }}"

local-parameters.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
3+
jo_image_tag: 19.2.0
4+
jo_ingress_domain: kubernetes.docker.internal
5+
jo_dmapi_namespace: data-manager-api
6+
7+
# The Kubernetes config file
8+
jo_kubeconfig: ~/k8s-config/config-local

0 commit comments

Comments
 (0)