-
Notifications
You must be signed in to change notification settings - Fork 171
feat: add apl-operator #2151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: add apl-operator #2151
Changes from all commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
21a5b23
feat: add simple-git dependency and new script for apl-operator
CasLubbers 8cdded2
fix: eslint errors
CasLubbers cccc3c2
feat: add apl-operator chart
CasLubbers 5ee7b05
feat: update apl-chart
CasLubbers 704470f
feat: update apl-chart
CasLubbers e4060f2
feat: update apl-chart
CasLubbers 14f4a2b
feat: update apl-chart
CasLubbers 78cf3c9
feat: update apl-chart
CasLubbers 80dcce4
feat: update apl-chart
CasLubbers 677d002
feat: update apl-chart
CasLubbers 4196f52
feat: update apl-chart
CasLubbers 4eb23f8
feat: update operator
CasLubbers 71207ae
feat: update operator
CasLubbers 07bcf24
feat: update operator
CasLubbers 626181b
feat: set correct env dir
CasLubbers d327ebb
feat: set repoPath correctly
CasLubbers 41681bb
fix: errors in main
CasLubbers 6f7634a
fix: errors in main
CasLubbers 6d17b32
feat: add safe directory for git
CasLubbers a836bce
feat: add safe directory for git
CasLubbers 31946f3
feat: add safe directory for git
CasLubbers a69e459
feat: add safe directory for git
CasLubbers 0b60ef2
feat: add safe directory for git
CasLubbers b7bb31c
feat: add safe directory for git
CasLubbers 41fa71d
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot 7365540
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot 65f6b0f
feat: add safe directory for git
CasLubbers 461c24a
feat: add logs
CasLubbers 8d41c03
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot d85742c
feat: add logs
CasLubbers ffaaa37
feat: add logs
CasLubbers fe71e75
feat: add logs
CasLubbers 5149b4a
feat: add logs
CasLubbers b28acb3
feat: add logs
CasLubbers 193704f
feat: add logs
CasLubbers 4efb26e
feat: add logs
CasLubbers 1236a89
feat: add logs
CasLubbers e2455c4
feat: add logs
CasLubbers 2fe9a56
feat: add logs
CasLubbers 6a9f0ff
feat: add logs
CasLubbers 4bda084
feat: add logs
CasLubbers ea3eebf
feat: add logs
CasLubbers 7d9789d
feat: add logs
CasLubbers cceb1c5
feat: test without clone repository
CasLubbers bc8d9f2
feat: use tmp directory
CasLubbers a0f1ad3
fix: remove core label
CasLubbers c675bd2
fix: add back core label
CasLubbers 5ebdade
fix: fix bootstrap
CasLubbers b19578b
fix: operator
CasLubbers 4dd10f2
fix: add git clone back
CasLubbers d3a6f10
fix: remove simple git
CasLubbers ba5490b
fix: remove simple git
CasLubbers 560e58c
fix: add global gitconfig
CasLubbers 93f6074
fix: add global gitconfig
CasLubbers 95eb5c7
fix: rbac rules
CasLubbers 422bb2c
feat: add reconcile loop
CasLubbers 694b9ce
feat: update rbac rules
CasLubbers 09224e4
feat: update rbac rules
CasLubbers 918428e
feat: update rbac rules
CasLubbers 99eeb51
feat: set CI to true
CasLubbers 076cdca
feat: add back simple-git
CasLubbers ebd1625
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot 93646c5
feat: refactor code for apl-operator
CasLubbers 0747f3a
feat: set otomi-pipeliens to false
CasLubbers 7ecfeb8
feat: update secret keys for GIT credentials
CasLubbers 1ddafba
feat: add wait for commits function
CasLubbers 4520607
feat: ignore tests
CasLubbers 37ad25a
feat: change order for gitRepo
CasLubbers 0c8f0bf
feat: update rbac
CasLubbers a223e5e
feat: update rbac
CasLubbers 3364c9e
feat: enhance apply process to support teams-only application
CasLubbers a798cec
feat: refactor pull method to improve change detection and skip logic
CasLubbers 842e338
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot 9d83085
feat: add tests to src/operator
CasLubbers 80daa39
Merge remote-tracking branch 'origin/main' into APL-769
CasLubbers 0c6959b
feat: add migration for apl-operator
CasLubbers 66645dd
feat: add migration for apl-operator
CasLubbers 730828a
feat: add migration for apl-operator
CasLubbers 06f93a0
fix: refactor and review comments
CasLubbers e11d346
fix: tests
CasLubbers 9f5124a
fix: install apl-operator via helm
CasLubbers cab7a88
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot b8964ef
fix: add rootdir to hf install
CasLubbers 3a37647
fix: add migrate function to apply step
CasLubbers 90244e6
fix: check if apl-operator already exists
CasLubbers bac5e5a
fix: add RBAC rules
CasLubbers 64bdab3
fix: set last revision correctly
CasLubbers ed55952
fix: update RBAC
CasLubbers 7839394
feat: set migrate to non-interactive
CasLubbers 567ceab
feat: fix tests
CasLubbers a205042
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot c5db01a
feat: increase retries and timeout
CasLubbers 1de8c2d
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot 65c5b04
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot 341810d
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot 22b04e2
feat: values/apl-operator/apl-operator.gotmpl
CasLubbers f653081
feat: charts/apl-operator/templates/secret.yaml
CasLubbers 6c4b1e3
Merge remote-tracking branch 'origin/main' into APL-769
svcAPLBot 3fca02f
fix: review comments
CasLubbers 877b075
fix: add persistentvolumeclaims
CasLubbers 1f9d699
fix: git values
CasLubbers 26d91e2
fix: test
CasLubbers c056f8e
fix: test
CasLubbers 2839fb1
fix: use cluster admin role for RBAC
CasLubbers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v2 | ||
name: apl-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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The apl-operator has been deployed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "apl-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 "apl-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 "apl-operator.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "apl-operator.labels" -}} | ||
helm.sh/chart: {{ include "apl-operator.chart" . }} | ||
{{ include "apl-operator.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "apl-operator.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "apl-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "apl-operator.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "apl-operator.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: git-config | ||
namespace: {{ .Release.Namespace }} | ||
data: | ||
.gitconfig: | | ||
[safe] | ||
directory = * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "apl-operator.fullname" . }} | ||
labels: | ||
{{- include "apl-operator.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "apl-operator.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "apl-operator.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "apl-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 }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
workingDir: /home/app/stack | ||
command: | ||
- node | ||
- dist/src/operator/main.js | ||
env: | ||
- name: CI | ||
value: "true" | ||
envFrom: | ||
- secretRef: | ||
name: gitea-credentials | ||
- secretRef: | ||
name: apl-sops-secrets | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumeMounts: | ||
- name: apl-values | ||
mountPath: /home/app/stack/env | ||
- name: tmp | ||
mountPath: /tmp | ||
- name: git-config | ||
mountPath: /home/app/.gitconfig | ||
subPath: .gitconfig | ||
volumes: | ||
- name: apl-values | ||
emptyDir: {} | ||
- name: tmp | ||
emptyDir: {} | ||
- name: git-config | ||
configMap: | ||
name: git-config | ||
items: | ||
- key: .gitconfig | ||
path: .gitconfig | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: apl-operator | ||
namespace: {{ .Release.Namespace }} | ||
--- | ||
# Unfortunately, we need to use a cluster-admin role for apl-operator. | ||
# This is because when migrations are applied via Helm, the apl-operator needs to be able to create and update all resources in the cluster. | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: apl-operator-admin | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: cluster-admin | ||
subjects: | ||
- kind: ServiceAccount | ||
name: apl-operator | ||
namespace: {{ .Release.Namespace }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{- $kms := .Values.kms | default dict }} | ||
{{- if hasKey $kms "sops" }} | ||
{{- $v := $kms.sops }} | ||
|
||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: apl-sops-secrets | ||
namespace: {{ .Release.Namespace }} | ||
type: Opaque | ||
data: | ||
{{- with $v.azure }} | ||
AZURE_CLIENT_ID: {{ .clientId | b64enc }} | ||
AZURE_CLIENT_SECRET: {{ .clientSecret | b64enc }} | ||
{{- with .tenantId }} | ||
AZURE_TENANT_ID: {{ . | b64enc }}{{ end }} | ||
{{- with .environment }} | ||
AZURE_ENVIRONMENT: {{ . | b64enc }}{{ end }} | ||
{{- end }} | ||
{{- with $v.aws }} | ||
AWS_ACCESS_KEY_ID: {{ .accessKey | b64enc }} | ||
AWS_SECRET_ACCESS_KEY: {{ .secretKey | b64enc }} | ||
{{- with .region }} | ||
AWS_REGION: {{ . | b64enc }}{{ end }} | ||
{{- end }} | ||
{{- with $v.age }} | ||
SOPS_AGE_KEY: {{ .privateKey | b64enc }} | ||
{{- end }} | ||
{{- with $v.google }} | ||
GCLOUD_SERVICE_KEY: {{ .accountJson | b64enc }} | ||
{{- with .project }} | ||
GOOGLE_PROJECT: {{ . | b64enc }}{{ end }} | ||
{{- with .region }} | ||
GOOGLE_REGION: {{ . | b64enc }}{{ end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: gitea-credentials | ||
namespace: {{ .Release.Namespace }} | ||
type: Opaque | ||
stringData: | ||
GIT_USERNAME: {{ .Values.gitUsername | quote }} | ||
GIT_PASSWORD: {{ .Values.gitPassword | quote }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Default values for apl-operator. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
replicaCount: 1 | ||
|
||
image: | ||
repository: linode/apl-core | ||
pullPolicy: IfNotPresent | ||
# Overrides the image tag whose default is the chart appVersion. | ||
tag: main | ||
|
||
imagePullSecrets: [] | ||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
# Service Account requires access to gitea pod to edit the oauth through CLI commands | ||
serviceAccount: | ||
create: true | ||
name: "apl-operator" | ||
annotations: {} | ||
|
||
podAnnotations: {} | ||
|
||
podSecurityContext: | ||
runAsNonRoot: true | ||
runAsUser: 1001 | ||
runAsGroup: 1001 | ||
fsGroup: 2000 | ||
|
||
securityContext: | ||
capabilities: | ||
drop: | ||
- ALL | ||
readOnlyRootFilesystem: true | ||
runAsNonRoot: true | ||
runAsUser: 1001 | ||
|
||
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 | ||
|
||
|
||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} | ||
|
||
env: {} | ||
|
||
kms: {} | ||
# example: | ||
# sops: | ||
# age: | ||
# privateKey: "AGE-SECRET-KEY-EXAMPLExxxxxxxxxxxxxxxxxxxxxxxx" | ||
|
||
gitPassword: "" | ||
gitUsername: "otomi-admin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.