Skip to content

Commit

Permalink
Merge branch 'tractoai:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
folklinoff authored Jun 3, 2024
2 parents 7320fa2 + e63e005 commit 4c15471
Show file tree
Hide file tree
Showing 9 changed files with 367 additions and 0 deletions.
23 changes: 23 additions & 0 deletions deploy/chart/ytsaurus-identity-sync/.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 deploy/chart/ytsaurus-identity-sync/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: ytsaurus-identity-sync
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: "dev"
62 changes: 62 additions & 0 deletions deploy/chart/ytsaurus-identity-sync/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ytsaurus-identity-sync.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 "ytsaurus-identity-sync.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 "ytsaurus-identity-sync.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "ytsaurus-identity-sync.labels" -}}
helm.sh/chart: {{ include "ytsaurus-identity-sync.chart" . }}
{{ include "ytsaurus-identity-sync.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "ytsaurus-identity-sync.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ytsaurus-identity-sync.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "ytsaurus-identity-sync.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ytsaurus-identity-sync.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions deploy/chart/ytsaurus-identity-sync/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "ytsaurus-identity-sync.fullname" . }}
labels:
{{- include "ytsaurus-identity-sync.labels" . | nindent 4 }}
data:
config.yaml: |-
{{- tpl (required "syncConfig is not provided" .Values.syncConfig) . | nindent 4 }}
92 changes: 92 additions & 0 deletions deploy/chart/ytsaurus-identity-sync/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ytsaurus-identity-sync.fullname" . }}
labels:
{{- include "ytsaurus-identity-sync.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "ytsaurus-identity-sync.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if not .Values.externalSecrets.enabled }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ytsaurus-identity-sync.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "ytsaurus-identity-sync.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 }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: [ "/ytsaurus-active-directory-integration", "--config", "/etc/ytsaurus-active-directory-integration/config.yaml" ]
env:
- name: YT_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "ytsaurus-identity-sync.fullname" . | quote }}
key: YT_TOKEN
{{- if eq .Values.syncSource "ldap" }}
- name: LDAP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "ytsaurus-identity-sync.fullname" . | quote }}
key: LDAP_PASSWORD
{{- else if eq .Values.syncSource "azure" }}
- name: AZURE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "ytsaurus-identity-sync.fullname" . | quote }}
key: AZURE_CLIENT_SECRET
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: config
mountPath: /etc/ytsaurus-active-directory-integration
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "ytsaurus-identity-sync.fullname" . | quote }}
items:
- key: config.yaml
path: config.yaml
{{- with .Values.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 }}
37 changes: 37 additions & 0 deletions deploy/chart/ytsaurus-identity-sync/templates/externalsecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{{- if .Values.externalSecrets.enabled }}
{{- $syncSource := .Values.syncSource | required "neither 'ldap' nor 'azure' is not configured as the syncSource" }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: {{ include "ytsaurus-identity-sync.fullname" . }}
labels:
{{- include "ytsaurus-identity-sync.labels" . | nindent 4 }}
spec:
data:
- remoteRef:
key: {{ required "externalSecretID is not set" .Values.externalSecrets.externalSecretID }}
property: YT_TOKEN
secretKey: YT_TOKEN
{{- if eq $syncSource "ldap" }}
- remoteRef:
key: {{ required "externalSecretID is not set" .Values.externalSecrets.externalSecretID }}
property: LDAP_PASSWORD
secretKey: LDAP_PASSWORD
{{- else if eq $syncSource "azure" }}
- remoteRef:
key: {{ required "externalSecretID is not set" .Values.externalSecrets.externalSecretID }}
property: AZURE_CLIENT_SECRET
secretKey: AZURE_CLIENT_SECRET
{{- end }}
secretStoreRef:
kind: {{ required "secretStore kind is not set" .Values.externalSecrets.secretStore.kind }}
name: {{ required "secretStore name is not set" .Values.externalSecrets.secretStore.name }}
target:
creationPolicy: Owner
deletionPolicy: Delete
name: {{ include "ytsaurus-identity-sync.fullname" . }}
template:
engineVersion: v2
mergePolicy: Replace
type: Opaque
{{- end }}
16 changes: 16 additions & 0 deletions deploy/chart/ytsaurus-identity-sync/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if not .Values.externalSecrets.enabled }}
{{- $syncSource := .Values.syncSource | required "neither 'ldap' nor 'azure' is not configured as the syncSource" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "ytsaurus-identity-sync.fullname" . }}
labels:
{{- include "ytsaurus-identity-sync.labels" . | nindent 4 }}
data:
YT_TOKEN: {{ required "YT_TOKEN is not provided" .Values.yt.token | b64enc | quote }}
{{- if eq $syncSource "ldap" }}
LDAP_PASSWORD: {{ required "LDAP_PASSWORD is not provided" .Values.ldap.password | b64enc | quote }}
{{- else if eq $syncSource "azure" }}
AZURE_CLIENT_SECRET: {{ required "AZURE_CLIENT_SECRET is not provided" .Values.azure.clientSecret | b64enc | quote }}
{{- end }}
{{- end }}
13 changes: 13 additions & 0 deletions deploy/chart/ytsaurus-identity-sync/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "ytsaurus-identity-sync.serviceAccountName" . }}
labels:
{{- include "ytsaurus-identity-sync.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}
91 changes: 91 additions & 0 deletions deploy/chart/ytsaurus-identity-sync/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
replicaCount: 1

image:
repository: ghcr.io/nebius/ytsaurus-active-directory-integration
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "2024-04-19-569ba16"

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
# Specifies whether a service account should be created
create: true
# Automatically mount a ServiceAccount's API credentials?
automount: false
# 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: {}
podLabels: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

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

# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

nodeSelector: {}

tolerations: []

affinity: {}

yt:
proxy: yt-proxy.company.com
token: "yt-secret-token"

# NB: 'ldap' and 'azure' are supported
# syncSource: azure

ldap:
password: "not-here"

azure:
clientSecret: "not-here"

externalSecrets:
enabled: false

secretStore:
kind: SecretStore
name: ""
externalSecretID: ""

syncConfig: |-
# NB: Place your complete raw identity-sync config here

0 comments on commit 4c15471

Please sign in to comment.