From dc9697e94ccafe0acf397c27243483c4f52dedbb Mon Sep 17 00:00:00 2001 From: kamaleeswary <42646635+kamaleeswary@users.noreply.github.com> Date: Tue, 9 Aug 2022 11:06:50 +0530 Subject: [PATCH 1/4] Issue #SB-30692 fix: Group update API : name field is mandatory and it is accepting the request with out name field value (#152) --- .../GroupUpdateRequestValidator.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/service/app/validators/GroupUpdateRequestValidator.java b/service/app/validators/GroupUpdateRequestValidator.java index 344bedd7..5a928334 100644 --- a/service/app/validators/GroupUpdateRequestValidator.java +++ b/service/app/validators/GroupUpdateRequestValidator.java @@ -24,12 +24,21 @@ public boolean validate(Request request) throws BaseException { logger.info(request.getContext(),"Validating the update group request "+request.getRequest()); try { ValidationUtil.validateRequestObject(request); - ValidationUtil.validateMandatoryParamsWithType( - request.getRequest(), - Lists.newArrayList(JsonKey.GROUP_ID), - String.class, - true, - JsonKey.REQUEST,request.getContext()); + if (request.getRequest().containsKey(JsonKey.NAME)) { + ValidationUtil.validateMandatoryParamsWithType( + request.getRequest(), + Lists.newArrayList(JsonKey.GROUP_ID, JsonKey.NAME), + String.class, + true, + JsonKey.REQUEST, request.getContext()); + } else { + ValidationUtil.validateMandatoryParamsWithType( + request.getRequest(), + Lists.newArrayList(JsonKey.GROUP_ID), + String.class, + true, + JsonKey.REQUEST, request.getContext()); + } ValidationUtil.validateParamsWithType(request.getRequest(),Lists.newArrayList(JsonKey.MEMBERS,JsonKey.ACTIVITIES), Map.class,JsonKey.REQUEST,request.getContext()); validateActivityList(request); From 457c59a2cad5b12450d3835a8891846e49cb53bf Mon Sep 17 00:00:00 2001 From: Naga Prasad Moka <92975412+prasadmoka@users.noreply.github.com> Date: Mon, 22 Aug 2022 12:09:53 +0530 Subject: [PATCH 2/4] feat:LR-137 cassandra multiple DC changes (#153) * feat:LR-137 cassandra multiple DC changes --- .../src/main/java/org/sunbird/common/Constants.java | 1 + .../helper/CassandraConnectionManagerImpl.java | 12 ++++++++++-- .../src/main/resources/cassandra.config.properties | 3 ++- .../src/main/resources/cassandra.config.properties | 3 ++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cassandra-utils/src/main/java/org/sunbird/common/Constants.java b/cassandra-utils/src/main/java/org/sunbird/common/Constants.java index 6ef0842a..2b1e44e4 100644 --- a/cassandra-utils/src/main/java/org/sunbird/common/Constants.java +++ b/cassandra-utils/src/main/java/org/sunbird/common/Constants.java @@ -72,4 +72,5 @@ public interface Constants { public static final String OBJECT_TYPE = "objectType"; public static final String INSERT = "insert"; public static final String STANDALONE_MODE = "standalone"; + public static final String IS_MULTI_DC_ENABLED = "isMultiDCEnabled"; } diff --git a/cassandra-utils/src/main/java/org/sunbird/helper/CassandraConnectionManagerImpl.java b/cassandra-utils/src/main/java/org/sunbird/helper/CassandraConnectionManagerImpl.java index d656ded5..f3e9ba5a 100644 --- a/cassandra-utils/src/main/java/org/sunbird/helper/CassandraConnectionManagerImpl.java +++ b/cassandra-utils/src/main/java/org/sunbird/helper/CassandraConnectionManagerImpl.java @@ -1,6 +1,7 @@ package org.sunbird.helper; import com.datastax.driver.core.*; +import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy; import com.datastax.driver.core.policies.DefaultRetryPolicy; import java.util.Collection; import java.util.List; @@ -66,7 +67,8 @@ private void createCassandraConnection(String[] hosts) throws BaseException { poolingOptions.setPoolTimeoutMillis( Integer.parseInt(cache.getProperty(Constants.POOL_TIMEOUT))); - cluster = createCluster(hosts, poolingOptions); + //check for multi DC enabled or not from configuration file and send the value + cluster = createCluster(hosts, poolingOptions, Boolean.parseBoolean(cache.getProperty(Constants.IS_MULTI_DC_ENABLED))); final Metadata metadata = cluster.getMetadata(); String msg = String.format("Connected to cluster: %s", metadata.getClusterName()); @@ -86,7 +88,7 @@ private void createCassandraConnection(String[] hosts) throws BaseException { } } - private static Cluster createCluster(String[] hosts, PoolingOptions poolingOptions) { + private static Cluster createCluster(String[] hosts, PoolingOptions poolingOptions, boolean isMultiDCEnabled) { Cluster.Builder builder = Cluster.builder() .addContactPoints(hosts) @@ -103,6 +105,12 @@ private static Cluster createCluster(String[] hosts, PoolingOptions poolingOptio builder.withQueryOptions(new QueryOptions().setConsistencyLevel(consistencyLevel)); } + logger.info( + "CassandraConnectionManagerImpl:createCluster: isMultiDCEnabled = " + isMultiDCEnabled); + if (isMultiDCEnabled) { + builder.withLoadBalancingPolicy(DCAwareRoundRobinPolicy.builder().build()); + } + return builder.build(); } diff --git a/cassandra-utils/src/main/resources/cassandra.config.properties b/cassandra-utils/src/main/resources/cassandra.config.properties index e2fdff87..d6641ac8 100644 --- a/cassandra-utils/src/main/resources/cassandra.config.properties +++ b/cassandra-utils/src/main/resources/cassandra.config.properties @@ -10,4 +10,5 @@ port=9042 userName=cassandra password=password queryLoggerConstantThreshold=300 -keyspace=sunbird \ No newline at end of file +keyspace=sunbird +isMultiDCEnabled=true \ No newline at end of file diff --git a/sb-utils/src/main/resources/cassandra.config.properties b/sb-utils/src/main/resources/cassandra.config.properties index e2fdff87..d6641ac8 100644 --- a/sb-utils/src/main/resources/cassandra.config.properties +++ b/sb-utils/src/main/resources/cassandra.config.properties @@ -10,4 +10,5 @@ port=9042 userName=cassandra password=password queryLoggerConstantThreshold=300 -keyspace=sunbird \ No newline at end of file +keyspace=sunbird +isMultiDCEnabled=true \ No newline at end of file From 5e60fe8fc0c5019e554eea5810081c6aae72cd6e Mon Sep 17 00:00:00 2001 From: AMIT KUMAR Date: Tue, 13 Sep 2022 13:16:14 +0530 Subject: [PATCH 3/4] SB-30930 feat: updated pdata version (#154) --- sb-utils/src/main/resources/telemetry.config.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sb-utils/src/main/resources/telemetry.config.properties b/sb-utils/src/main/resources/telemetry.config.properties index 75ac59c4..0af9f6c3 100644 --- a/sb-utils/src/main/resources/telemetry.config.properties +++ b/sb-utils/src/main/resources/telemetry.config.properties @@ -1,4 +1,4 @@ telemetry_pdata_id=dev.sunbird.groups.service telemetry_pdata_pid=groups-service -telemetry_pdata_ver=4.5.0 +telemetry_pdata_ver=5.0.0 From 1497e0e9bfe13444d7b2f020c7912f0239c93726 Mon Sep 17 00:00:00 2001 From: Santhosh Gandham <31979949+gandham-santhosh@users.noreply.github.com> Date: Mon, 13 Feb 2023 14:39:04 +0530 Subject: [PATCH 4/4] Adding groups service helm chart --- helm/.helmignore | 23 ++++ helm/groups/Chart.yaml | 24 ++++ helm/groups/charts/.helmignore | 23 ++++ helm/groups/charts/common/.helmignore | 23 ++++ helm/groups/charts/common/Chart.yaml | 24 ++++ .../charts/common/templates/_helpers.tpl | 3 + .../charts/common/templates/_randomize.tpl | 3 + .../charts/common/templates/_readsecret.tpl | 40 ++++++ .../charts/common/templates/_valdations.tpl | 9 ++ helm/groups/charts/common/values.yaml | 1 + helm/groups/groups-sample-values.yaml | 16 +++ helm/groups/templates/_helpers.tpl | 62 +++++++++ helm/groups/templates/configmap.yaml | 65 +++++++++ helm/groups/templates/deployment.yaml | 50 +++++++ helm/groups/templates/service.yaml | 14 ++ helm/groups/values.yaml | 130 ++++++++++++++++++ 16 files changed, 510 insertions(+) create mode 100644 helm/.helmignore create mode 100644 helm/groups/Chart.yaml create mode 100644 helm/groups/charts/.helmignore create mode 100644 helm/groups/charts/common/.helmignore create mode 100644 helm/groups/charts/common/Chart.yaml create mode 100644 helm/groups/charts/common/templates/_helpers.tpl create mode 100644 helm/groups/charts/common/templates/_randomize.tpl create mode 100644 helm/groups/charts/common/templates/_readsecret.tpl create mode 100644 helm/groups/charts/common/templates/_valdations.tpl create mode 100644 helm/groups/charts/common/values.yaml create mode 100644 helm/groups/groups-sample-values.yaml create mode 100644 helm/groups/templates/_helpers.tpl create mode 100644 helm/groups/templates/configmap.yaml create mode 100644 helm/groups/templates/deployment.yaml create mode 100644 helm/groups/templates/service.yaml create mode 100644 helm/groups/values.yaml diff --git a/helm/.helmignore b/helm/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/helm/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/groups/Chart.yaml b/helm/groups/Chart.yaml new file mode 100644 index 00000000..cde9b2a4 --- /dev/null +++ b/helm/groups/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: sb-groups-service +description: A Helm chart for Sunbird Lern group service + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "5.0.0" diff --git a/helm/groups/charts/.helmignore b/helm/groups/charts/.helmignore new file mode 100644 index 00000000..691fa13d --- /dev/null +++ b/helm/groups/charts/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ \ No newline at end of file diff --git a/helm/groups/charts/common/.helmignore b/helm/groups/charts/common/.helmignore new file mode 100644 index 00000000..691fa13d --- /dev/null +++ b/helm/groups/charts/common/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ \ No newline at end of file diff --git a/helm/groups/charts/common/Chart.yaml b/helm/groups/charts/common/Chart.yaml new file mode 100644 index 00000000..157e8e81 --- /dev/null +++ b/helm/groups/charts/common/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: common +description: A helm chart for common templates + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: library + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "5.0.0" \ No newline at end of file diff --git a/helm/groups/charts/common/templates/_helpers.tpl b/helm/groups/charts/common/templates/_helpers.tpl new file mode 100644 index 00000000..bd9f5b73 --- /dev/null +++ b/helm/groups/charts/common/templates/_helpers.tpl @@ -0,0 +1,3 @@ +{{- define "common.read.configmap.name" -}} +{{- printf "%s-config" .Chart.Name -}} +{{- end -}} \ No newline at end of file diff --git a/helm/groups/charts/common/templates/_randomize.tpl b/helm/groups/charts/common/templates/_randomize.tpl new file mode 100644 index 00000000..19752732 --- /dev/null +++ b/helm/groups/charts/common/templates/_randomize.tpl @@ -0,0 +1,3 @@ +{{- define "common.randomize" }} + {{- randAlphaNum . | trim }} +{{- end }} \ No newline at end of file diff --git a/helm/groups/charts/common/templates/_readsecret.tpl b/helm/groups/charts/common/templates/_readsecret.tpl new file mode 100644 index 00000000..f11264f7 --- /dev/null +++ b/helm/groups/charts/common/templates/_readsecret.tpl @@ -0,0 +1,40 @@ +{{- define "common.read.secret" -}} +{{- $secret := (lookup "v1" "Secret" .Namespace .Name).data -}} +{{- if $secret -}} + {{- if hasKey $secret .Key -}} + {{- index $secret .Key | b64dec -}} + {{- else -}} + {{- if .LocalDevelopment -}} + {{- printf "Ignoring API server errors to allow templating" -}} + {{- else -}} + {{- printf "ERROR | %s | The secret \"%s\" does not contain the key \"%s\" in namespace \"%s\"" .ChartName .Name .Key .Namespace | fail -}} + {{- end -}} + {{- end -}} +{{ else -}} + {{- if .LocalDevelopment -}} + {{- printf "Ignoring API server errors to allow templating" -}} + {{- else -}} + {{- printf "ERROR | %s | The secret \"%s\" does not exist in the namespace \"%s\"" .ChartName .Name .Namespace | fail -}} + {{- end -}} +{{- end -}} +{{- end -}} + +{{- define "common.secret.exists" -}} +{{ $secret := (lookup "v1" "Secret" .Namespace .Name).data}} +{{- if $secret -}} + {{- if hasKey $secret .Key -}} + {{- true -}} + {{- else -}} + {{- false -}} + {{- end -}} +{{- end -}} +{{- end -}} + +{{- define "common.secret.as.map" -}} +{{ $secret := (lookup "v1" "Secret" .Namespace .Name).data}} +{{- if $secret -}} + {{- $secret -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/helm/groups/charts/common/templates/_valdations.tpl b/helm/groups/charts/common/templates/_valdations.tpl new file mode 100644 index 00000000..c13304ed --- /dev/null +++ b/helm/groups/charts/common/templates/_valdations.tpl @@ -0,0 +1,9 @@ +{{- define "common.valid.csps" -}} +{{- $validcsps := "azure or aws or gcloud" -}} +{{- printf "%s" $validcsps -}} +{{- end -}} + +{{- define "common.csp.validation" -}} +{{- $csplist := list "azure" "aws" "gcloud" -}} +{{- has . $csplist -}} +{{- end -}} \ No newline at end of file diff --git a/helm/groups/charts/common/values.yaml b/helm/groups/charts/common/values.yaml new file mode 100644 index 00000000..c35424a5 --- /dev/null +++ b/helm/groups/charts/common/values.yaml @@ -0,0 +1 @@ +## Common helm templates \ No newline at end of file diff --git a/helm/groups/groups-sample-values.yaml b/helm/groups/groups-sample-values.yaml new file mode 100644 index 00000000..0379fcc8 --- /dev/null +++ b/helm/groups/groups-sample-values.yaml @@ -0,0 +1,16 @@ +## This section has mandatory variables +## You must provide a value for these +## If you don't provide a value for these variables, the chart installation will not proceed + +## The domain name or Public IP address +## The domain name should start with http or https +## For example https://example.com +domain: "https://abc.com" + +## This section has optional variables +## It is strongly recommended to provide a value for these +## If you don't provide a value for these variables, they will default to empty values +## If these variables are empty, some features on the application might not work as expected + + + diff --git a/helm/groups/templates/_helpers.tpl b/helm/groups/templates/_helpers.tpl new file mode 100644 index 00000000..9ef45624 --- /dev/null +++ b/helm/groups/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "sb-groups-service.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "sb-groups-service.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "sb-groups-service.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "sb-groups-service.labels" -}} +helm.sh/chart: {{ include "sb-groups-service.chart" . }} +{{ include "sb-groups-service.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "sb-groups-service.selectorLabels" -}} +app.kubernetes.io/name: {{ include "sb-groups-service.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "sb-groups-service.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "sb-groups-service.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/groups/templates/configmap.yaml b/helm/groups/templates/configmap.yaml new file mode 100644 index 00000000..5ff99aa6 --- /dev/null +++ b/helm/groups/templates/configmap.yaml @@ -0,0 +1,65 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Chart.Name }}-config + namespace: {{ .Release.Namespace }} +data: + {{/* This section has variables whose value is read from another object */}} + + {{/* This section has variables which in turn contain one or more mandatory variables */}} + sunbird_sso_url: {{ if .Values.domain }} + {{- .Values.domain }}{{ .Values.keycloak_auth_endpoint }} + {{- else -}} + {{- printf "ERROR | %s | Please provide a value for \"domain\"" .Chart.Name | fail }} + {{- end }} + + sunbird_keycloak_user_federation_provider_id: {{ if .Values.sunbird_keycloak_user_federation_provider_id }} + {{- .Values.sunbird_keycloak_user_federation_provider_id }} + {{- else -}} + {{- include "common.read.secret" (dict "ChartName" .Chart.Name "Namespace" .Release.Namespace "Name" .Values.external_secrets.keycloak_federation.name "Key" .Values.external_secrets.keycloak_federation.key "LocalDevelopment" .Values.local_chart_development) -}} + {{- end }} + + sunbird_sso_client_secret: {{ if .Values.sunbird_sso_client_secret }} + {{- .Values.sunbird_sso_client_secret }} + {{- else -}} + {{- include "common.read.secret" (dict "ChartName" .Chart.Name "Namespace" .Release.Namespace "Name" .Values.external_secrets.keycloak_client_secret.name "Key" .Values.external_secrets.keycloak_client_secret.key "LocalDevelopment" .Values.local_chart_development) -}} + {{- end }} + + sunbird_sso_publickey: {{ if .Values.sunbird_sso_publickey }} + {{- .Values.sunbird_sso_publickey }} + {{- else -}} + {{- include "common.read.secret" (dict "ChartName" .Chart.Name "Namespace" .Release.Namespace "Name" .Values.external_secrets.keycloak_realm_public_key.name "Key" .Values.external_secrets.keycloak_realm_public_key.key "LocalDevelopment" .Values.local_chart_development) -}} + {{- end }} + {{/* This section has optional variables */}} + + {{/* This section has variables with default values */}} + CONTENT_SERVICE_PORT: {{ .Values.CONTENT_SERVICE_PORT }} + ENV_NAME: {{ .Values.ENV_NAME }} + LEARNER_SERVICE_PORT: {{ .Values.LEARNER_SERVICE_PORT }} + SUNBIRD_KAFKA_URL: {{ .Values.SUNBIRD_KAFKA_URL }} + accesstoken.publickey.basepath: {{ .Values.accesstoken.publickey.basepath }} + enable_tenant_config: {{ .Values.enable_tenant_config | quote}} + enable_userid_redis_cache: {{ .Values.enable_userid_redis_cache | quote }} + groups_redis_ttl: {{ .Values.groups_redis_ttl }} + isMultiDCEnabled: {{ .Values.isMultiDCEnabled | quote }} + max_activity_limit: {{ .Values.max_activity_limit}} + max_group_limit: {{ .Values.max_group_limit }} + max_group_members_limit: {{ .Values.max_group_members_limit }} + notification_service_api_url: {{ .Values.notification_service_api_url }} + notification_service_base_url: {{ .Values.notification_service_base_url }} + sunbird_cassandra_consistency_level: {{ .Values.sunbird_cassandra_consistency_level }} + sunbird_cassandra_host: {{ .Values.sunbird_cassandra_host }} + sunbird_cassandra_password: {{ .Values.sunbird_cassandra_password }} + sunbird_cassandra_port: {{ .Values.sunbird_cassandra_port | quote }} + sunbird_cassandra_username: {{ .Values.sunbird_cassandra_username }} + sunbird_cs_search_url: "/v3/search" + sunbird_keycloak_required_action_link_expiration_seconds: {{ .Values.sunbird_keycloak_required_action_link_expiration_seconds | quote }} + sunbird_redis_host: {{ .Values.sunbird_redis_host }} + sunbird_redis_port: {{ .Values.sunbird_redis_port | quote }} + sunbird_sso_client_id: {{ .Values.external_secrets.keycloak_client_secret.key }} + sunbird_sso_password: {{ .Values.sunbird_sso_password }} + sunbird_sso_realm: {{ .Values.external_secrets.keycloak_realm_public_key.key }} + sunbird_sso_username: {{ .Values.sunbird_sso_username }} + sunbird_user_service_search_url: {{ .Values.sunbird_user_service_search_url }} + user_redis_ttl: {{ .Values.user_redis_ttl }} diff --git a/helm/groups/templates/deployment.yaml b/helm/groups/templates/deployment.yaml new file mode 100644 index 00000000..61286ea9 --- /dev/null +++ b/helm/groups/templates/deployment.yaml @@ -0,0 +1,50 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + namespace: {{ .Release.Namespace }} + annotations: + reloader.stakater.com/auto: "true" +spec: + replicas: {{ .Values.replicaCount }} + strategy: + rollingUpdate: + maxSurge: {{ .Values.strategy.maxSurge }} + maxUnavailable: {{ .Values.strategy.maxUnavailable }} + selector: + matchLabels: + app: {{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + spec: +{{- if .Values.imagePullSecrets }} + imagePullSecrets: + - name: {{ .Values.imagePullSecrets }} +{{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: Always + env: + - name: JAVA_OPTIONS + value: {{ .Values.javaOptions }} + - name: _JAVA_OPTIONS + value: -Dlog4j2.formatMsgNoLookups=true + envFrom: + - configMapRef: + name: {{ .Chart.Name }}-config + resources: +{{ toYaml .Values.resources | indent 10 }} + ports: + - containerPort: {{ .Values.port }} + livenessProbe: +{{ toYaml .Values.livenessProbe | indent 10 }} + readinessProbe: +{{ toYaml .Values.readinessProbe | indent 10 }} + volumeMounts: + - mountPath: {{ .Values.accesstoken.publickey.basepath }} + name: {{ .Values.external_configmaps.access_public_keys.name }} + diff --git a/helm/groups/templates/service.yaml b/helm/groups/templates/service.yaml new file mode 100644 index 00000000..9503c8f1 --- /dev/null +++ b/helm/groups/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }}-service + namespace: {{ .Release.Namespace }} + labels: + app: {{ .Chart.Name }} +spec: + ports: + - name: http-{{ .Chart.Name }} + protocol: TCP + port: {{ .Values.targetPort }} + selector: + app: {{ .Chart.Name }} \ No newline at end of file diff --git a/helm/groups/values.yaml b/helm/groups/values.yaml new file mode 100644 index 00000000..514b5002 --- /dev/null +++ b/helm/groups/values.yaml @@ -0,0 +1,130 @@ +## This section has mandatory variables +## You must provide a value for these +## If you don't provide a value for these variables, the chart installation will not proceed + +## The domain name or Public IP address +## The domain name should start with http or https +## For example https://example.com +domain: "httpsL//example.com" + + + + +## This section has optional variables +## If you provide a value to the variable, then that will have the highest precedence +## If you don't provide a value, then it's auto generated + + +## This section has optional variables +## If you provide a value to the variable, then that will have the highest precedence +## If you don't provide a value, then it's fetched from another object +sunbird_keycloak_user_federation_provider_id: "" +sunbird_sso_publickey: "" +sunbird_sso_client_secret: "" + +## This section has variables with default values +## These are standard defaults that work well +## You can override these if you have a use case for it +CONTENT_SERVICE_PORT: http://search-service:9000 +ENV_NAME: dev +SUNBIRD_KAFKA_URL: http://kafka.lern.svc.cluster.local:9092 +accesstoken: + publickey: + basepath: /keys/ +LEARNER_SERVICE_PORT: 9000 +enable_tenant_config: "*" +enable_userid_redis_cache: true +groups_redis_ttl: 86400 +isMultiDCEnabled: false +max_activity_limit: 100 +max_group_limit: 50 +max_group_members_limit: 150 +notification_service_api_url: /v2/notification/send +notification_service_base_url: http://notification-service.lern.svc.cluster.local:9000 +sunbird_cassandra_consistency_level: local_quorum +sunbird_cassandra_host: http://cassandra.lern.svc.cluster.local +sunbird_cassandra_password: password +sunbird_cassandra_port: 9042 +sunbird_cassandra_username: admin +sunbird_cs_search_url: /v3/search +sunbird_keycloak_required_action_link_expiration_seconds: 2592000 +sunbird_redis_host: redis.lern.svc.cluster.local +sunbird_redis_port: 6379 +sunbird_sso_client_id: lms +sunbird_sso_realm: sunbird +sunbird_user_service_search_url: /private/user/v1/search +user_redis_ttl: 3600 + +### Review the variables with Lern team +sunbird_sso_username: +sunbird_sso_password: + +## Helper variables which are used to construct other variables +keycloak_auth_endpoint: "/auth/" +external_secrets: + keycloak_federation: + name: keycloak-federation + key: cassandra-storage-provider + keycloak_client_secret: + name: keycloak-clients + key: lms + keycloak_realm_public_key: + name: keycloak-realms + key: sunbird + +external_configmaps: + access_public_keys: + name: user-access-public-keys + +## Set this value to true when developing the chart +local_chart_development: true + + +## This section has other kubernetes variables +## These are standard defaults that work well +## You can override these if you have a use case for it +image: + registry: docker.io + repository: santhoshgandham/sb-groups-service + tag: release-5.0.0 + +replicaCount: 1 + +strategy: + maxSurge: 25% + maxUnavailable: 25% + +imagePullSecrets: "" + +javaOptions: -Xmx500m + +resources: + requests: + cpu: 100m + memory: 100M + limits: + cpu: 1 + memory: 1G + +port: 9000 + +targetPort: 9000 + +livenessProbe: + failureThreshold: 2 + httpGet: + path: /service/health + port: 9000 + initialDelaySeconds: 15 + periodSeconds: 15 + timeoutSeconds: 5 + +readinessProbe: + failureThreshold: 2 + httpGet: + path: /service/health + port: 9000 + initialDelaySeconds: 15 + periodSeconds: 15 + timeoutSeconds: 5 +