Skip to content

Commit b567643

Browse files
Modify nsq and postgres backup restore namespace creation (#511)
1 parent 7714562 commit b567643

File tree

6 files changed

+46
-37
lines changed

6 files changed

+46
-37
lines changed

control-plane/roles/nsq/README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,31 @@ Deploys [nsq](https://nsq.io/) in a standalone configuration.
44

55
The admin console can be reached by using port-forwarding:
66

7-
```
7+
```bash
88
kubectl port-forward -n metal-control-plane svc/nsqadmin 4171
99
```
1010

1111
Adding nsqadmin as a sidecar into the nsqd pod was the only reasonable way to make the admin console work properly in this setup. This is because we enforce certificate authentication via the TCP port but do not use encrypted communication for in-cluster traffic via the HTTP endpoints, which nsadmin does not really like.
1212

1313
## Variables
1414

15-
This role uses variables from [control-plane-defaults](/control-plane). So, make sure you define them adequately as well.
16-
17-
You can look up all the default values of this role [here](defaults/main.yaml).
18-
19-
| Name | Mandatory | Description |
20-
| -------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
21-
| nsq_image_name | yes | Image name of nsq |
22-
| nsq_image_tag | yes | Image version of nsq |
23-
| nsq_set_resource_limits | | Deploys nsq with or without resource limits (possibly disable for development environments) |
24-
| nsq_nsqd_resources | | The kubernetes resources for the actual nsqd container |
25-
| nsq_nsq_lookupd_resources | | The kubernetes resources for the actual nsq lookupd container |
26-
| nsq_log_level | | The nsq log level |
27-
| nsq_broadcast_address | | The nsq broadcast address |
28-
| nsq_nsqd_data_size | | The size of the nsqd data volume (used when memory cache is full) |
29-
| nsq_tls_enabled | | Enables TLS for nsq |
30-
| nsq_certs_client_key | | The nsq certificate client key as a string |
31-
| nsq_certs_client_cert | | The nsq client certificate as a string |
32-
| nsq_certs_ca_cert | | The nsq ca certificate as a string |
33-
| nsq_image_pull_policy | | Image pull policy (defaults to IfNotPresent) |
15+
This role uses variables from [control-plane-defaults](/control-plane/roles/defaults/defaults/main.yaml). So, make sure you define them adequately as well.
16+
17+
You can look up all the default values of this role in the [defaults folder](defaults/main.yaml).
18+
19+
| Name | Mandatory | Description |
20+
| ------------------------- | --------- | ------------------------------------------------------------------------------------------- |
21+
| nsq_image_name | yes | Image name of nsq |
22+
| nsq_image_tag | yes | Image version of nsq |
23+
| nsq_namespace | | The deployment's target namespace |
24+
| nsq_set_resource_limits | | Deploys nsq with or without resource limits (possibly disable for development environments) |
25+
| nsq_nsqd_resources | | The kubernetes resources for the actual nsqd container |
26+
| nsq_nsq_lookupd_resources | | The kubernetes resources for the actual nsq lookupd container |
27+
| nsq_log_level | | The nsq log level |
28+
| nsq_broadcast_address | | The nsq broadcast address |
29+
| nsq_nsqd_data_size | | The size of the nsqd data volume (used when memory cache is full) |
30+
| nsq_tls_enabled | | Enables TLS for nsq |
31+
| nsq_certs_client_key | | The nsq certificate client key as a string |
32+
| nsq_certs_client_cert | | The nsq client certificate as a string |
33+
| nsq_certs_ca_cert | | The nsq ca certificate as a string |
34+
| nsq_image_pull_policy | | Image pull policy (defaults to IfNotPresent) |

control-plane/roles/nsq/defaults/main.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
nsq_namespace: "{{ metal_control_plane_namespace }}"
3+
24
nsq_image_pull_policy: "{{ metal_control_plane_image_pull_policy }}"
35

46
nsq_set_resource_limits: true

control-plane/roles/nsq/tasks/main.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@
1010
- nsq_image_name is defined
1111
- nsq_image_tag is defined
1212

13+
- name: Create namespace
14+
k8s:
15+
state: present
16+
definition:
17+
apiVersion: v1
18+
kind: Namespace
19+
metadata:
20+
name: "{{ nsq_namespace }}"
21+
labels:
22+
name: "{{ nsq_namespace }}"
23+
1324
- name: Deploy nsq
1425
k8s:
1526
definition: "{{ lookup('template', 'nsq.yaml') }}"
16-
namespace: "{{ metal_control_plane_namespace }}"
27+
namespace: "{{ nsq_namespace }}"

control-plane/roles/nsq/templates/nsq.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
---
2-
apiVersion: v1
3-
kind: Namespace
4-
metadata:
5-
name: "{{ metal_control_plane_namespace }}"
6-
labels:
7-
app: "metal-stack-control-plane"
8-
name: "{{ metal_control_plane_namespace }}"
91
{% if nsq_registry_auth_enabled %}
102
---
113
apiVersion: v1

control-plane/roles/postgres-backup-restore/tasks/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414
- postgres_backup_restore_sidecar_encryption_key is none or postgres_backup_restore_sidecar_encryption_key | length == 32
1515
- postgres_backup_restore_sidecar_provider in ["local", "gcp", "s3"]
1616

17+
- name: Create namespace
18+
k8s:
19+
state: present
20+
definition:
21+
apiVersion: v1
22+
kind: Namespace
23+
metadata:
24+
name: "{{ postgres_namespace }}"
25+
labels:
26+
name: "{{ postgres_namespace }}"
27+
1728
- name: Deploy postgres (backup-restore)
1829
k8s:
1930
definition: "{{ lookup('template', 'postgres.yaml') }}"

control-plane/roles/postgres-backup-restore/templates/postgres.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
---
2-
apiVersion: v1
3-
kind: Namespace
4-
metadata:
5-
name: "{{ metal_control_plane_namespace }}"
6-
labels:
7-
app: "metal-stack-control-plane"
8-
name: "{{ metal_control_plane_namespace }}"
91
{% if postgres_registry_auth_enabled %}
102
---
113
apiVersion: v1

0 commit comments

Comments
 (0)