From 9e2e65656881d1bb4e28cebbbaa4e90b81c11ee6 Mon Sep 17 00:00:00 2001 From: Pavan <25031267+Pavan-SAP@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:38:11 +0200 Subject: [PATCH] [Misc] Plugin: mta determination of CAP added (#38) * [Misc] Plugin: mta determination of CAP added Enhance mta to add potential "CAP" type workloads. Fix issue with CAV.Spec.Version being set as a number. * Updated changelog and package to version 0.4.0 --------- Co-authored-by: anirudhprasad-sap <126493692+anirudhprasad-sap@users.noreply.github.com> --- CHANGELOG.md | 10 ++++++++++ files/chart/templates/cap-operator-cros.yaml | 2 +- .../templates/cap-operator-cros.yaml | 2 +- lib/mta-transformer.js | 7 ++++++- package-lock.json | 4 ++-- package.json | 2 +- test/files/expectedChart/valuesWithMTA.yaml | 6 +++--- .../templates/cap-operator-cros-modified.yaml | 2 +- .../templates/cap-operator-cros-mta.yaml | 8 ++++---- test/files/mta.yaml | 2 +- 10 files changed, 30 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 317761f..7be7914 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). The format is based on [Keep a Changelog](http://keepachangelog.com/). +## Version 0.4.0 - 16-September-2024 + +### Added + +- Added handling for `CAP` and `Additional` workloads in mta transformer + +### Fixed + +- Fix issue with CAV.Spec.Version being set as a number + ## Version 0.3.0 - 13-September-2024 ### Added diff --git a/files/chart/templates/cap-operator-cros.yaml b/files/chart/templates/cap-operator-cros.yaml index 880f65b..5121ce1 100644 --- a/files/chart/templates/cap-operator-cros.yaml +++ b/files/chart/templates/cap-operator-cros.yaml @@ -52,7 +52,7 @@ metadata: name: {{ include "capApplicationVersionName" $ }} spec: capApplicationInstance: {{ include "appName" $ }} - version: {{ .Release.Revision }} + version: "{{ .Release.Revision }}" registrySecrets: {{- range .Values.imagePullSecrets }} - {{.}} diff --git a/files/configurableTemplatesChart/templates/cap-operator-cros.yaml b/files/configurableTemplatesChart/templates/cap-operator-cros.yaml index d31b1d2..4c0742a 100644 --- a/files/configurableTemplatesChart/templates/cap-operator-cros.yaml +++ b/files/configurableTemplatesChart/templates/cap-operator-cros.yaml @@ -52,7 +52,7 @@ metadata: name: {{ include "capApplicationVersionName" $ }} spec: capApplicationInstance: {{ include "appName" $ }} - version: {{ .Release.Revision }} + version: "{{ .Release.Revision }}" registrySecrets: {{- range .Values.imagePullSecrets }} - {{.}} diff --git a/lib/mta-transformer.js b/lib/mta-transformer.js index eb10d36..cde8c76 100644 --- a/lib/mta-transformer.js +++ b/lib/mta-transformer.js @@ -216,10 +216,15 @@ module.exports = class MtaTransformer { type: module.type === 'com.sap.application.content'? "Content": "TenantOperation", image: null } + } else if (module.path.includes("gen/srv")) { + workload.deploymentDefinition = { + type: "CAP", + image: null + } } else { workload.deploymentDefinition = { type: module.path.includes("approuter") || - module.path.includes("router") ? "Router" : null, + module.path.includes("router") ? "Router" : "Additional", image: null } } diff --git a/package-lock.json b/package-lock.json index f52d4aa..48546ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cap-js/cap-operator-plugin", - "version": "0.3.0", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cap-js/cap-operator-plugin", - "version": "0.3.0", + "version": "0.4.0", "license": "SEE LICENSE", "dependencies": { "mustache": "^4.2.0" diff --git a/package.json b/package.json index 480c615..6f4445a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cap-js/cap-operator-plugin", - "version": "0.3.0", + "version": "0.4.0", "description": "Add/Build Plugin for CAP Operator", "homepage": "https://github.com/cap-js/cap-operator-plugin/blob/main/README.md", "repository": { diff --git a/test/files/expectedChart/valuesWithMTA.yaml b/test/files/expectedChart/valuesWithMTA.yaml index 7d4b0ca..04437dd 100644 --- a/test/files/expectedChart/valuesWithMTA.yaml +++ b/test/files/expectedChart/valuesWithMTA.yaml @@ -153,7 +153,7 @@ workloads: - author-readings-auditlog-bind - author-readings-registry-bind deploymentDefinition: - type: null + type: CAP image: null env: - name: OTLP_TRACE_URL @@ -171,7 +171,7 @@ workloads: - author-readings-service-manager-author-readings-mtx-srv-bind - author-readings-logging-bind deploymentDefinition: - type: null + type: Additional image: null authorReadingsAppDeployer: name: author-readings-app-deployer @@ -197,7 +197,7 @@ workloads: - author-readings-uaa-bind - author-readings-logging-bind deploymentDefinition: - type: null + type: Additional image: null env: - name: TENANT_HOST_PATTERN diff --git a/test/files/expectedConfigurableTemplatesChart/templates/cap-operator-cros-modified.yaml b/test/files/expectedConfigurableTemplatesChart/templates/cap-operator-cros-modified.yaml index f1a08db..b28f13c 100644 --- a/test/files/expectedConfigurableTemplatesChart/templates/cap-operator-cros-modified.yaml +++ b/test/files/expectedConfigurableTemplatesChart/templates/cap-operator-cros-modified.yaml @@ -52,7 +52,7 @@ metadata: name: {{ include "capApplicationVersionName" $ }} spec: capApplicationInstance: {{ include "appName" $ }} - version: {{ .Release.Revision }} + version: "{{ .Release.Revision }}" registrySecrets: {{- range .Values.imagePullSecrets }} - {{.}} diff --git a/test/files/expectedConfigurableTemplatesChart/templates/cap-operator-cros-mta.yaml b/test/files/expectedConfigurableTemplatesChart/templates/cap-operator-cros-mta.yaml index a492577..f3d25c7 100644 --- a/test/files/expectedConfigurableTemplatesChart/templates/cap-operator-cros-mta.yaml +++ b/test/files/expectedConfigurableTemplatesChart/templates/cap-operator-cros-mta.yaml @@ -52,7 +52,7 @@ metadata: name: {{ include "capApplicationVersionName" $ }} spec: capApplicationInstance: {{ include "appName" $ }} - version: {{ .Release.Revision }} + version: "{{ .Release.Revision }}" registrySecrets: {{- range .Values.imagePullSecrets }} - {{.}} @@ -84,7 +84,7 @@ spec: - author-readings-auditlog-bind - author-readings-registry-bind deploymentDefinition: - type: null + type: CAP image: "{{.Values.workloads.authorReadingsSrv.image}}" env: - name: OTLP_TRACE_URL @@ -101,7 +101,7 @@ spec: - author-readings-service-manager-author-readings-mtx-srv-bind - author-readings-logging-bind deploymentDefinition: - type: null + type: Additional image: "{{.Values.workloads.authorReadingsMtxSrv.image}}" - name: author-readings-app-deployer consumedBTPServices: @@ -124,7 +124,7 @@ spec: - author-readings-uaa-bind - author-readings-logging-bind deploymentDefinition: - type: null + type: Additional image: "{{.Values.workloads.authorReadings.image}}" env: - name: TENANT_HOST_PATTERN diff --git a/test/files/mta.yaml b/test/files/mta.yaml index 0cc1665..20271e0 100644 --- a/test/files/mta.yaml +++ b/test/files/mta.yaml @@ -88,7 +88,7 @@ modules: # Multi Tenancy Service Module (Onboarding, Upgrading) - name: author-readings-mtx-srv type: nodejs - path: gen/srv + path: gen/multi-tenancy/srv requires: - name: author-readings-auditlog - name: author-readings-uaa