From 8c204c924d7a8dcb3da3d30480cc70e178c1ed25 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Thu, 9 Nov 2023 15:44:26 +0100 Subject: [PATCH] OZG-3388 rename helm chart value --- README.md | 21 +++++-- src/main/helm/templates/deployment.yaml | 6 +- src/main/helm/values.yaml | 2 - .../helm/deployment-keycloak-values-test.yaml | 5 -- src/test/helm/deployment_env_test.yaml | 18 +++++- .../de/itvsh/kop/user/sync/SyncScheduler.java | 2 +- .../src/main/resources/application-e2e.yaml | 8 ++- .../main/resources/application-remotekc.yaml | 6 +- .../src/main/resources/application.yaml | 6 +- .../src/test/resources/application.yml | 60 ++++++++++--------- 10 files changed, 81 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 537ef422..517e05d2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# user-manager Project +# user-manager This project uses Quarkus, the Supersonic Subatomic Java Framework. @@ -36,12 +36,21 @@ You can run your application in dev mode that enables live coding using: > ```yaml > keycloak: > realm: your-realm -> kop: -> keycloak: -> sync: -> period: "6h" +> ozgcloud: +> usersync: +> period: "6h" > ``` +## Running the server with custom realm +In order to start user-manager-server connecting againts dev keycloak locally with custom realm +use below configuration in your IDE or CLI. +``` +-Dquarkus.profile=local,remotekc +-Dquarkus.oidc.auth-server-url=https://sso.dev.by.ozg-cloud.de/realms/sebo-test +-Dkop.keycloak.api.realm=sebo-test +-Dozgcloud.usersync.period="5s" +``` + ## Packaging and running the application The application can be packaged using: @@ -133,7 +142,7 @@ Usermanager als native Anwendung erstellen und lokal starten: -Dkop.keycloak.api.password=hlc_j1I1Ji0trC0 \ -Dkop.keycloak.api.realm=by-kiel-dev \ -Dkop.keycloak.api.client=alfa \ - -Dkop.keycloak.sync.cron="* */3 * * * ?" \ + -Dozgcloud.usersync.period="5m" \ -Xmx32m ``` diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index af8cb38b..c00aeea6 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -98,8 +98,10 @@ spec: value: {{ include "app.ssoServerUrl" . }} - name: KOP_USER_MANAGER_URL value: {{ include "app.baseUrl" . }} - - name: KOP_KEYCLOAK_SYNC_CRON - value: {{ .Values.kop.keycloak.sync.cron }} + {{- if ((.Values.ozgcloud).usersync).period }} + - name: OZGCLOUD_USERSYNC_PERIOD + value: {{ .Values.ozgcloud.usersync.period }} + {{- end }} - name: QUARKUS_HTTP_CORS_ORIGINS value: {{ (include "app.goofyAddress" .) }} {{- with (.Values.env).customList }} diff --git a/src/main/helm/values.yaml b/src/main/helm/values.yaml index fc0f63d4..78a2d651 100644 --- a/src/main/helm/values.yaml +++ b/src/main/helm/values.yaml @@ -38,8 +38,6 @@ kop: keycloak: api: user: userManagerApiUser - sync: - cron: 0 15 1 * * ? imageCredentials: registry: docker.ozg-sh.de diff --git a/src/test/helm/deployment-keycloak-values-test.yaml b/src/test/helm/deployment-keycloak-values-test.yaml index 3554cc6e..5aabfe98 100644 --- a/src/test/helm/deployment-keycloak-values-test.yaml +++ b/src/test/helm/deployment-keycloak-values-test.yaml @@ -52,11 +52,6 @@ tests: content: name: KOP_KEYCLOAK_API_REALM value: sh-helm-test - - contains: - path: spec.template.spec.containers[0].env - content: - name: KOP_KEYCLOAK_SYNC_CRON - value: 0 15 1 * * ? - contains: path: spec.template.spec.containers[0].env content: diff --git a/src/test/helm/deployment_env_test.yaml b/src/test/helm/deployment_env_test.yaml index d179014a..34eb94b4 100644 --- a/src/test/helm/deployment_env_test.yaml +++ b/src/test/helm/deployment_env_test.yaml @@ -68,4 +68,20 @@ tests: path: spec.template.spec.containers[0].env content: name: QUARKUS_MONGODB_DATABASE - value: test-database \ No newline at end of file + value: test-database + - it: check user sync period set + set: + ozgcloud.usersync.period: "6h" + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: OZGCLOUD_USERSYNC_PERIOD + value: "6h" + - it: check user sync period NOT set + asserts: + - notContains: + path: spec.template.spec.containers[0].env + content: + name: OZGCLOUD_USERSYNC_PERIOD + value: "6h" \ No newline at end of file diff --git a/user-manager-server/src/main/java/de/itvsh/kop/user/sync/SyncScheduler.java b/user-manager-server/src/main/java/de/itvsh/kop/user/sync/SyncScheduler.java index 885875d0..86d8def9 100644 --- a/user-manager-server/src/main/java/de/itvsh/kop/user/sync/SyncScheduler.java +++ b/user-manager-server/src/main/java/de/itvsh/kop/user/sync/SyncScheduler.java @@ -41,7 +41,7 @@ public class SyncScheduler { @Inject LockService syncLockService; - @Scheduled(every = "{kop.keycloak.sync.period}", concurrentExecution = SKIP) + @Scheduled(every = "{ozgcloud.usersync.period}", concurrentExecution = SKIP) public void start() { if (syncLockService.isNotLocked()) { var lock = syncLockService.lockCollection(); diff --git a/user-manager-server/src/main/resources/application-e2e.yaml b/user-manager-server/src/main/resources/application-e2e.yaml index 27aafbd0..5a5bccbd 100644 --- a/user-manager-server/src/main/resources/application-e2e.yaml +++ b/user-manager-server/src/main/resources/application-e2e.yaml @@ -21,8 +21,10 @@ kop: password: S9UEMuLG9y9ev99 realm: by-e2e-local-dev client: alfa - sync: - period: disabled keycloak: - url: https://sso.dev.by.ozg-cloud.de \ No newline at end of file + url: https://sso.dev.by.ozg-cloud.de + +ozgcloud: + usersync: + period: disabled \ No newline at end of file diff --git a/user-manager-server/src/main/resources/application-remotekc.yaml b/user-manager-server/src/main/resources/application-remotekc.yaml index e88917a5..368b647b 100644 --- a/user-manager-server/src/main/resources/application-remotekc.yaml +++ b/user-manager-server/src/main/resources/application-remotekc.yaml @@ -15,8 +15,6 @@ kop: user-manager: url: http://localhost:9092 keycloak: - sync: - period: disabled api: user: userManagerApiUser password: hlc_j1I1Ji0trC0 @@ -24,3 +22,7 @@ kop: organisations-einheit-id-key: organisationseinheitId client: alfa ldap-id-key: LDAP_ID + +ozgcloud: + usersync: + period: disabled \ No newline at end of file diff --git a/user-manager-server/src/main/resources/application.yaml b/user-manager-server/src/main/resources/application.yaml index 7eeff0d9..6efd2f1f 100644 --- a/user-manager-server/src/main/resources/application.yaml +++ b/user-manager-server/src/main/resources/application.yaml @@ -42,5 +42,7 @@ kop: password: "-" realm: by-kiel-dev client: alfa - sync: - period: "6h" \ No newline at end of file + +ozgcloud: + usersync: + period: "6h" \ No newline at end of file diff --git a/user-manager-server/src/test/resources/application.yml b/user-manager-server/src/test/resources/application.yml index 2a586a62..f79dce90 100644 --- a/user-manager-server/src/test/resources/application.yml +++ b/user-manager-server/src/test/resources/application.yml @@ -1,33 +1,35 @@ quarkus: - keycloak: - devservices: - enabled: false - application: - name: kopusermanager - mongodb: - devservices: - enabled: false - database: usermanager - scheduler: - metrics: - enabled: true - log: - level: INFO - oidc: - auth-server-url: https://sso.dev.by.ozg-cloud.de/realms/by-kiel-dev + keycloak: + devservices: + enabled: false + application: + name: kopusermanager + mongodb: + devservices: + enabled: false + database: usermanager + scheduler: + metrics: + enabled: true + log: + level: INFO + oidc: + auth-server-url: https://sso.dev.by.ozg-cloud.de/realms/by-kiel-dev kop: - keycloak: - sync: - cron: "0 15 13 * * ?" - api: - user: "-" - password: "-" - realm: by-kiel-dev - organisations-einheit-id-key: organisationseinheitId - ldap-id-key: LDAP_ID - client: sh-kiel-dev-goofy - user-manager: - url: http://localhost:9092 + keycloak: + api: + user: "-" + password: "-" + realm: by-kiel-dev + organisations-einheit-id-key: organisationseinheitId + ldap-id-key: LDAP_ID + client: sh-kiel-dev-goofy + user-manager: + url: http://localhost:9092 keycloak: - url: http://localhost:8088 \ No newline at end of file + url: http://localhost:8088 + +ozgcloud: + usersync: + period: disabled \ No newline at end of file -- GitLab