Skip to content

Commit

Permalink
Merge pull request #8 from Calcagiara/dremioRestServerOperator
Browse files Browse the repository at this point in the history
Added dremio-rest-server-operator
  • Loading branch information
ffais authored Dec 1, 2023
2 parents b92fbe6 + 402f4fa commit 056f42c
Show file tree
Hide file tree
Showing 15 changed files with 739 additions and 0 deletions.
23 changes: 23 additions & 0 deletions helm/digitalhub/charts/dremio-rest-server-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
24 changes: 24 additions & 0 deletions helm/digitalhub/charts/dremio-rest-server-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: dremio-rest-server-operator
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"
88 changes: 88 additions & 0 deletions helm/digitalhub/charts/dremio-rest-server-operator/crds/crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.1
creationTimestamp: null
name: dremiorestservers.operator.dremiorestserver.com
spec:
group: operator.dremiorestserver.com
names:
kind: DremioRestServer
listKind: DremioRestServerList
plural: dremiorestservers
singular: dremiorestserver
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Schema for the dremiorestservers API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Dremio REST Server properties
properties:
containerLimits:
description: Corresponds to resources.limits of a container
properties:
cpu:
type: string
memory:
type: string
type: object
containerRequests:
description: Corresponds to resources.requests of a container
properties:
cpu:
type: string
memory:
type: string
type: object
dremio:
description: Properties to connect to Dremio
properties:
host:
type: string
jdbcProperties:
description: 'Additional JDBC options supported by the Arrow Flight
SQL JDBC driver that will be passed as query parameters (e.g.:
useEncryption=false&disableCertificateVerification=true)'
type: string
password:
type: string
port:
type: integer
user:
type: string
type: object
javaOptions:
description: 'Corresponds to JAVA_TOOL_OPTIONS: on JDK 9+, --add-opens=java.base/java.nio=ALL-UNNAMED
is required'
type: string
tables:
description: Comma-separated list of tables to expose
type: string
type: object
status:
description: Dremio REST Server status
properties:
state:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "dremio-rest-server-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 "dremio-rest-server-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 "dremio-rest-server-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "dremio-rest-server-operator.labels" -}}
helm.sh/chart: {{ include "dremio-rest-server-operator.chart" . }}
{{ include "dremio-rest-server-operator.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/created-by: {{ include "dremio-rest-server-operator.chart" . }}
app.kubernetes.io/part-of: {{ include "dremio-rest-server-operator.fullname" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "dremio-rest-server-operator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dremio-rest-server-operator.name" . }}
app.kubernetes.io/instance: {{ include "dremio-rest-server-operator.fullname" . }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "dremio-rest-server-operator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "dremio-rest-server-operator.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Namespace function
*/}}
{{- define "dremio-rest-server-operator.namespaceCheck" -}}
{{- if .Values.namespaceValues.namespaced }}
{{- if .Values.namespaceValues.namespace }}
{{- .Values.namespaceValues.namespace }}
{{- else }}
{{- .Release.Namespace}}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{ if not .Values.namespaceValues.namespaced }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
{{- include "dremio-rest-server-operator.labels" . | nindent 4 }}
name: {{ .Chart.Name }}-proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Chart.Name }}-proxy-role
subjects:
- kind: ServiceAccount
name: {{ .Chart.Name }}-controller-manager
namespace: {{ .Release.Namespace }}
{{ else }}
{{ end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ if not .Values.namespaceValues.namespaced }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "dremio-rest-server-operator.labels" . | nindent 4 }}
name: {{ .Chart.Name }}-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
{{- include "dremio-rest-server-operator.labels" . | nindent 4 }}
name: {{ .Chart.Name }}-proxy-role
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-configmap
data:
DRS_IMAGE: {{ .Values.conf.drsImage }}
DRS_IMAGE_TAG: {{ .Values.conf.drsImageTag }}
DRS_SERVICE_TYPE: {{ .Values.conf.drsServiceType }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "dremio-rest-server-operator.fullname" . }}
labels:
{{- include "dremio-rest-server-operator.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "dremio-rest-server-operator.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "dremio-rest-server-operator.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "dremio-rest-server-operator.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
terminationGracePeriodSeconds: 10
containers:
- name: {{ .Values.deployment.kubeRbacProxy.name }}
args:
{{- toYaml .Values.deployment.kubeRbacProxy.args | nindent 12 }}
securityContext:
{{- toYaml .Values.deployment.kubeRbacProxy.securityContext | nindent 12 }}
image: "{{ .Values.deployment.kubeRbacProxy.image.repository }}:{{ .Values.deployment.kubeRbacProxy.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
ports:
- name: https
containerPort: {{ .Values.deployment.kubeRbacProxy.ports.containerPort }}
protocol: TCP
resources:
{{- toYaml .Values.deployment.kubeRbacProxy.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Values.deployment.manager.name }}
args:
{{- toYaml .Values.deployment.manager.args | nindent 12 }}
securityContext:
{{- toYaml .Values.deployment.manager.securityContext | nindent 12 }}
image: "{{ .Values.deployment.manager.image.repository }}:{{ .Values.deployment.manager.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
resources:
{{- toYaml .Values.deployment.manager.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
env:
- name: WATCH_NAMESPACE
value: {{ include "dremio-rest-server-operator.namespaceCheck" . | quote }}
envFrom:
- configMapRef:
name: {{ .Chart.Name }}-configmap
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Loading

0 comments on commit 056f42c

Please sign in to comment.