diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac0708a3991ac6643624f8f75e8ceaeeeb34d633..c9cfca093424d04777d22b3f733b65daaadbce2e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,8 @@ variables: IBM_BUILD_SUBDIR: provider/notification-ibm IBM_INT_TEST_SUBDIR: testing/notification-test-ibm + IBM_HELM_CONFIG_PATH: devops/ibm/ibm-notification-config + IBM_HELM_DEPLOY_PATH: devops/ibm/ibm-notification-deploy include: - project: "osdu/platform/ci-cd-pipelines" diff --git a/devops/ibm/ibm-notification-config/.helmignore b/devops/ibm/ibm-notification-config/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..0e8a0eb36f4ca2c939201c0d54b5d82a1ea34778 --- /dev/null +++ b/devops/ibm/ibm-notification-config/.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/devops/ibm/ibm-notification-config/Chart.yaml b/devops/ibm/ibm-notification-config/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..23179e0fc985545c242132019a399a9c7c96b81c --- /dev/null +++ b/devops/ibm/ibm-notification-config/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: ibm-notification-config +description: A Helm chart for Kubernetes + +# 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: "1.16.0" diff --git a/devops/ibm/ibm-notification-config/templates/configmap.yml b/devops/ibm/ibm-notification-config/templates/configmap.yml new file mode 100644 index 0000000000000000000000000000000000000000..80939086663708d603f5cd652c5718bb4db35bc1 --- /dev/null +++ b/devops/ibm/ibm-notification-config/templates/configmap.yml @@ -0,0 +1,84 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ .Values.conf.configmap }}" +data: + #common + LOG_LEVEL: "{{ .Values.data.logLevel }}" + LOG_PREFIX: "{{ .Values.data.logPrefix }}" + JAVA_APP_JAR: "{{ .Values.data.javaAppJar }}" + server.port: "{{ .Values.data.serverPort }}" + server.servlet.context-path: "{{ .Values.data.contextPath }}" + spring.main.allow-bean-definition-overriding: "{{ .Values.data.beanDefOverriding }}" + ACCEPT_HTTP: "{{ .Values.data.acceptHttp }}" + cache.expiration: "{{ .Values.data.cacheExpiration }}" + cache.maxSize: "{{ .Values.data.cahceMaxSize }}" + ibm.health-check-uri: "{{ .Values.data.healthCheckUri }}" + logging.level.org.opengroup.osdu: "{{ .Values.data.loggingLevelOsdu }}" + logging.level.org.springframework.web: "{{ .Values.data.loggingLevelSpring }}" + + #API + AUTHORIZE_API: "http://{{ .Release.Name }}-ibm-entitlement-deploy:8080/api/entitlements/v2" + ENTITLEMENT_URL: "http://{{ .Release.Name }}-ibm-entitlement-deploy:8080/api/entitlements/v2" + REGISTER_API: "http://{{ .Release.Name }}-ibm-register-deploy:8080/api/register/v1" + app.register: "http://{{ .Release.Name }}-ibm-register-deploy:8080/api/register/v1" + PARTITION_API: "http://{{ .Release.Name }}-ibm-partition-deploy:8080/api/partition/v1" + partition.api: "http://{{ .Release.Name }}-ibm-partition-deploy:8080/api/partition/v1" + POLICY_API: "http://{{ .Release.Name }}-ibm-policy-deploy:8080/api/policy/v1" + LEGALTAG_API: "http://{{ .Release.Name }}-ibm-legal-deploy:8080/api/legal/v1" + STORAGE_API: "http://{{ .Release.Name }}-ibm-storage-deploy:8080/api/storage/v2" + ENVIRONMENT: "{{ .Values.data.deployEnv }}" # DEPLOYMENT_ENVIRONMENT + + #DB + ibm.db.url: "http://{{ .Release.Name }}-couchdb:5984" + ibm.db.user: "{{ .Values.data.dbUser }}" + ibm.db.password: "{{ .Values.data.dbPassw }}" + + #ENV + ibm.env.prefix: "{{ .Values.data.envPrefix }}" + ibm.env.prefix_project: "{{ .Values.data.envPrefixProject }}" + + #KEYCLOAK + ibm.keycloak.endpoint_url: "keycloak-discovery:8080" + ibm.keycloak.realm: "{{ .Values.data.keycloakRealm }}" + ibm.keycloak.useremail: "{{ .Values.data.keycloakUserEmail }}" + + #tenant-validation + partition.keycloak.client_id: "{{ .Values.data.pKCClientId }}" + partition.keycloak.client_secert: "{{ .Values.data.pKCClientSecret }}" + partition.keycloak.grant_type: "{{ .Values.data.pKCGrantType }}" + partition.keycloak.password: "{{ .Values.data.pKCPassword }}" + partition.keycloak.realm: "{{ .Values.data.pKCRealm }}" + partition.keycloak.url: "{{ .Values.data.pKCEndPointHost }}" + partition.keycloak.user: "{{ .Values.data.pKCUser }}" + partition.keycloak.accept_http: "{{ .Values.data.pKAcceptHttp }}" + tenantCache.exp.time.in.second: "{{ .Values.data.tenantCacheExpiryInSec }}" + + #AMQ + amqphub.amqp10jms.password: "{{ .Values.data.amqpPassword }}" + amqphub.amqp10jms.username: "{{ .Values.data.amqpUserName }}" + amqphub.amqp10jms.remote-url: "{{ .Values.data.amqpURL }}" + + #minio + ibm.cos.endpoint_url: "http://{{ .Release.Name }}-minio:9000" + + #accesskey and secretkey of minio - refer deployment yaml + ibm.cos.access_key: "{{ .Values.data.accessKey }}" + ibm.cos.secret_key: "{{ .Values.data.secretKey }}" + IBM_COS_REGION: us-east-1 + + #NOTIFICATION + ibm.notification.db.url: "http://{{ .Release.Name }}-couchdb:5984" + ibm.notification.db.user: "{{ .Values.data.dbUser }}" + ibm.notification.db.password: "{{ .Values.data.dbUser }}" + keycloak.user: "{{ .Values.data.kcUser }}" + keycloak.password: "{{ .Values.data.kcPassword }}" + + #added based on LENS logs + INTEGRATION_TEST_AUDIENCES: "notused" + CRON_JOB_EXPECTED_IP: 0:0:0:0:0:0:0:1 + SUBSCRIBER_SECRET: 7a786376626e + SUBSCRIBER_PRIVATE_KEY_ID: testkey + RECORDS_CHANGE_PUBSUB_ENDPOINT: "https://notification/push-handlers/records-changed" + ENTITLEMENTS_API: "http://{{ .Release.Name }}-ibm-entitlement-deploy:8080/api/entitlements/v2" + app.entitlements: "http://{{ .Release.Name }}-ibm-entitlement-deploy:8080/api/entitlements/v2" diff --git a/devops/ibm/ibm-notification-config/values.yaml b/devops/ibm/ibm-notification-config/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e005a9f8ebe51161b5ac55851cf440ed5a53a218 --- /dev/null +++ b/devops/ibm/ibm-notification-config/values.yaml @@ -0,0 +1,56 @@ +data: + #common + logLevel: "INFO" + logPrefix: notification + javaAppJar: "/deployments/*-spring-boot.jar" + serverPort: 8080 + contextPath: "/api/notification/v1" + beanDefOverriding: true + acceptHttp: true + cacheExpiration: 9000 + cahceMaxSize: 2000 + healthCheckUri: "/api/notification/v1/_ah/liveness_check,/api/notification/v1/_ah/readiness_check,/api/notification/v1/info,/api/notification/v1/api-docs" + loggingLevelOsdu: debug + loggingLevelSpring: debug + + #API + authorizeAPI: http://TBD:8080/api/entitlements/v2 + patitionAPI: http://tbd:8080/api/partition/v1 + policyAPI: http://tbd:8080/api/policy/v1 + deployEnv: CLOUD + + #DB + dbURL: http://tbd:5984 + dbUser: admin + dbPassw: tbd + + #ENV + envPrefix: ibm-iks + envPrefixProject: ibm-ibm-build + + #KEYCLOAK + keycloakEndPointHost: tbd + keycloakRealm: OSDU + keycloakUserEmail: admin-sa@ibm.com + kcUser: osdu-bvt + kcPassword: changeit + + #tenant-validation + pKCClientId: partition-service + pKCClientSecret: tbd + pKCGrantType: password + pKCPassword: changeit + pKCRealm: OSDU + pKCEndPointHost: tbd + pKCUser: partition-service-admin + pKAcceptHttp: true + tenantCacheExpiryInSec: 10000 + + #AMQ + amqpPassword: TBD + amqpUserName: TBD + amqpURL: "amqp://ex-aao-amqp-0-svc:5672" + +conf: + configmap: "notification-config" + \ No newline at end of file diff --git a/devops/ibm/ibm-notification-deploy/.helmignore b/devops/ibm/ibm-notification-deploy/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..0e8a0eb36f4ca2c939201c0d54b5d82a1ea34778 --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/.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/devops/ibm/ibm-notification-deploy/Chart.yaml b/devops/ibm/ibm-notification-deploy/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fd434eee4471a71c08b22e36952d7e0681f7de62 --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: ibm-notification-deploy +description: A Helm chart for Kubernetes + +# 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: "1.16.0" diff --git a/devops/ibm/ibm-notification-deploy/templates/NOTES.txt b/devops/ibm/ibm-notification-deploy/templates/NOTES.txt new file mode 100644 index 0000000000000000000000000000000000000000..433e5ce882a54cc39b8d54f1feff910bab8829fa --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "ibm-notification-deploy.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "ibm-notification-deploy.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ibm-notification-deploy.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "ibm-notification-deploy.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/devops/ibm/ibm-notification-deploy/templates/_helpers.tpl b/devops/ibm/ibm-notification-deploy/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..bad15fce957c1e27b6d023ea1c1f0930ceee93fa --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "ibm-notification-deploy.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 "ibm-notification-deploy.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 "ibm-notification-deploy.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ibm-notification-deploy.labels" -}} +helm.sh/chart: {{ include "ibm-notification-deploy.chart" . }} +{{ include "ibm-notification-deploy.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ibm-notification-deploy.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ibm-notification-deploy.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ibm-notification-deploy.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ibm-notification-deploy.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/devops/ibm/ibm-notification-deploy/templates/deployment.yaml b/devops/ibm/ibm-notification-deploy/templates/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d69598016ab4f8a9925aa276e64c90cfb9cf161f --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/deployment.yaml @@ -0,0 +1,109 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "ibm-notification-deploy.fullname" . }} + labels: + {{- include "ibm-notification-deploy.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "ibm-notification-deploy.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "ibm-notification-deploy.selectorLabels" . | nindent 8 }} + sidecar.istio.io/inject: "{{ .Values.sidecarIstioInjected }}" + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "ibm-notification-deploy.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - name: {{ .Values.initimage.name }} + image: {{ .Values.initimage.initrepository }}:{{ .Values.initimage.tag }} + imagePullPolicy: {{ .Values.initimage.pullPolicy }} + command: ['sh', '-c', './health_probe.sh $(HEALTH_URI)/info && sleep 5'] + env: + - name: HEALTH_URI + valueFrom: + configMapKeyRef: + name: notification-config + key: AUTHORIZE_API + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: amqphub.amqp10jms.password + valueFrom: + secretKeyRef: + key: AMQ_PASSWORD + name: ex-aao-credentials-secret + - name: amqphub.amqp10jms.username + valueFrom: + secretKeyRef: + key: AMQ_USER + name: ex-aao-credentials-secret + - name: partition.keycloak.client_secert + valueFrom: + secretKeyRef: + key: partition_service_secret_data + name: props-secret-generated-password + - name: ibm.db.password + valueFrom: + secretKeyRef: + key: adminPassword + name: {{ .Release.Name }}-couchdb + - name: partition.keycloak.client_secert + valueFrom: + secretKeyRef: + key: partition_service_secret_data + name: props-secret-generated-password + - name: ibm.keycloak.endpoint_url + valueFrom: + configMapKeyRef: + key: partition.keycloak.url + name: partition-config + - name: ibm.keycloak.client_secret + valueFrom: + secretKeyRef: + key: osdu_login_secret_data + name: props-secret-generated-password + - name: partition.keycloak.url + valueFrom: + configMapKeyRef: + key: partition.keycloak.url + name: partition-config + envFrom: + - configMapRef: + name: "{{ .Values.conf.configmap }}" + ports: + - name: http + containerPort: 8080 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/devops/ibm/ibm-notification-deploy/templates/hpa.yaml b/devops/ibm/ibm-notification-deploy/templates/hpa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ff2267eb73ec8e5449b0d3a0ff222c327cadfc3f --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "ibm-notification-deploy.fullname" . }} + labels: + {{- include "ibm-notification-deploy.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "ibm-notification-deploy.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/devops/ibm/ibm-notification-deploy/templates/ingress.yaml b/devops/ibm/ibm-notification-deploy/templates/ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..13a560acd369cd70424444217a1b516b3a545cb5 --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "ibm-notification-deploy.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "ibm-notification-deploy.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/devops/ibm/ibm-notification-deploy/templates/istio-authzpolicy.yaml b/devops/ibm/ibm-notification-deploy/templates/istio-authzpolicy.yaml new file mode 100644 index 0000000000000000000000000000000000000000..520fef3bdfa76536f3d388f0bd120e90dc94aa86 --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/istio-authzpolicy.yaml @@ -0,0 +1,19 @@ +apiVersion: security.istio.io/v1beta1 +kind: AuthorizationPolicy +metadata: + name: {{ .Values.conf.appName }}-authz-policy +spec: + selector: + matchLabels: + {{- include "ibm-notification-deploy.selectorLabels" . | nindent 6 }} + action: DENY + rules: + - from: + - source: + notRequestPrincipals: + - '*' + to: + - operation: + notPaths: + - '*/v1/api-docs' + - /api/notification/v1/info diff --git a/devops/ibm/ibm-notification-deploy/templates/istio-virtualservice.yaml b/devops/ibm/ibm-notification-deploy/templates/istio-virtualservice.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bda0097c76fb94094eb19a16b4d4e6d585a521cb --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/istio-virtualservice.yaml @@ -0,0 +1,42 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: {{ .Values.conf.appName }}-vs +spec: + gateways: + - osdu-gateway + hosts: + {{- if .Values.conf.domain }} + - {{ printf "osdu.%s" .Values.conf.domain | quote }} + {{- else if .Values.conf.loadbalancerIP}} + - {{ (index (lookup "v1" "Service" "istio-ingress" "istio-ingress").status.loadBalancer.ingress 0).ip }} + {{- else if .Values.conf.loadbalancerHN}} + - {{ (index (lookup "v1" "Service" "istio-ingress" "istio-ingress").status.loadBalancer.ingress 0).hostname }} + {{- else }} + - "*" + {{- end }} + http: + - corsPolicy: + allowCredentials: true + allowHeaders: + - Authorization + - Data-Partition-Id + - Correlation-Id + - Content-Type + allowMethods: + - POST + - GET + - PATCH + - PUT + - DELETE + allowOrigins: + - prefix: '*' + maxAge: 60m + match: + - uri: + prefix: /api/notification/ + route: + - destination: + host: {{ .Release.Name }}-ibm-notification-deploy + port: + number: 8080 diff --git a/devops/ibm/ibm-notification-deploy/templates/service.yaml b/devops/ibm/ibm-notification-deploy/templates/service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b5796941c82b31a21529b3a794fa400f5e934b13 --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ibm-notification-deploy.fullname" . }} + labels: + {{- include "ibm-notification-deploy.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "ibm-notification-deploy.selectorLabels" . | nindent 4 }} diff --git a/devops/ibm/ibm-notification-deploy/templates/serviceaccount.yaml b/devops/ibm/ibm-notification-deploy/templates/serviceaccount.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0754fc9adf165ee4d11f672d8acf3ec75d3af290 --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ibm-notification-deploy.serviceAccountName" . }} + labels: + {{- include "ibm-notification-deploy.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/devops/ibm/ibm-notification-deploy/templates/tests/test-connection.yaml b/devops/ibm/ibm-notification-deploy/templates/tests/test-connection.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ca9a9f0de1ef28ecff73ebd58e393efd52068856 --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "ibm-notification-deploy.fullname" . }}-test-connection" + labels: + {{- include "ibm-notification-deploy.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "ibm-notification-deploy.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/devops/ibm/ibm-notification-deploy/values.yaml b/devops/ibm/ibm-notification-deploy/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..913e213c90c1fcd4a1e23d7dec4257694f38b1d0 --- /dev/null +++ b/devops/ibm/ibm-notification-deploy/values.yaml @@ -0,0 +1,100 @@ +# Default values for ibm-notification-deploy. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +sidecarIstioInjected: "true" + +image: + repository: community.opengroup.org:5555/osdu/platform/system/notification/os-notification-ibm + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "release-0.14-apr22" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +initimage: + name: dependency-check + initrepository: community.opengroup.org:5555/osdu/platform/deployment-and-operations/ibm-osdu-provisioning/k8s-healthprobe + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "v2.0" +conf: + configmap: "notification-config" + appName: "notification" + + #either of one of doman or loadbalancer. If not present * + #domain: iks.com + #loadbalancerIP: 169.48.137.140 +init: + configmap: "notification-config" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 3 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}