Skip to content

Commit 8c93e2e

Browse files
authored
Merge pull request #41 from stolostron/pr-40
Merge upstream (5d24636)
2 parents 65c8e46 + 01dcc59 commit 8c93e2e

File tree

198 files changed

+7546
-10783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+7546
-10783
lines changed

.github/workflows/e2e.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- main
88

99
env:
10-
GO_VERSION: '1.21'
10+
GO_VERSION: '1.23'
1111
GO_REQUIRED_MIN_VERSION: ''
1212

1313
permissions:
@@ -47,7 +47,7 @@ jobs:
4747
make e2e-test
4848
env:
4949
container_tool: docker
50-
SERVER_REPLICAS: 2
50+
SERVER_REPLICAS: 3
5151
ENABLE_BROADCAST_SUBSCRIPTION: true
5252
e2e-grpc-broker:
5353
runs-on: ubuntu-22.04
@@ -65,4 +65,22 @@ jobs:
6565
make e2e-test
6666
env:
6767
container_tool: docker
68+
SERVER_REPLICAS: 2
6869
MESSAGE_DRIVER_TYPE: grpc
70+
migration:
71+
runs-on: ubuntu-22.04
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v4
75+
- name: Setup Go
76+
uses: actions/setup-go@v5
77+
with:
78+
go-version: ${{ env.GO_VERSION }}
79+
- name: install ginkgo
80+
run: go install github.com/onsi/ginkgo/v2/[email protected]
81+
- name: Test E2E
82+
run: |
83+
make migration-test
84+
env:
85+
container_tool: docker
86+
SERVER_REPLICAS: 2

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
# Ignore built binaries
3333
/maestro
34+
/maestroperf
3435

3536
# Ignore generated templates
3637
/templates/*-template.json
@@ -58,6 +59,7 @@ test/e2e/.consumer_id
5859
test/e2e/.consumer_name
5960
test/e2e/.external_host_ip
6061
test/e2e/report/*
62+
test/e2e/certs
6163
unit-test-results.json
62-
integration-test-results.json
64+
*integration-test-results.json
6365
test/e2e/setup/aro/aro-hcp

.tekton/integration-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ spec:
4848
dnf -y install jq git make
4949
5050
# Install golang with a given version
51-
export GOVERSION=1.22.5
51+
export GOVERSION=1.23.4
5252
curl -O -J https://dl.google.com/go/go$GOVERSION.linux-amd64.tar.gz
5353
rm -rf /usr/local/go && tar -C /usr/local -xzf go$GOVERSION.linux-amd64.tar.gz
5454
@@ -110,7 +110,7 @@ spec:
110110
)
111111
echo -n "$TEST_OUTPUT" | tee $(results.TEST_OUTPUT.path)
112112
sidecars:
113-
- image: docker.io/library/postgres:17.2
113+
- image: quay.io/maestro/postgres:17.2
114114
name: database-test
115115
env:
116116
- name: PGDATA
@@ -124,7 +124,7 @@ spec:
124124
volumeMounts:
125125
- mountPath: /work
126126
name: pgdata
127-
- image: docker.io/library/eclipse-mosquitto:2.0.20
127+
- image: quay.io/maestro/eclipse-mosquitto:2.0.20
128128
name: mqtt-test
129129
volumeMounts:
130130
- mountPath: /mosquitto/data

.tekton/unit-test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ spec:
4848
dnf -y install jq git make
4949
5050
# Install golang with a given version
51-
export GOVERSION=1.22.5
51+
export GOVERSION=1.23.4
5252
curl -O -J https://dl.google.com/go/go$GOVERSION.linux-amd64.tar.gz
5353
rm -rf /usr/local/go && tar -C /usr/local -xzf go$GOVERSION.linux-amd64.tar.gz
5454
@@ -110,7 +110,7 @@ spec:
110110
)
111111
echo -n "$TEST_OUTPUT" | tee $(results.TEST_OUTPUT.path)
112112
sidecars:
113-
- image: docker.io/library/postgres:17.2
113+
- image: quay.io/maestro/postgres:17.2
114114
name: database-test
115115
env:
116116
- name: PGDATA
@@ -124,7 +124,7 @@ spec:
124124
volumeMounts:
125125
- mountPath: /work
126126
name: pgdata
127-
- image: docker.io/library/eclipse-mosquitto:2.0.20
127+
- image: quay.io/maestro/eclipse-mosquitto:2.0.20
128128
name: mqtt-test
129129
volumeMounts:
130130
- mountPath: /mosquitto/data

Containerfile.rhtap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.22 AS builder
1+
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.23 AS builder
22

33
ENV SOURCE_DIR=/maestro
44
WORKDIR $SOURCE_DIR

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.ci.openshift.org/stolostron/builder:go1.22-linux AS builder
1+
FROM registry.ci.openshift.org/stolostron/builder:go1.23-linux AS builder
22

33
ENV SOURCE_DIR=/maestro
44
WORKDIR $SOURCE_DIR

Dockerfile.openapi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM openapitools/openapi-generator-cli:v7.10.0
1+
FROM openapitools/openapi-generator-cli:v7.12.0
22

33
RUN apt-get update
44
RUN apt-get install -y make sudo git

Makefile

Lines changed: 66 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,20 @@ db_user:=maestro
5050
db_password:=foobar-bizz-buzz
5151
db_password_file=${PWD}/secrets/db.password
5252
db_sslmode:=disable
53-
db_image?=docker.io/library/postgres:14.2
53+
db_image?=quay.io/maestro/postgres:17.2
5454

5555
# Message broker connection details
56-
mqtt_host=maestro-mqtt.$(namespace)
57-
mqtt_port=1883
58-
mqtt_user:=maestro
59-
mqtt_password_file=${PWD}/secrets/mqtt.password
60-
mqtt_config_file=${PWD}/secrets/mqtt.config
56+
mqtt_host ?= maestro-mqtt.$(namespace)
57+
mqtt_port ?= 1883
58+
mqtt_user ?= maestro
59+
mqtt_password_file ?= ${PWD}/secrets/mqtt.password
60+
mqtt_config_file ?= ${PWD}/secrets/mqtt.config
61+
mqtt_root_cert ?= ""
62+
mqtt_client_cert ?= ""
63+
mqtt_client_key ?= ""
6164

6265
# Log verbosity level
63-
klog_v:=10
66+
klog_v:=4
6467

6568
# Location of the JSON web key set used to verify tokens:
6669
jwks_url:=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/certs
@@ -76,7 +79,7 @@ CLIENT_SECRET ?= maestro
7679
ENABLE_JWT ?= true
7780
ENABLE_AUTHZ ?= true
7881
ENABLE_OCM_MOCK ?= false
79-
ENABLE_GRPC_SERVER ?= false
82+
ENABLE_GRPC_SERVER ?= true
8083

8184
# message driver type, mqtt or grpc, default is mqtt.
8285
MESSAGE_DRIVER_TYPE ?= mqtt
@@ -85,12 +88,27 @@ MESSAGE_DRIVER_TYPE ?= mqtt
8588
SERVER_REPLICAS ?= 1
8689

8790
# Enable set images
88-
POSTGRES_IMAGE ?= docker.io/library/postgres:14.2
89-
MQTT_IMAGE ?= docker.io/library/eclipse-mosquitto:2.0.18
91+
POSTGRES_IMAGE ?= quay.io/maestro/postgres:17.2
92+
MQTT_IMAGE ?= quay.io/maestro/eclipse-mosquitto:2.0.18
9093

9194
# Test output files
9295
unit_test_json_output ?= ${PWD}/unit-test-results.json
93-
integration_test_json_output ?= ${PWD}/integration-test-results.json
96+
mqtt_integration_test_json_output ?= ${PWD}/mqtt-integration-test-results.json
97+
grpc_integration_test_json_output ?= ${PWD}/grpc-integration-test-results.json
98+
99+
# maestro services config
100+
maestro_svc_type ?= ClusterIP
101+
maestro_svc_node_port ?= 0
102+
grpc_svc_type ?= ClusterIP
103+
grpc_svc_node_port ?= 0
104+
105+
# maestro deployment config
106+
liveness_probe_init_delay_seconds ?= 15
107+
readiness_probe_init_delay_seconds ?= 20
108+
109+
# subscription config
110+
subscription_type ?= shared
111+
agent_topic ?= "\$$share/statussubscribers/sources/maestro/consumers/+/agentevents"
94112

95113
# Prints a list of useful targets.
96114
help:
@@ -117,7 +135,7 @@ help:
117135

118136
# Encourage consistent tool versions
119137
OPENAPI_GENERATOR_VERSION:=5.4.0
120-
GO_VERSION:=go1.22.
138+
GO_VERSION:=go1.23.
121139

122140
### Constants:
123141
version:=$(shell date +%s)
@@ -126,11 +144,11 @@ GOLANGCI_LINT_BIN:=$(shell go env GOPATH)/bin/golangci-lint
126144
### Envrionment-sourced variables with defaults
127145
# Can be overriden by setting environment var before running
128146
# Example:
129-
# OCM_ENV=testing make run
130-
# export OCM_ENV=testing; make run
147+
# MAESTRO_ENV=testing make run
148+
# export MAESTRO_ENV=testing; make run
131149
# Set the environment to development by default
132-
ifndef OCM_ENV
133-
OCM_ENV:=development
150+
ifndef MAESTRO_ENV
151+
MAESTRO_ENV:=development
134152
endif
135153

136154
ifndef TEST_SUMMARY_FORMAT
@@ -203,7 +221,7 @@ install: check-gopath
203221
# Examples:
204222
# make test TESTFLAGS="-run TestSomething"
205223
test:
206-
OCM_ENV=testing gotestsum --jsonfile-timing-events=$(unit_test_json_output) --format $(TEST_SUMMARY_FORMAT) -- -p 1 -v $(TESTFLAGS) \
224+
MAESTRO_ENV=testing gotestsum --jsonfile-timing-events=$(unit_test_json_output) --format $(TEST_SUMMARY_FORMAT) -- -p 1 -v $(TESTFLAGS) \
207225
./pkg/... \
208226
./cmd/...
209227
.PHONY: test
@@ -218,11 +236,19 @@ test:
218236
# make test-integration TESTFLAGS="-run TestAccounts" acts as TestAccounts* and run TestAccountsGet, TestAccountsPost, etc.
219237
# make test-integration TESTFLAGS="-run TestAccountsGet" runs TestAccountsGet
220238
# make test-integration TESTFLAGS="-short" skips long-run tests
221-
test-integration:
222-
OCM_ENV=testing gotestsum --jsonfile-timing-events=$(integration_test_json_output) --format $(TEST_SUMMARY_FORMAT) -- -p 1 -ldflags -s -v -timeout 1h $(TESTFLAGS) \
223-
./test/integration
239+
test-integration: test-integration-mqtt test-integration-grpc
224240
.PHONY: test-integration
225241

242+
test-integration-mqtt:
243+
BROKER=mqtt MAESTRO_ENV=testing gotestsum --jsonfile-timing-events=$(mqtt_integration_test_json_output) --format $(TEST_SUMMARY_FORMAT) -- -p 1 -ldflags -s -v -timeout 1h $(TESTFLAGS) \
244+
./test/integration
245+
.PHONY: test-integration-mqtt
246+
247+
test-integration-grpc:
248+
BROKER=grpc MAESTRO_ENV=testing gotestsum --jsonfile-timing-events=$(grpc_integration_test_json_output) --format $(TEST_SUMMARY_FORMAT) -- -p 1 -ldflags -s -v -timeout 1h $(TESTFLAGS) \
249+
./test/integration
250+
.PHONY: test-integration-grpc
251+
226252
# Regenerate openapi client and models
227253
generate:
228254
rm -rf pkg/api/openapi
@@ -269,7 +295,7 @@ cmds:
269295
--filename="templates/$*-template.yml" \
270296
--local="true" \
271297
--ignore-unknown-parameters="true" \
272-
--param="ENVIRONMENT=$(OCM_ENV)" \
298+
--param="ENVIRONMENT=$(MAESTRO_ENV)" \
273299
--param="KLOG_V=$(klog_v)" \
274300
--param="SERVER_REPLICAS=$(SERVER_REPLICAS)" \
275301
--param="DATABASE_HOST=$(db_host)" \
@@ -283,9 +309,9 @@ cmds:
283309
--param="MQTT_PORT=$(mqtt_port)" \
284310
--param="MQTT_USER=$(mqtt_user)" \
285311
--param="MQTT_PASSWORD=$(shell cat $(mqtt_password_file))" \
286-
--param="MQTT_ROOT_CERT=" \
287-
--param="MQTT_CLIENT_CERT=" \
288-
--param="MQTT_CLIENT_KEY=" \
312+
--param="MQTT_ROOT_CERT=$(mqtt_root_cert)" \
313+
--param="MQTT_CLIENT_CERT=$(mqtt_client_cert)" \
314+
--param="MQTT_CLIENT_KEY=$(mqtt_client_key)" \
289315
--param="MQTT_IMAGE=$(MQTT_IMAGE)" \
290316
--param="IMAGE_REGISTRY=$(internal_image_registry)" \
291317
--param="IMAGE_REPOSITORY=$(image_repository)" \
@@ -309,6 +335,14 @@ cmds:
309335
--param="ENABLE_OCM_MOCK=$(ENABLE_OCM_MOCK)" \
310336
--param="ENABLE_GRPC_SERVER=$(ENABLE_GRPC_SERVER)" \
311337
--param="MESSAGE_DRIVER_TYPE"=$(MESSAGE_DRIVER_TYPE) \
338+
--param="MAESTRO_SVC_TYPE"=$(maestro_svc_type) \
339+
--param="MAESTRO_SVC_NODE_PORT"=$(maestro_svc_node_port) \
340+
--param="GRPC_SVC_TYPE"=$(grpc_svc_type) \
341+
--param="GRPC_SVC_NODE_PORT"=$(grpc_svc_node_port) \
342+
--param="LIVENESS_PROBE_INIT_DELAY_SECONDS"=$(liveness_probe_init_delay_seconds) \
343+
--param="READINESS_PROBE_INIT_DELAY_SECONDS"=$(readiness_probe_init_delay_seconds) \
344+
--param="SUBSCRIPTION_TYPE"=$(subscription_type) \
345+
--param="AGENT_TOPIC"=$(agent_topic) \
312346
> "templates/$*-template.json"
313347

314348

@@ -417,7 +451,7 @@ e2e-test/teardown:
417451
./test/e2e/setup/e2e_teardown.sh
418452
.PHONY: e2e-test/teardown
419453

420-
e2e-test: e2e-test/teardown e2e-test/setup
454+
e2e-test/run:
421455
ginkgo -v --fail-fast --label-filter="!(e2e-tests-spec-resync-reconnect||e2e-tests-status-resync-reconnect)" \
422456
--output-dir="${PWD}/test/e2e/report" --json-report=report.json --junit-report=report.xml \
423457
${PWD}/test/e2e/pkg -- \
@@ -426,4 +460,11 @@ e2e-test: e2e-test/teardown e2e-test/setup
426460
-server-kubeconfig=${PWD}/test/e2e/.kubeconfig \
427461
-consumer-name=$(shell cat ${PWD}/test/e2e/.consumer_name) \
428462
-agent-kubeconfig=${PWD}/test/e2e/.kubeconfig
463+
.PHONY: e2e-test/run
464+
465+
e2e-test: e2e-test/teardown e2e-test/setup e2e-test/run
429466
.PHONY: e2e-test
467+
468+
migration-test: e2e-test/teardown
469+
./test/e2e/migration/test.sh
470+
.PHONY: migration-test

0 commit comments

Comments
 (0)