Commit bb93d6d6 authored by aimansharief's avatar aimansharief
Browse files

Issue KN-767 feat: Added Terraform scripts and Helmcharts for one click installation

No related merge requests found
Showing with 10251 additions and 0 deletions
+10251 -0
MIT License
Copyright (c) 2022 Sunbird Obsrv
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# sunbird-infra-provision
Infra provision on Azure
Pre-requisites:
Install azure cli(az) tool on local machine and login to azure account with "az login" command.
Create a azure service account to be used for the infra provision.
Copy the ingestion spec to any folder and share the path in variables
Replace the default values in infra-provision/azure/vars.tf .
Steps:
Run create shell script and provide option input as "azure" .
Destroy infra on Azure
Steps:
Run destroy shell script with option as "azure" and append --auto-approve to continue without confirmation.
Infra provision on local
Pre-requisites:
For local provision, kind provider is used to provision the cluster.
Steps:
Run shell script and provide option as "local"
Destroy infra on local
Steps:
Run destroy shell script and provide option as "local" append --auto-approve to continue without confirmation.
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: cassandra
version: 0.1.0
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.namespace }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: cassandra:3.11.11
ports:
- containerPort: {{ .Values.network.port }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-db
namespace: {{ .Values.namespace }}
labels:
app: {{ .Chart.Name }}
spec:
ports:
- port: {{ .Values.network.port }}
selector:
app: {{ .Chart.Name }}
\ No newline at end of file
namespace: knowlg-db
replicaCount: 1
network:
port: 9042
\ No newline at end of file
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
\ No newline at end of file
name: druid-cluster
version: 0.1.0
appVersion: 0.21.1
description: Helm chart to deploy a druid cluster on Kubernetes
keywords:
- druid
- zookeeper
- postgres
maintainers:
- name: druid-operator-maintainers
sources:
- https://github.com/druid-io/druid-operator
engine: gotpl
home: https://github.com/druid-io/druid-operator
dependencies:
- name: zookeeper
version: 10.0.0
repository: https://charts.bitnami.com/bitnami
condition: zookeeper.enabled
File added
This diff is collapsed.
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "druid-cluster.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "name" -}}
{{- default .Release.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 "druid-cluster.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 "druid-cluster.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
App config names
*/}}
{{- define "druid-cluster.appConfigName" -}}
{{- $.Release.Name -}}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "druid-cluster.selectorLabels" -}}
app.kubernetes.io/name: {{ include "druid-cluster.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
This diff is collapsed.
# apiVersion: autoscaling/v2beta2
# kind: HorizontalPodAutoscaler
# metadata:
# name: "{{ .Release.Namespace }}-historicals"
# namespace: {{ .Values.namespace }}
# spec:
# scaleTargetRef:
# apiVersion: apps/v1
# kind: StatefulSet
# name: "{{ .Release.Namespace }}-{{ .Values.druid_env }}-historicals"
# # behavior:
# # scaleUp:
# # stabilizationWindowSeconds: 10
# # scaleDown:
# # stabilizationWindowSeconds: 20
# minReplicas: 1
# maxReplicas: 2
# metrics:
# - type: Object
# object:
# metric:
# name: pv_used_percentage
# describedObject:
# apiVersion: v1
# kind: persistentvolumeclaim
# name: "historical-volume-{{ .Release.Namespace }}-{{ .Values.druid_env }}-historicals-0"
# target:
# type: Utilization
# averageValue: 20
This diff is collapsed.
apiVersion: v2
name: druid-operator
description: Druid Kubernetes Operator
# 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.1
# 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.
appVersion: 0.0.7
Refer to https://github.com/druid-io/druid-operator/blob/master/docs/README.md to get started.
{{/*
Expand the name of the chart.
*/}}
{{- define "druid-operator.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 "druid-operator.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 "druid-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "druid-operator.labels" -}}
helm.sh/chart: {{ include "druid-operator.chart" . }}
{{ include "druid-operator.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "druid-operator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "druid-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "druid-operator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "druid-operator.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "druid-operator.fullname" . }}
labels:
{{- include "druid-operator.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "druid-operator.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "druid-operator.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "druid-operator.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command:
- /manager
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ tpl $value $ | quote }}
{{- end }}
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
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.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
{{- if .Values.env.WATCH_NAMESPACE }}
kind: Role
{{- else }}
kind: ClusterRole
{{- end }}
metadata:
{{- if .Values.env.WATCH_NAMESPACE }}
namespace: {{ .Values.env.WATCH_NAMESPACE }}
{{- end }}
name: {{ template "druid-operator.fullname" . }}
labels:
{{- include "druid-operator.labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- pods
- configmaps
- services
- persistentvolumeclaims
verbs:
- list
- watch
- create
- update
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- apps
resources:
- statefulsets
- deployments
verbs:
- list
- watch
- create
- update
- delete
- apiGroups:
- autoscaling
resources:
- horizontalpodautoscalers
verbs:
- list
- watch
- create
- update
- patch
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- list
- watch
- create
- update
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- list
- watch
- create
- update
- apiGroups:
- druid.apache.org
resources:
- druids
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- druid.apache.org
resources:
- druids/status
verbs:
- get
- update
- patch
{{- end }}
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
{{- if .Values.env.WATCH_NAMESPACE }}
kind: RoleBinding
{{- else }}
kind: ClusterRoleBinding
{{- end }}
metadata:
{{- if .Values.env.WATCH_NAMESPACE }}
namespace: {{ .Values.env.WATCH_NAMESPACE }}
{{- end }}
name: {{ template "druid-operator.fullname" . }}
labels:
{{- include "druid-operator.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "druid-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: {{ if .Values.env.WATCH_NAMESPACE }} Role {{ else }} ClusterRole {{ end }}
name: {{ template "druid-operator.fullname" . }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment