Skip to content

Commit 161b652

Browse files
author
Morven Cao
committed
add certificate rotation e2e test.
Signed-off-by: Morven Cao <lcao@redhat.com>
1 parent 512df4a commit 161b652

9 files changed

Lines changed: 406 additions & 67 deletions

File tree

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ readiness_probe_init_delay_seconds ?= 20
108108
subscription_type ?= shared
109109
agent_topic ?= "\$$share/statussubscribers/sources/maestro/consumers/+/agentevents"
110110

111+
# default client certificate refresh/reload duration for message broker
112+
broker_client_cert_refresh_duration ?= 5m
113+
111114
# Prints a list of useful targets.
112115
help:
113116
@echo ""
@@ -329,6 +332,7 @@ cmds:
329332
--param="READINESS_PROBE_INIT_DELAY_SECONDS"=$(readiness_probe_init_delay_seconds) \
330333
--param="SUBSCRIPTION_TYPE"=$(subscription_type) \
331334
--param="AGENT_TOPIC"=$(agent_topic) \
335+
--param="BROKER_CLIENT_CERT_REFRESH_DURATION"=$(broker_client_cert_refresh_duration) \
332336
> "templates/$*-template.json"
333337

334338

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,6 @@ maestro-grpc NodePort 10.96.114.161 <none> 8090:30090/TCP
354354
maestro-healthcheck ClusterIP 10.96.67.145 <none> 8083/TCP 7m42s
355355
maestro-metrics ClusterIP 10.96.201.253 <none> 8080/TCP 7m42s
356356
maestro-mqtt ClusterIP 10.96.241.85 <none> 1883/TCP 7m59s
357-
maestro-mqtt-agent ClusterIP 10.96.215.21 <none> 1883/TCP 7m59s
358-
maestro-mqtt-server ClusterIP 10.96.72.129 <none> 1883/TCP 7m59s
359357
$ kubectl get pods -n maestro
360358
NAME READY STATUS RESTARTS AGE
361359
maestro-85c847764-4xdt6 1/1 Running 0 5m

templates/agent-template.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,16 @@ parameters:
6363
- name: MQTT_ROOT_CERT
6464
description: Root Certificate for the mqtt broker.
6565

66-
- name: MQTT_CLENT_CERT
66+
- name: MQTT_CLIENT_CERT
6767
description: Client certificate to access the mqtt broker.
6868

69-
- name: MQTT_CLENT_KEY
69+
- name: MQTT_CLIENT_KEY
7070
description: Client private key to access the mqtt broker.
7171

72+
- name: BROKER_CLIENT_CERT_REFRESH_DURATION
73+
description: client certificate refresh duration for message broker
74+
value: "5m"
75+
7276
objects:
7377
- apiVersion: apiextensions.k8s.io/v1
7478
kind: CustomResourceDefinition
@@ -303,6 +307,8 @@ objects:
303307
env:
304308
- name: "MAESTRO_ENV"
305309
value: "${ENVIRONMENT}"
310+
- name: CERT_CALLBACK_REFRESH_DURATION
311+
value: "${BROKER_CLIENT_CERT_REFRESH_DURATION}"
306312
command:
307313
- /usr/local/bin/maestro
308314
- agent
@@ -337,8 +343,8 @@ objects:
337343
username: ${MQTT_USER}
338344
password: ${MQTT_PASSWORD}
339345
caFile: ${MQTT_ROOT_CERT}
340-
clientCertFile: ${MQTT_CLENT_CERT}
341-
clientKeyFile: ${MQTT_CLENT_KEY}
346+
clientCertFile: ${MQTT_CLIENT_CERT}
347+
clientKeyFile: ${MQTT_CLIENT_KEY}
342348
topics:
343349
sourceEvents: sources/maestro/consumers/${CONSUMER_NAME}/sourceevents
344350
agentEvents: sources/maestro/consumers/${CONSUMER_NAME}/agentevents

templates/agent-tls-template.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,16 @@ parameters:
6363
- name: MQTT_ROOT_CERT
6464
description: Root Certificate for the mqtt broker.
6565

66-
- name: MQTT_CLENT_CERT
66+
- name: MQTT_CLIENT_CERT
6767
description: Client certificate to access the mqtt broker.
6868

69-
- name: MQTT_CLENT_KEY
69+
- name: MQTT_CLIENT_KEY
7070
description: Client private key to access the mqtt broker.
7171

72+
- name: BROKER_CLIENT_CERT_REFRESH_DURATION
73+
description: client certificate refresh duration for message broker
74+
value: "5m"
75+
7276
objects:
7377
- apiVersion: apiextensions.k8s.io/v1
7478
kind: CustomResourceDefinition
@@ -303,6 +307,8 @@ objects:
303307
env:
304308
- name: "MAESTRO_ENV"
305309
value: "${ENVIRONMENT}"
310+
- name: CERT_CALLBACK_REFRESH_DURATION
311+
value: "${BROKER_CLIENT_CERT_REFRESH_DURATION}"
306312
command:
307313
- /usr/local/bin/maestro
308314
- agent
@@ -353,8 +359,8 @@ objects:
353359
username: ${MQTT_USER}
354360
password: ${MQTT_PASSWORD}
355361
caFile: ${MQTT_ROOT_CERT}
356-
clientCertFile: ${MQTT_CLENT_CERT}
357-
clientKeyFile: ${MQTT_CLENT_KEY}
362+
clientCertFile: ${MQTT_CLIENT_CERT}
363+
clientKeyFile: ${MQTT_CLIENT_KEY}
358364
topics:
359365
sourceEvents: sources/maestro/consumers/${CONSUMER_NAME}/sourceevents
360366
agentEvents: sources/maestro/consumers/${CONSUMER_NAME}/agentevents

templates/mqtt-tls-template.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,34 +72,6 @@ objects:
7272
status:
7373
loadBalancer: {}
7474

75-
- apiVersion: v1
76-
kind: Service
77-
metadata:
78-
name: ${MQTT_BROKER_NAME}-server
79-
spec:
80-
ports:
81-
- name: mosquitto
82-
port: 1883
83-
protocol: TCP
84-
targetPort: 1883
85-
selector:
86-
name: ${MQTT_BROKER_NAME}
87-
type: ClusterIP
88-
89-
- apiVersion: v1
90-
kind: Service
91-
metadata:
92-
name: ${MQTT_BROKER_NAME}-agent
93-
spec:
94-
ports:
95-
- name: mosquitto
96-
port: 1883
97-
protocol: TCP
98-
targetPort: 1883
99-
selector:
100-
name: ${MQTT_BROKER_NAME}
101-
type: ClusterIP
102-
10375
- kind: Deployment
10476
apiVersion: apps/v1
10577
metadata:

0 commit comments

Comments
 (0)