Skip to content

Commit

Permalink
OPSEXP-1858 create a chart for ms Teams connector (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
slohe1 authored May 18, 2023
1 parent ce62523 commit 1ece353
Show file tree
Hide file tree
Showing 13 changed files with 394 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/alfresco-connector-msteams/.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/
6 changes: 6 additions & 0 deletions charts/alfresco-connector-msteams/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: alfresco-common
repository: https://alfresco.github.io/alfresco-helm-charts/
version: 2.0.0
digest: sha256:04d458edc1a42ae7a4e4bc73d5872cc5cab9ef5960e5b6226af605a661bff71f
generated: "2023-05-16T18:14:54.877997+05:30"
10 changes: 10 additions & 0 deletions charts/alfresco-connector-msteams/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: alfresco-connector-msteams
description: A Helm chart for deploying Alfresco connector msteams service
type: application
version: 0.1.0-alpha.0
appVersion: "2.0.0-A2"
dependencies:
- name: alfresco-common
version: 2.0.0
repository: https://alfresco.github.io/alfresco-helm-charts/
55 changes: 55 additions & 0 deletions charts/alfresco-connector-msteams/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# alfresco-connector-msteams

![Version: 0.1.0-alpha.0](https://img.shields.io/badge/Version-0.1.0--alpha.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.0-A2](https://img.shields.io/badge/AppVersion-2.0.0--A2-informational?style=flat-square)

A Helm chart for deploying Alfresco connector msteams service

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 2.0.0 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| alfresco.baseUrl | string | `"change_me_alf_base_url"` | |
| alfresco.digitalWorkspace.contextPath | string | `"/workspace/"` | |
| environment | string | `nil` | |
| global.alfrescoRegistryPullSecrets | string | `"quay-registry-secret"` | |
| image.internalPort | int | `3978` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"quay.io/alfresco/alfresco-ms-teams-service"` | |
| image.tag | string | `"2.0.0-A2"` | |
| ingress.extraAnnotations | string | `nil` | |
| ingress.path | string | `"/ms-teams-service"` | |
| ingress.tls | list | `[]` | |
| livenessProbe.initialDelaySeconds | int | `10` | |
| livenessProbe.periodSeconds | int | `20` | |
| livenessProbe.timeoutSeconds | int | `10` | |
| microsoft.app.id | string | `"change_me_app_id"` | |
| microsoft.app.oauth.connectionName | string | `"alfresco"` | |
| microsoft.app.password | string | `"change_me_app_pwd"` | |
| nodeSelector | object | `{}` | |
| podSecurityContext.runAsNonRoot | bool | `true` | |
| podSecurityContext.runAsUser | int | `33041` | |
| readinessProbe.initialDelaySeconds | int | `20` | |
| readinessProbe.periodSeconds | int | `60` | |
| readinessProbe.timeoutSeconds | int | `10` | |
| replicaCount | int | `2` | |
| resources.limits.cpu | string | `"1"` | |
| resources.limits.memory | string | `"1000Mi"` | |
| resources.requests.cpu | string | `"0.5"` | |
| resources.requests.memory | string | `"1000Mi"` | |
| service.externalPort | int | `80` | |
| service.name | string | `"ms-teams-service"` | |
| service.type | string | `"ClusterIP"` | |
| strategy.rollingUpdate.maxSurge | int | `1` | |
| strategy.rollingUpdate.maxUnavailable | int | `0` | |
| teams.chat.filenameEnabled | bool | `true` | |
| teams.chat.imageEnabled | bool | `true` | |
| teams.chat.metadataEnabled | bool | `true` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
8 changes: 8 additions & 0 deletions charts/alfresco-connector-msteams/ci/default-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
replicaCount: 1
resources:
requests:
cpu: "0.01"
memory: "256Mi"
limits:
cpu: "1"
memory: "500Mi"
51 changes: 51 additions & 0 deletions charts/alfresco-connector-msteams/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "alfresco-connector-msteams.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 "alfresco-connector-msteams.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 "alfresco-connector-msteams.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "alfresco-connector-msteams.selectorLabels" -}}
app.kubernetes.io/name: {{ include "alfresco-connector-msteams.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "alfresco-connector-msteams.fullname" . }}
labels:
{{- include "alfresco-connector-msteams.labels" . | nindent 4 }}
data:
{{- if .Values.environment }}
{{- range $key, $val := .Values.environment }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
ALFRESCO_BASE_URL: "{{ .Values.alfresco.baseUrl }}"
ALFRESCO_DIGITAL_WORKSPACE_CONTEXT_PATH: "{{ .Values.alfresco.digitalWorkspace.contextPath }}"
MICROSOFT_APP_ID: "{{ .Values.microsoft.app.id }}"
MICROSOFT_APP_PASSWORD: "{{ .Values.microsoft.app.password }}"
MICROSOFT_APP_OAUTH_CONNECTION_NAME: "{{ .Values.microsoft.app.oauth.connectionName }}"
TEAMS_CHAT_FILENAME_ENABLED: "{{ .Values.teams.chat.filenameEnabled }}"
TEAMS_CHAT_METADATA_ENABLED: "{{ .Values.teams.chat.metadataEnabled }}"
TEAMS_CHAT_IMAGE_ENABLED: "{{ .Values.teams.chat.imageEnabled }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "alfresco-connector-msteams.fullname" . }}
labels:
{{- include "alfresco-connector-msteams.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "alfresco-connector-msteams.selectorLabels" . | nindent 6 }}
strategy:
type: RollingUpdate
rollingUpdate:
{{- toYaml .Values.strategy.rollingUpdate | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/config-connector-msteams.yaml") . | sha256sum }}
labels:
{{- include "alfresco-connector-msteams.selectorLabels" . | nindent 8 }}
spec:
{{- include "component-pod-security-context" .Values | indent 4 }}
{{- if .Values.nodeSelector }}
nodeSelector: {{- .Values.nodeSelector | toYaml | nindent 8 }}
{{- end }}
{{- include "alfresco-content-services.imagePullSecrets" . | indent 6 }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 10
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- {{ template "alfresco-connector-msteams.name" . }}
- key: app.kubernetes.io/instance
operator: In
values:
- {{ .Release.Name }}
topologyKey: failure-domain.beta.kubernetes.io/zone
- weight: 5
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- {{ template "alfresco-connector-msteams.name" . }}
- key: app.kubernetes.io/instance
operator: In
values:
- {{ .Release.Name }}
topologyKey: kubernetes.io/hostname
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- include "component-security-context" .Values.msTeams | indent 8 }}
envFrom:
- configMapRef:
name: {{ template "alfresco-connector-msteams.fullname" . }}
ports:
- containerPort: {{ .Values.image.internalPort }}
resources: {{- toYaml .Values.resources | nindent 12 }}
readinessProbe:
tcpSocket:
port: {{ .Values.image.internalPort }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
livenessProbe:
tcpSocket:
port: {{ .Values.image.internalPort }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
failureThreshold: 1
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{- $serviceName := (include "alfresco-connector-msteams.fullname" .) -}}
{{- $servicePort := .Values.service.externalPort -}}
apiVersion: {{ template "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $serviceName }}
labels:
{{- include "alfresco-connector-msteams.labels" . | nindent 4 }}
annotations:
kubernetes.io/ingress.class: "nginx"
{{- if .Values.ingress.extraAnnotations }}
{{ toYaml .Values.ingress.extraAnnotations }}
{{- end }}

spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
- http:
paths:
- path: {{ .Values.ingress.path }}
{{- if eq "true" (include "common.ingress.supportsPathType" .) }}
pathType: Prefix
{{- end }}
backend: {{- include "common.ingress.backend" (dict "serviceName" $serviceName "servicePort" $servicePort "context" $) | nindent 10 }}
{{- if .Values.ingress.hostName }}
host: {{ tpl .Values.ingress.hostName $ }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "alfresco-connector-msteams.fullname" . }}
labels:
{{- include "alfresco-connector-msteams.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.image.internalPort }}
name: {{ .Values.service.name }}
selector:
{{- include "alfresco-connector-msteams.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
suite: test connector-msteams deployment
templates:
- deployment-connector-msteams.yaml
- config-connector-msteams.yaml
tests:
- it: should have basic metadata in place
values: &testvalues
- values/test_values.yaml
asserts:
- equal:
path: metadata.name
value: RELEASE-NAME-alfresco-connector-msteams
template: deployment-connector-msteams.yaml

- it: should render cpu and memory limits
values: *testvalues
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
cpu: "0.5"
memory: "1000Mi"
limits:
cpu: "1"
memory: "1000Mi"
template: deployment-connector-msteams.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
global:
tracking:
sharedsecret: dummy
alfrescoRegistryPullSecrets: secretsecret
Loading

0 comments on commit 1ece353

Please sign in to comment.