From d4729c4a9dac373866e02a0114c074cfcae223fa Mon Sep 17 00:00:00 2001 From: Jeoffrey Haeyaert Date: Thu, 1 Aug 2024 09:22:07 +0200 Subject: [PATCH] fix: split hz config for cluster and cache https://gravitee.atlassian.net/browse/ARCHI-391 --- .circleci/config.yml | 8 +- cockpit/CHANGELOG.md | 4 + cockpit/templates/api/api-configmap.yaml | 49 ++++++++++-- cockpit/templates/api/api-deployment.yaml | 8 +- cockpit/templates/api/api-service-hz.yaml | 32 ++++++++ .../api/api-configmap_gravitee_yaml_test.yaml | 80 +++++++++---------- .../api-configmap_hazelcast_yaml_test.yaml | 49 ++++++++++-- .../api/api-configmap_logback_yaml_test.yaml | 4 +- cockpit/tests/api/api-deployment_test.yaml | 15 ++-- .../tests/api/api-ingress-technical_test.yaml | 6 +- cockpit/tests/api/api-pdb_test.yaml | 2 +- cockpit/tests/api/api_upgrader_test.yaml | 6 +- cockpit/tests/extra-manifests_test.yaml | 2 +- .../generator/generator-configmap_test.yaml | 10 +-- .../generator/generator-deployment_test.yaml | 5 +- .../tests/generator/generator-pdb_test.yaml | 2 +- cockpit/tests/ui/ui-configmap_test.yaml | 4 +- cockpit/tests/ui/ui-deployment_test.yaml | 2 - cockpit/tests/ui/ui-ingress_test.yaml | 20 ++--- cockpit/tests/ui/ui-pdb_test.yaml | 2 +- 20 files changed, 205 insertions(+), 105 deletions(-) create mode 100644 cockpit/templates/api/api-service-hz.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml index c8be30c4..7e75d55c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,7 @@ commands: steps: - run: name: install helm-unittest plugin - command: helm plugin install https://github.com/quintush/helm-unittest --version 0.2.11 + command: helm plugin install https://github.com/helm-unittest/helm-unittest.git --version 0.5.1 execute-tests: description: execute the unit tests of the folder @@ -29,7 +29,7 @@ commands: steps: - run: name: execute the units tests in << parameters.folder >>. - command: helm unittest -3 -f '<< parameters.files >>' << parameters.folder >> -t JUnit -o << parameters.output-file >> + command: helm unittest -f '<< parameters.files >>' << parameters.folder >> -t JUnit -o << parameters.output-file >> lint: description: Lint the helm charts available in the folder parameters: @@ -50,7 +50,7 @@ jobs: steps: - checkout - helm/install-helm-client: - version: v3.7.1 + version: v3.15.3 - install-helm-unittest - lint: folder: cockpit @@ -73,7 +73,7 @@ jobs: steps: - checkout - helm/install-helm-client: - version: v3.7.1 + version: v3.15.3 - lint: folder: << parameters.folder >> diff --git a/cockpit/CHANGELOG.md b/cockpit/CHANGELOG.md index 3142f650..b9aba75c 100644 --- a/cockpit/CHANGELOG.md +++ b/cockpit/CHANGELOG.md @@ -2,6 +2,10 @@ This file documents all notable changes to [Gravitee.io Cockpit](https://github.com/gravitee-io/helm-charts/tree/master/cockpit) Helm Chart. The release numbering uses [semantic versioning](http://semver.org). +### 2.0.1 + +- [X] Split hazecast configuration for cache and cluster + ### 2.0.0 - [X] Add new configuration for controller diff --git a/cockpit/templates/api/api-configmap.yaml b/cockpit/templates/api/api-configmap.yaml index aec301ad..94007337 100644 --- a/cockpit/templates/api/api-configmap.yaml +++ b/cockpit/templates/api/api-configmap.yaml @@ -62,12 +62,12 @@ data: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -284,13 +284,13 @@ data: {{ toYaml .Values.authentication.oidc | indent 8 }} {{- end }} - hazelcast.xml: |- + hazelcast-cluster.xml: |- - graviteeio-cockpit + graviteeio-cockpit-cluster true 3 @@ -299,12 +299,45 @@ data: slf4j - + 0 1 + 300 - + + 0 + + + + 5701 + + + + + {{ .Release.Namespace }} + {{ template "gravitee.api.fullname" . }}-hz + 5701 + + + + + hazelcast-cache.xml: |- + + + graviteeio-cockpit-cache + + true + 3 + 5 + false + slf4j + + + 0 1 @@ -314,12 +347,14 @@ data: + 5702 {{ .Release.Namespace }} - {{ template "gravitee.api.fullname" . }} + {{ template "gravitee.api.fullname" . }}-hz + 5702 diff --git a/cockpit/templates/api/api-deployment.yaml b/cockpit/templates/api/api-deployment.yaml index e4798d4d..3a87f65b 100644 --- a/cockpit/templates/api/api-deployment.yaml +++ b/cockpit/templates/api/api-deployment.yaml @@ -142,11 +142,11 @@ spec: mountPath: /opt/gravitee-cockpit-management-api/config/gravitee.yml subPath: gravitee.yml - name: config - mountPath: /opt/gravitee-cockpit-management-api/config/hazelcast.xml - subPath: hazelcast.xml + mountPath: /opt/gravitee-cockpit-management-api/config/hazelcast-cluster.xml + subPath: hazelcast-cluster.xml - name: config - mountPath: /opt/gravitee-cockpit-management-api/config/hazelcast.yml - subPath: hazelcast.yml + mountPath: /opt/gravitee-cockpit-management-api/config/hazelcast-cache.xml + subPath: hazelcast-cache.xml - name: config mountPath: /opt/gravitee-cockpit-management-api/config/logback.xml subPath: logback.xml diff --git a/cockpit/templates/api/api-service-hz.yaml b/cockpit/templates/api/api-service-hz.yaml new file mode 100644 index 00000000..c9d617a9 --- /dev/null +++ b/cockpit/templates/api/api-service-hz.yaml @@ -0,0 +1,32 @@ +{{- if and (.Values.api.enabled) (.Values.api.controller.ws.service.enabled) -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "gravitee.api.fullname" . }}-hz + labels: + app.kubernetes.io/name: {{ template "gravitee.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Values.api.image.tag | default .Chart.AppVersion | quote }} + app.kubernetes.io/component: "{{ .Values.api.name }}" + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + annotations: + {{- range $key, $value := .Values.api.service.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + type: "ClusterIP" + ports: + - port: 5701 + targetPort: 5701 + protocol: TCP + name: {{ printf "%s-%s" (.Values.api.name | trunc 56 | trimSuffix "-") "hz-cluster" }} + - port: 5702 + targetPort: 5702 + protocol: TCP + name: {{ printf "%s-%s" (.Values.api.name | trunc 56 | trimSuffix "-") "hz-cache" }} + selector: + app.kubernetes.io/name: {{ template "gravitee.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: "{{ .Values.api.name }}" +{{- end -}} diff --git a/cockpit/tests/api/api-configmap_gravitee_yaml_test.yaml b/cockpit/tests/api/api-configmap_gravitee_yaml_test.yaml index 7093f590..32641382 100644 --- a/cockpit/tests/api/api-configmap_gravitee_yaml_test.yaml +++ b/cockpit/tests/api/api-configmap_gravitee_yaml_test.yaml @@ -49,7 +49,7 @@ tests: - hasDocuments: count: 1 - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -64,12 +64,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -226,7 +226,7 @@ tests: - hasDocuments: count: 1 - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -252,12 +252,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -404,7 +404,7 @@ tests: - hasDocuments: count: 1 - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -419,12 +419,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -578,7 +578,7 @@ tests: - hasDocuments: count: 1 - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -593,12 +593,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -746,7 +746,7 @@ tests: - hasDocuments: count: 1 - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -761,12 +761,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -920,7 +920,7 @@ tests: - hasDocuments: count: 1 - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -935,12 +935,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -1103,7 +1103,7 @@ tests: - isKind: of: ConfigMap - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -1118,12 +1118,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -1299,7 +1299,7 @@ tests: - isKind: of: ConfigMap - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -1314,12 +1314,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -1495,7 +1495,7 @@ tests: - isKind: of: ConfigMap - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -1510,12 +1510,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -1679,7 +1679,7 @@ tests: - isKind: of: ConfigMap - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -1694,12 +1694,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -1855,7 +1855,7 @@ tests: - isKind: of: ConfigMap - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -1870,12 +1870,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -2035,8 +2035,8 @@ tests: - isKind: of: ConfigMap - equal: - path: data.[gravitee.yml] - value: | + path: data["gravitee.yml"] + value: | jetty: port: 8063 @@ -2050,12 +2050,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: @@ -2210,7 +2210,7 @@ tests: - isKind: of: ConfigMap - equal: - path: data.[gravitee.yml] + path: data["gravitee.yml"] value: | jetty: port: 8063 @@ -2225,12 +2225,12 @@ tests: cluster: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cluster.xml cache: type: hazelcast hazelcast: - config-path: ${gravitee.home}/config/hazelcast.xml + config-path: ${gravitee.home}/config/hazelcast-cache.xml exchange: controller: diff --git a/cockpit/tests/api/api-configmap_hazelcast_yaml_test.yaml b/cockpit/tests/api/api-configmap_hazelcast_yaml_test.yaml index 19c2db59..0edd82d5 100644 --- a/cockpit/tests/api/api-configmap_hazelcast_yaml_test.yaml +++ b/cockpit/tests/api/api-configmap_hazelcast_yaml_test.yaml @@ -49,14 +49,14 @@ tests: - hasDocuments: count: 1 - equal: - path: data.[hazelcast.xml] - value: | + path: data["hazelcast-cluster.xml"] + value: |- - graviteeio-cockpit + graviteeio-cockpit-cluster true 3 @@ -65,12 +65,47 @@ tests: slf4j - + 0 1 + 300 - + + 0 + + + + 5701 + + + + + unittest + my-cockpit-api-hz + 5701 + + + + + - equal: + path: data["hazelcast-cache.xml"] + value: |- + + + graviteeio-cockpit-cache + + true + 3 + 5 + false + slf4j + + + 0 1 @@ -80,12 +115,14 @@ tests: + 5702 unittest - my-cockpit-api + my-cockpit-api-hz + 5702 diff --git a/cockpit/tests/api/api-configmap_logback_yaml_test.yaml b/cockpit/tests/api/api-configmap_logback_yaml_test.yaml index 5e3bc80c..220db2ec 100644 --- a/cockpit/tests/api/api-configmap_logback_yaml_test.yaml +++ b/cockpit/tests/api/api-configmap_logback_yaml_test.yaml @@ -14,7 +14,7 @@ tests: - hasDocuments: count: 1 - equal: - path: data.[logback.xml] + path: data["logback.xml"] value: |-