Skip to content

Commit

Permalink
Initialize the source code for Microsoft Synapse Link Arcane plugin (#6)
Browse files Browse the repository at this point in the history
* Initialize the source code for Microsoft Synapse Link Arcane plugin

* Fix target branch name for validation action

* Build fix

* Move the .helm directory

* Add empty readme file
  • Loading branch information
s-vitaliy authored Jan 13, 2025
1 parent 065920e commit e103d74
Show file tree
Hide file tree
Showing 38 changed files with 2,810 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ name: Run tests with coverage
on:
push:
branches:
- scala
- main
pull_request:
branches:
- scala

- main
env:
PROJECT_NAME: Arcane.Stream.MicrosoftSynapseLink
REGISTRY: ghcr.io
Expand Down
23 changes: 23 additions & 0 deletions .helm/.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/
8 changes: 8 additions & 0 deletions .helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
name: arcane-stream-microsoft-synapse-link
description: Microsoft Synapse Link Stream for Arcane Operator
type: application

version: 0.0.0

appVersion: 0.0.0
131 changes: 131 additions & 0 deletions .helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "app.name" -}}
{{- default .Chart.Name | 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 "app.fullname" -}}
{{- $name := .Chart.Name }}
{{- if contains .Release.Name $name}}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "app.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "app.labels" -}}
helm.sh/chart: {{ include "app.chart" . }}
{{ include "app.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.jobTemplateSettings.additionalLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}

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

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

{{/*
Generage image reference based on image repository and tag
*/}}
{{- define "app.image" -}}
{{- printf "%s:%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) }}
{{- end }}

{{/*
Stream class labels
*/}}
{{- define "streamclass.labels" -}}
helm.sh/chart: {{ include "app.chart" . }}
{{ include "app.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.additionalLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}

{{/*
Generate the job editor cluster role name
*/}}
{{- define "app.clusterRole.jobEditor" -}}
{{- if .Values.rbac.clusterRole.jobEditor.nameOverride }}
{{- .Values.rbac.clusterRole.jobEditor.nameOverride }}
{{- else }}
{{- printf "%s-job-editor" (include "app.fullname" .) }}
{{- end }}
{{- end }}


{{/*
Generate the Synapse CR viewer cluster role name
*/}}
{{- define "app.clusterRole.synapseStreamViewer" -}}
{{- if .Values.rbac.clusterRole.synapseStreamViewer.nameOverride }}
{{- .Values.rbac.clusterRole.synapseStreamViewer.nameOverride }}
{{- else }}
{{- printf "%s-viewer" (include "app.fullname" .) }}
{{- end }}
{{- end }}

{{/*
Generate the CR editor cluster role name
*/}}
{{- define "app.clusterRole.synapseStreamEditor" -}}
{{- if .Values.rbac.clusterRole.synapseStreamEditor.nameOverride }}
{{- .Values.rbac.clusterRole.synapseStreamEditor.nameOverride }}
{{- else }}
{{- printf "%s-editor" (include "app.fullname" .) }}
{{- end }}
{{- end }}

{{/*
Job template standard labels
*/}}
{{- define "job.labels" -}}
helm.sh/chart: {{ include "app.chart" . }}
{{ include "app.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
{{- with .Values.jobTemplateSettings.additionalLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}
25 changes: 25 additions & 0 deletions .helm/templates/cluster-role-binding-job-editor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.rbac.clusterRole.jobEditor.create .Values.rbac.clusterRoleBindings.create -}}

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "app.clusterRole.jobEditor" . }}
labels:
{{- include "app.labels" $ | nindent 4 }}
{{- with .Values.rbac.clusterRoleBindings.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.rbac.clusterRoleBindings.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ template "app.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "app.clusterRole.jobEditor" . }}

{{- end }}
25 changes: 25 additions & 0 deletions .helm/templates/cluster-role-binding-synapse-editor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.rbac.clusterRole.synapseStreamEditor.create .Values.rbac.clusterRoleBindings.create -}}

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "app.serviceAccountName" . }}-synapse-editor
labels:
{{- include "app.labels" $ | nindent 4 }}
{{- with .Values.rbac.clusterRoleBindings.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.rbac.clusterRoleBindings.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ template "app.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "app.clusterRole.synapseStreamEditor" . }}

{{- end }}
25 changes: 25 additions & 0 deletions .helm/templates/cluster-role-binding-synapse-viewer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.rbac.clusterRole.synapseStreamViewer.create .Values.rbac.clusterRoleBindings.create -}}

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ template "app.serviceAccountName" . }}-synapse-viewer
labels:
{{- include "app.labels" $ | nindent 4 }}
{{- with .Values.rbac.clusterRoleBindings.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.rbac.clusterRoleBindings.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ template "app.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "app.clusterRole.synapseStreamViewer" . }}

{{- end }}
27 changes: 27 additions & 0 deletions .helm/templates/cluster-role-crd-synapse-editor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.rbac.clusterRole.synapseStreamEditor.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "app.clusterRole.synapseStreamEditor" . }}
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
{{- include "app.labels" $ | nindent 4 }}
{{- with .Values.rbac.clusterRole.synapseStreamEditor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.rbac.clusterRole.synapseStreamEditor.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- verbs:
- create
- update
- patch
- delete
apiGroups:
- streaming.sneaksanddata.com
resources:
- microsoft-synapse-streams
- microsoft-synapse-streams/status
{{- end }}
27 changes: 27 additions & 0 deletions .helm/templates/cluster-role-crd-synapse-viewer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.rbac.clusterRole.synapseStreamViewer.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "app.clusterRole.synapseStreamViewer" . }}
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
{{- include "app.labels" $ | nindent 4 }}
{{- with .Values.rbac.clusterRole.synapseStreamViewer.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.rbac.clusterRole.synapseStreamViewer.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- verbs:
- get
- list
- watch
apiGroups:
- streaming.sneaksanddata.com
resources:
- microsoft-synapse-streams
- microsoft-synapse-streams/status
{{- end }}
23 changes: 23 additions & 0 deletions .helm/templates/cluster-role-job-editor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.rbac.clusterRole.jobEditor.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "app.clusterRole.jobEditor" . }}
labels:
rbac.authorization.k8s.io/aggregate-to-edit: "true"
{{- include "app.labels" $ | nindent 4 }}
{{- with .Values.rbac.clusterRole.jobEditor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.rbac.clusterRole.jobEditor.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- verbs:
- patch
apiGroups:
- batch
resources:
- jobs
{{- end }}
Loading

0 comments on commit e103d74

Please sign in to comment.