Commit db5a2eec authored by Shrikant Garg's avatar Shrikant Garg
Browse files

initial charts

parent b903748c
Pipeline #120895 failed with stages
in 54 seconds
# 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/
apiVersion: v2
name: ibm-indexer-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"
{{/*
Expand the name of the chart.
*/}}
{{- define "ibm-indexer-config.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-indexer-config.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-indexer-config.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "ibm-indexer-config.labels" -}}
helm.sh/chart: {{ include "ibm-indexer-config.chart" . }}
{{ include "ibm-indexer-config.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "ibm-indexer-config.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ibm-indexer-config.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "ibm-indexer-config.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ibm-indexer-config.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ .Values.conf.configmap }}"
data:
#log-and-common
LOG_LEVEL: "{{ .Values.data.logLevel }}"
LOG_PREFIX: "{{ .Values.data.logPrefix }}"
logging.level.org.opengroup.osdu: "{{ .Values.data.loggingLevelOsdu }}"
logging.level.org.springframework.web: "{{ .Values.data.loggingLevelSpring }}"
JAVA_APP_JAR: "{{ .Values.data.javaAppJar }}"
server.servlet.context-path: "{{ .Values.data.contextPath }}"
server.port: "{{ .Values.data.serverPort }}"
spring.main.allow-bean-definition-overriding: "{{ .Values.data.beanDefOverriding }}"
#db
ibm.db.url: "http://{{ .Release.Name }}-couchdb:5984"
ibm.db.user: "{{ .Values.data.dbUser }}"
ibm.env.prefix: "{{ .Values.data.envPrefix }}"
ibm.env.prefix_project: "{{ .Values.data.envPrefixProject }}"
ibm.db.password: "{{ .Values.data.dbPassw }}"
#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
cache.expiration: "{{ .Values.data.cacheExpiration }}"
cache.maxSize: "{{ .Values.data.cahceMaxSize }}"
ibm.health-check-uri: "{{ .Values.data.healthCheckUri }}"
#Authorization
AUTHORIZE_API: "http://{{ .Release.Name }}-ibm-entitlement-deploy:8080/api/entitlements/v2"
DEPLOYMENT_ENVIRONMENT: "{{ .Values.data.deployEnv }}"
#tenant-validation
PARTITION_API: "http://{{ .Release.Name }}-ibm-partition-deploy:8080/api/partition/v1"
partition.keycloak.client_id: "{{ .Values.data.pKCClientId }}"
partition.keycloak.client_secert: "{{ .Values.data.pKCClientSecret }}"
partition.keycloak.grant_type: "{{ .Values.data.grantType }}"
partition.keycloak.password: "{{ .Values.data.pKCPassword }}"
partition.keycloak.realm: "{{ .Values.data.keycloakRealm }}"
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 }}"
data:
# common
javaAppJar: "/deployments/*-spring-boot.jar"
serverPort: 8080
contextPath: "/api/schema-service/v1"
# log
logPrefix: schema
loggingLevelOsdu: debug
loggingLevelSpring: debug
# ibm
beanDefOverriding: true
healthCheckUri: "/api/schema-service/v1/info"
#authorization
#check cm template
authorizeAPI: http://TBD:8080/api/entitlements/v2
deployEnv: CLOUD
#db
#dbURL-refer-configmap-template
dbURL: http://tbd:5984
#get-from-existing secret
dbUser: admin
envPrefix: ibm-iks
#get-from-existing secret
dbPassw: tbd
#minio
accessKey: tbd
secretKey: tbd
#tenant-validation
pKCEndPointHost: referenv
keycloakRealm: OSDU
pKCClientId: partition-service
pKCClientSecret: referenv
grantType: password
pKCPassword: changeit
pKCUser: partition-service-admin
pKAcceptHttp: true
tenantCacheExpiryInSec: 10000
#refer-cm-template
patitionAPI: refer-configmap-template
conf:
configmap: "schema-config"
# 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/
apiVersion: v2
name: ibm-indexer-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"
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-indexer-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-indexer-deploy.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ibm-indexer-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-indexer-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 }}
{{/*
Expand the name of the chart.
*/}}
{{- define "ibm-indexer-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-indexer-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-indexer-deploy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "ibm-indexer-deploy.labels" -}}
helm.sh/chart: {{ include "ibm-indexer-deploy.chart" . }}
{{ include "ibm-indexer-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-indexer-deploy.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ibm-indexer-deploy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "ibm-indexer-deploy.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ibm-indexer-deploy.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ibm-indexer-deploy.fullname" . }}
labels:
{{- include "ibm-indexer-deploy.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "ibm-indexer-deploy.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ibm-indexer-deploy.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "ibm-indexer-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: indexer-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: ibm.db.password
valueFrom:
secretKeyRef:
key: adminPassword
name: {{ .Release.Name }}-couchdb
- name: ibm.cos.access_key
valueFrom:
secretKeyRef:
key: root-user
name: {{ .Release.Name }}-minio
- name: ibm.cos.secret_key
valueFrom:
secretKeyRef:
key: root-password
name: {{ .Release.Name }}-minio
- name: partition.keycloak.client_secert
valueFrom:
secretKeyRef:
key: partition_service_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
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
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 }}
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "ibm-indexer-deploy.fullname" . }}
labels:
{{- include "ibm-indexer-deploy.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "ibm-indexer-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 }}
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "ibm-indexer-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-indexer-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 }}
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: {{ .Values.conf.appName }}-authz-policy
spec:
selector:
matchLabels:
{{- include "ibm-indexer-deploy.selectorLabels" . | nindent 6 }}
action: DENY
rules:
- from:
- source:
notRequestPrincipals:
- '*'
to:
- operation:
notPaths:
- '*/v2/api-docs'
- /api/indexer-service/v1/info
\ No newline at end of file
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:
- match:
- uri:
prefix: /api/indexer-service/
route:
- destination:
host: {{ .Release.Name }}-ibm-indexer-deploy
port:
number: 8080
apiVersion: v1
kind: Service
metadata:
name: {{ include "ibm-indexer-deploy.fullname" . }}
labels: