added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -0,0 +1,27 @@
{{- if .Values.ingress.enabled }}
The Athens can be accessed via URL:
{{- else }}
Get the Athens URL by running these commands:
{{- end }}
{{- if (and .Values.ingress.enabled .Values.ingress.tls) }}
{{- range .Values.ingress.tls }}
https://{{ .host }}
{{- end }}
{{- else if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http://{{ .host }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:3000
{{- end }}
@@ -0,0 +1,69 @@
{{/*
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).
*/}}
{{- define "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 -}}
{{/*
Common labels used by all resources in their meta fields.
Includes existing labels for passivity, new standard labels, and user-defined extra labels.
https://helm.sh/docs/chart_best_practices/labels/
https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels
*/}}
{{- define "athens.metaLabels" -}}
{{- /* Allow an app suffix name to be passed in to append to the fullname */}}
{{- $defaultAppName := include "fullname" . }}
{{- $appName := printf "%s%s" $defaultAppName (default "" .appSuffix) }}
{{- /* Existing Legacy labels for passivity */}}
app: {{ $appName }}
chart: {{ template "athens.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- /* New Standard labels */}}
app.kubernetes.io/name: {{ $appName }}
helm.sh/chart: {{ template "athens.chart" . }}
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- /* Include user defined labels */}}
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels }}
{{- end -}}
{{- end }}
{{/*
A common helper for creating the full chart name and version as used by the chart label.
*/}}
{{- define "athens.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Determine the home directory of the current user.
*/}}
{{- define "home" -}}
{{- if not .Values.image.runAsNonRoot -}}
/root
{{- else -}}
/home/athens
{{- end -}}
{{- end -}}
{{- define "serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "fullname" .) .Values.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name | trunc 63 | trimSuffix "-" }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,23 @@
{{- if .Values.sshGitServers -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}-ssh-git-servers
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
data:
ssh_config: |
{{- range $server := .Values.sshGitServers }}
Host {{ $server.host }}
Hostname {{ $server.host }}
User {{ $server.user }}
Port {{ $server.port | default 22 }}
StrictHostKeyChecking no
IdentityFile /ssh-keys/id_rsa-{{ $server.host }}
{{- end }}
git_config: |
{{- range $server := .Values.sshGitServers }}
[url "ssh://{{ $server.user }}@{{ $server.host }}:{{ $server.port }}"]
insteadOf = https://{{ $server.host }}{{ default "" $server.path }}
{{- end }}
{{- end -}}
@@ -0,0 +1,12 @@
{{- if .Values.upstreamProxy.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}-upstream
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
data:
FilterForUpstreamProxy: |-
# FilterFile for fetching modules directly from upstream proxy
D
{{- end -}}
@@ -0,0 +1,415 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fullname" . }}
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- with .Values.strategy }}
strategy:
{{- if eq .type "Recreate" }}
type: Recreate
{{- else }}
{{ toYaml . | nindent 4 }}
{{- end }}
{{- end }}
selector:
matchLabels:
app: {{ include "fullname" . }}
release: "{{ .Release.Name }}"
template:
metadata:
labels:
{{- include "athens.metaLabels" . | nindent 8 }}
annotations:
checksum/upstream: {{ include (print $.Template.BasePath "/config-upstream.yaml") . | sha256sum }}
checksum/ssh-config: {{ include (print $.Template.BasePath "/config-ssh-git-servers.yaml") . | sha256sum }}
checksum/ssh-secret: {{ include (print $.Template.BasePath "/secret-ssh-git-servers.yaml") . | sha256sum }}
{{- if .Values.annotations }}
{{- toYaml .Values.annotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- end }}
{{- if .Values.image.runAsNonRoot }}
securityContext:
runAsUser: 1000
runAsGroup: 1000
{{- end }}
serviceAccountName: {{ include "serviceAccountName" . | quote }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml .Values.image.pullSecrets | nindent 8 }}
{{- end }}
{{- if or .Values.sshGitServers .Values.extraInitContainers }}
initContainers:
{{- if .Values.sshGitServers }}
- name: copy-key-files
image: alpine:3.9
command:
- sh
- -c
args: ["cp {{ include "home" . }}/.ssh/id_rsa* /ssh-keys && chmod 400 /ssh-keys/*"]
volumeMounts:
- name: ssh-keys
mountPath: /ssh-keys
{{- $dot := . -}}
{{- range $server := .Values.sshGitServers }}
{{- if $server.existingSecret }}
- name: ssh-git-servers-secret-{{ $server.host | replace "." "-" }}
mountPath: "{{ include "home" $dot }}/.ssh/id_rsa-{{ $server.host }}"
subPath: {{ $server.existingSecret.subPath | quote }}
{{- else }}
- name: ssh-git-servers-secret
mountPath: {{ include "home" $dot }}/.ssh/id_rsa-{{ $server.host }}
subPath: id_rsa-{{ $server.host }}
{{- end }}
{{- end }}
{{- with .Values.initContainerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with (default .Values.intiContainerResources .Values.initContainerResources) }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.extraInitContainers }}
{{- toYaml .Values.extraInitContainers | nindent 6 }}
{{- end }}
{{- end }}
containers:
- name: {{ include "fullname" . }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
livenessProbe:
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
httpGet:
path: "/healthz"
port: 3000
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
readinessProbe:
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
httpGet:
path: "/readyz"
port: 3000
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
env:
- name: ATHENS_GOGET_WORKERS
value: {{ .Values.goGetWorkers | quote }}
- name: ATHENS_STORAGE_TYPE
value: {{ .Values.storage.type | quote }}
{{- if eq .Values.storage.type "disk"}}
- name: ATHENS_DISK_STORAGE_ROOT
value: {{ .Values.storage.disk.storageRoot | quote }}
{{- else if eq .Values.storage.type "mongo"}}
- name: ATHENS_MONGO_STORAGE_URL
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_MONGO_STORAGE_URL
{{- else if eq .Values.storage.type "s3" }}
- name: AWS_REGION
value: {{ .Values.storage.s3.region | quote }}
- name: ATHENS_S3_BUCKET_NAME
value: {{ .Values.storage.s3.bucket | quote }}
- name: AWS_USE_DEFAULT_CONFIGURATION
value: {{ .Values.storage.s3.useDefaultConfiguration | quote }}
- name: AWS_FORCE_PATH_STYLE
value: {{ .Values.storage.s3.forcePathStyle | quote }}
{{- if .Values.storage.s3.accessKey }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: AWS_ACCESS_KEY_ID
{{- end }}
{{- if .Values.storage.s3.secretKey }}
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: AWS_SECRET_ACCESS_KEY
{{- end }}
{{- if .Values.storage.s3.sessionToken }}
- name: AWS_SESSION_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: AWS_SESSION_TOKEN
{{- end }}
{{- else if eq .Values.storage.type "gcp"}}
- name: GOOGLE_CLOUD_PROJECT
value: {{ .Values.storage.gcp.projectID | quote }}
- name: ATHENS_STORAGE_GCP_BUCKET
value: {{ .Values.storage.gcp.bucket | quote }}
{{- if .Values.storage.gcp.serviceAccount }}
- name: ATHENS_STORAGE_GCP_JSON_KEY
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_STORAGE_GCP_JSON_KEY
{{- end }}
{{- else if eq .Values.storage.type "minio" }}
{{- if .Values.storage.minio.endpoint }}
- name: ATHENS_MINIO_ENDPOINT
value: {{ .Values.storage.minio.endpoint | quote }}
{{- end }}
{{- if .Values.storage.minio.accessKey }}
- name: ATHENS_MINIO_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_MINIO_ACCESS_KEY_ID
{{- end }}
{{- if .Values.storage.minio.secretKey }}
- name: ATHENS_MINIO_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_MINIO_SECRET_ACCESS_KEY
{{- end }}
{{- if .Values.storage.minio.bucket }}
- name: ATHENS_MINIO_BUCKET_NAME
value: {{ .Values.storage.minio.bucket | quote }}
{{- end }}
{{- end }}
{{- if .Values.singleFlight.type }}
- name: ATHENS_SINGLE_FLIGHT_TYPE
value: {{ .Values.singleFlight.type | quote }}
{{- end }}
{{- if eq .Values.singleFlight.type "etcd"}}
{{- if .Values.singleFlight.etcd.endpoints }}
- name: ATHENS_ETCD_ENDPOINTS
value: {{ .Values.singleFlight.etcd.endpoints | quote }}
{{- end }}
{{- else if eq .Values.singleFlight.type "redis"}}
{{- if .Values.singleFlight.redis.endpoint }}
- name: ATHENS_REDIS_ENDPOINT
value: {{ .Values.singleFlight.redis.endpoint | quote }}
{{- end }}
{{- if .Values.singleFlight.redis.password }}
- name: ATHENS_REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_SINGLE_FLIGHT_REDIS_PASSWORD
{{- end }}
{{- with .Values.singleFlight.redis.lockConfig }}
{{- if .ttl }}
- name: ATHENS_REDIS_LOCK_TTL
value: {{ .ttl | quote }}
{{- end }}
{{- if .timeout }}
- name: ATHENS_REDIS_LOCK_TIMEOUT
value: {{ .timeout | quote }}
{{- end }}
{{- if .maxRetries }}
- name: ATHENS_REDIS_LOCK_MAX_RETRIES
value: {{ .maxRetries | quote }}
{{- end }}
{{- end }}
{{- else if eq .Values.singleFlight.type "redis-sentinel"}}
{{- if .Values.singleFlight.redisSentinel.endpoints }}
- name: ATHENS_REDIS_SENTINEL_ENDPOINTS
value: {{ .Values.singleFlight.redisSentinel.endpoints | quote }}
{{- end }}
{{- if .Values.singleFlight.redisSentinel.masterName }}
- name: ATHENS_REDIS_SENTINEL_MASTER_NAME
value: {{ .Values.singleFlight.redisSentinel.masterName | quote }}
{{- end }}
{{- if .Values.singleFlight.redisSentinel.sentinelPassword }}
- name: ATHENS_REDIS_SENTINEL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_SINGLE_FLIGHT_REDIS_SENTINEL_SENTINEL_PASSWORD
{{- end }}
{{- if .Values.singleFlight.redisSentinel.redisUsername }}
- name: ATHENS_REDIS_USERNAME
value: {{ .Values.singleFlight.redisSentinel.redisUsername | quote }}
{{- end }}
{{- if .Values.singleFlight.redisSentinel.redisPassword }}
- name: ATHENS_REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "fullname" . }}-secret
key: ATHENS_SINGLE_FLIGHT_REDIS_SENTINEL_REDIS_PASSWORD
{{- end }}
{{- with .Values.singleFlight.redisSentinel.lockConfig }}
{{- if .ttl }}
- name: ATHENS_REDIS_LOCK_TTL
value: {{ .ttl | quote }}
{{- end }}
{{- if .timeout }}
- name: ATHENS_REDIS_LOCK_TIMEOUT
value: {{ .timeout | quote }}
{{- end }}
{{- if .maxRetries }}
- name: ATHENS_REDIS_LOCK_MAX_RETRIES
value: {{ .maxRetries | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.netrc.enabled }}
- name: ATHENS_NETRC_PATH
value: "/etc/netrc/.netrc"
{{- end }}
{{- if .Values.upstreamProxy.enabled }}
- name: ATHENS_FILTER_FILE
value: "/usr/local/lib/FilterForUpstreamProxy"
- name: ATHENS_GLOBAL_ENDPOINT
value: {{ .Values.upstreamProxy.url | quote }}
{{- end }}
{{- if .Values.jaeger.enabled }}
- name: ATHENS_TRACE_EXPORTER_URL
value: {{ .Values.jaeger.url | default (print "http://" (include "fullname" .) "-jaeger:14268" ) | quote }}
- name: ATHENS_TRACE_EXPORTER
value: "jaeger"
{{- end }}
{{- if and .Values.tracing.enabled (not .Values.jaeger.enabled) }}
- name: ATHENS_TRACE_EXPORTER_URL
value: {{ .Values.tracing.url }}
- name: ATHENS_TRACE_EXPORTER
value: {{ .Values.tracing.type }}
{{- end }}
{{- if .Values.basicAuth.enabled }}
- name: BASIC_AUTH_USER
valueFrom:
secretKeyRef:
name: {{ default "athens-proxy-basic-auth" .Values.basicAuth.secretName | quote }}
key: {{ default "username" .Values.basicAuth.usernameSecretKey | quote }}
- name: BASIC_AUTH_PASS
valueFrom:
secretKeyRef:
name: {{ default "athens-proxy-basic-auth" .Values.basicAuth.secretName | quote }}
key: {{ default "password" .Values.basicAuth.passwordSecretKey | quote }}
{{- end }}
{{- if .Values.configEnvVars }}
{{- toYaml .Values.configEnvVars | nindent 8 }}
{{- end }}
ports:
- containerPort: 3000
{{- if or (eq .Values.storage.type "disk") .Values.upstreamProxy.enabled .Values.netrc.enabled .Values.sshGitServers .Values.gitconfig.enabled .Values.extraVolumeMounts }}
volumeMounts:
{{- end }}
{{- if eq .Values.storage.type "disk" }}
- name: storage-volume
mountPath: {{ .Values.storage.disk.storageRoot | quote }}
{{- end }}
{{- if .Values.upstreamProxy.enabled }}
- name: upstream-config
mountPath: "/usr/local/lib"
readOnly: true
{{- end }}
{{- if .Values.netrc.enabled }}
- name: netrc
mountPath: "/etc/netrc"
readOnly: true
{{- end }}
{{- if .Values.sshGitServers }}
- name: ssh-git-servers-config
mountPath: {{ include "home" . }}/.ssh/config
subPath: ssh_config
- name: ssh-git-servers-config
mountPath: {{ include "home" . }}/.gitconfig
subPath: git_config
- name: ssh-keys
mountPath: /ssh-keys
{{- end }}
{{- if .Values.gitconfig.enabled }}
- name: gitconfig
mountPath: "/etc/gitconfig"
subPath: "gitconfig"
{{- end }}
{{- range $server := .Values.sshGitServers }}
{{- if $server.existingSecret }}
- name: ssh-git-servers-secret-{{ $server.host | replace "." "-" }}
mountPath: {{ include "home" $ }}/.ssh/id_rsa-{{ $server.host }}
subPath: {{ $server.existingSecret.subPath | quote }}
{{- end }}
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.lifecycle }}
lifecycle:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 10 }}
{{- end }}
volumes:
- name: storage-volume
{{- if .Values.storage.disk.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "fullname" . }}-storage
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.upstreamProxy.enabled }}
- name: upstream-config
configMap:
name: {{ include "fullname" . }}-upstream
{{- end }}
{{- if .Values.netrc.enabled }}
- name: netrc
secret:
secretName: {{ .Values.netrc.existingSecret }}
{{- end }}
{{- if .Values.sshGitServers }}
- name: ssh-keys
emptyDir: {}
- name: ssh-git-servers-config
configMap:
name: {{ include "fullname" . }}-ssh-git-servers
- name: ssh-git-servers-secret
secret:
secretName: {{ include "fullname" . }}-ssh-git-servers
{{- range $server := .Values.sshGitServers }}
{{- if $server.existingSecret }}
- name: ssh-git-servers-secret-{{ $server.host | replace "." "-" }}
secret:
secretName: {{ $server.existingSecret.name | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.gitconfig.enabled }}
- name: gitconfig
secret:
secretName: {{ .Values.gitconfig.secretName }}
items:
- key: {{ .Values.gitconfig.secretKey }}
path: "gitconfig"
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 6 }}
{{- 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 }}
@@ -0,0 +1,50 @@
{{- if .Values.autoscaling.enabled }}
{{- $apiVersion := "autoscaling/v2" }}
{{- if .Values.autoscaling.apiVersionOverride -}}
{{- $apiVersion = .Values.autoscaling.apiVersionOverride }}
{{- else if .Capabilities.APIVersions.Has "autoscaling/v2beta1" }}
{{- $apiVersion = "autoscaling/v2beta1" }}
{{- end }}
apiVersion: {{ $apiVersion }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "fullname" . }}
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- with .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
{{- if eq $apiVersion "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- with .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
{{- if eq $apiVersion "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
averageUtilization: {{ . }}
type: Utilization
{{- end }}
{{- end }}
{{- with .Values.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "fullname" . -}}
{{- $svcPort := .Values.service.servicePort -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,44 @@
{{- if .Values.jaeger.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "fullname" . }}-jaeger
labels:
{{- include "athens.metaLabels" (dict "appSuffix" "-jaeger" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ template "fullname" . }}-jaeger
release: "{{ .Release.Name }}"
template:
metadata:
labels:
{{- include "athens.metaLabels" (dict "appSuffix" "-jaeger" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 8 }}
{{- if .Values.jaeger.annotations }}
annotations:
{{- toYaml .Values.jaeger.annotations | nindent 8 }}
{{- end }}
spec:
containers:
- env:
- name: COLLECTOR_ZIPKIN_HTTP_PORT
value: "9441"
image: "{{ .Values.jaeger.image.repository }}:{{ .Values.jaeger.image.tag }}"
name: {{ template "fullname" . }}-jaeger
ports:
- containerPort: 14268
protocol: TCP
- containerPort: 5775
protocol: UDP
- containerPort: 6831
protocol: UDP
- containerPort: 6832
protocol: UDP
- containerPort: 5778
protocol: TCP
- containerPort: 16686
protocol: TCP
- containerPort: 9411
protocol: TCP
{{- end -}}
@@ -0,0 +1,38 @@
{{- if .Values.jaeger.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}-jaeger
labels:
{{- include "athens.metaLabels" (dict "appSuffix" "-jaeger" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 4 }}
spec:
type: {{ .Values.jaeger.type }}
ports:
- name: jaeger-collector-http
port: 14268
protocol: TCP
targetPort: 14268
- name: jaeger-zipkin-thrift
port: 5775
protocol: UDP
targetPort: 5775
- name: jaeger-compact
port: 6831
protocol: UDP
targetPort: 6831
- name: jaeger-binary
port: 6832
protocol: UDP
targetPort: 6832
- name: jaeger-configs
port: 5778
protocol: TCP
targetPort: 5778
- name: jaeger-query-http
port: 16686
protocol: TCP
targetPort: 16686
selector:
app: {{ template "fullname" . }}-jaeger
release: "{{ .Release.Name }}"
{{- end -}}
@@ -0,0 +1,15 @@
{{- if .Values.sshGitServers -}}
kind: Secret
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-ssh-git-servers
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
type: Opaque
data:
{{- range $server := .Values.sshGitServers }}
{{ if (not $server.existingSecret) }}
id_rsa-{{ $server.host }}: {{ $server.privateKey | b64enc | quote }}
{{ end }}
{{- end }}
{{- end -}}
@@ -0,0 +1,38 @@
kind: Secret
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-secret
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
type: Opaque
data:
{{- if .Values.storage.mongo.url }}
ATHENS_MONGO_STORAGE_URL: {{ .Values.storage.mongo.url | b64enc | quote }}
{{- end }}
{{- if .Values.storage.s3.accessKey }}
AWS_ACCESS_KEY_ID: {{ .Values.storage.s3.accessKey | b64enc | quote }}
{{- end }}
{{- if .Values.storage.s3.secretKey }}
AWS_SECRET_ACCESS_KEY: {{ .Values.storage.s3.secretKey | b64enc | quote }}
{{- end }}
{{- if .Values.storage.s3.sessionToken }}
AWS_SESSION_TOKEN: {{ .Values.storage.s3.sessionToken | b64enc | quote }}
{{- end }}
{{- if .Values.storage.gcp.serviceAccount }}
ATHENS_STORAGE_GCP_JSON_KEY: {{ .Values.storage.gcp.serviceAccount | b64enc | quote }}
{{- end }}
{{- if .Values.storage.minio.accessKey }}
ATHENS_MINIO_ACCESS_KEY_ID: {{ .Values.storage.minio.accessKey | b64enc | quote }}
{{- end }}
{{- if .Values.storage.minio.secretKey }}
ATHENS_MINIO_SECRET_ACCESS_KEY: {{ .Values.storage.minio.secretKey | b64enc | quote }}
{{- end }}
{{- if .Values.singleFlight.redis.password }}
ATHENS_SINGLE_FLIGHT_REDIS_PASSWORD: {{ .Values.singleFlight.redis.password | b64enc | quote }}
{{- end }}
{{- if .Values.singleFlight.redisSentinel.sentinelPassword }}
ATHENS_SINGLE_FLIGHT_REDIS_SENTINEL_SENTINEL_PASSWORD: {{ .Values.singleFlight.redisSentinel.sentinelPassword | b64enc | quote }}
{{- end }}
{{- if .Values.singleFlight.redisSentinel.redisPassword }}
ATHENS_SINGLE_FLIGHT_REDIS_SENTINEL_REDIS_PASSWORD: {{ .Values.singleFlight.redisSentinel.redisPassword | b64enc | quote }}
{{- end }}
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "fullname" . }}
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
@@ -0,0 +1,41 @@
{{- if .Values.metrics.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
{{- $metaLabels := include "athens.metaLabels" . | fromYaml }}
{{- $userLabels := .Values.metrics.serviceMonitor.labels | default dict }}
{{- $mergedLabels := merge $userLabels $metaLabels }}
{{- range $key, $value := $mergedLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
{{- end }}
spec:
endpoints:
- path: /metrics
port: http
{{- if .Values.basicAuth.enabled }}
basicAuth:
password:
name: {{ .Values.basicAuth.secretName }}
key: {{ .Values.basicAuth.passwordSecretKey }}
username:
name: {{ .Values.basicAuth.secretName }}
key: {{ .Values.basicAuth.usernameSecretKey }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "fullname" . }}
release: "{{ .Release.Name }}"
{{- end }}
@@ -0,0 +1,38 @@
{{- if .Values.metrics.serviceScrape.enabled }}
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMServiceScrape
metadata:
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
prometheus: default
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "fullname" . }}
{{- if .Values.metrics.serviceScrape.namespace }}
namespace: {{ .Values.metrics.serviceScrape.namespace }}
{{- end }}
spec:
endpoints:
- path: /metrics
port: http
{{- if .Values.basicAuth.enabled }}
basicAuth:
password:
name: {{ .Values.basicAuth.secretName }}
key: {{ .Values.basicAuth.passwordSecretKey }}
username:
name: {{ .Values.basicAuth.secretName }}
key: {{ .Values.basicAuth.usernameSecretKey }}
{{- end }}
jobLabel: {{ template "fullname" . }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "fullname" . }}
release: "{{ .Release.Name }}"
{{- end }}
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
labels:
{{- include "athens.metaLabels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- name: http
port: {{ .Values.service.servicePort }}
targetPort: 3000
protocol: TCP
{{- if and (eq .Values.service.type "NodePort") .Values.service.nodePort .Values.service.nodePort.port }}
nodePort: {{ .Values.service.nodePort.port }}
{{- end }}
selector:
app: {{ template "fullname" . }}
release: "{{ .Release.Name }}"
@@ -0,0 +1,21 @@
{{- if and (eq .Values.storage.type "disk") .Values.storage.disk.persistence.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-storage
labels:
{{- include "athens.metaLabels" (dict "appSuffix" "-storage" "Values" .Values "Release" .Release "Chart" .Chart) | nindent 4 }}
spec:
accessModes:
- {{ .Values.storage.disk.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.storage.disk.persistence.size | quote }}
{{- if .Values.storage.disk.persistence.storageClass }}
{{- if (eq "-" .Values.storage.disk.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.storage.disk.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,34 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "fullname" . }}-test-connection"
labels:
app: {{ template "fullname" . }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['sh']
args:
- '-c'
- |
sleep 2;
wget {{ include "fullname" . }}:{{ .Values.service.servicePort }};
wget -O - {{ include "fullname" . }}:{{ .Values.service.servicePort }}/github.com/google/uuid/@v/v1.6.0.mod;
{{- if .Values.jaeger.enabled }}
- name: wget-jaeger
image: alpine
command: ['sh']
args:
- '-c'
# for query, see https://github.com/jaegertracing/jaeger/blob/f4c975cff3f61e46f9ec27d0f7449ef0ec44d067/cmd/query/app/http_handler.go#L113
- |
apk add jq;
sleep 5;
wget -O - "http://{{ include "fullname" . }}-jaeger:16686/api/services" | jq .;
wget -O - "http://{{ include "fullname" . }}-jaeger:16686/api/traces?service=proxy" | jq '.data|first';
wget -O - "http://{{ include "fullname" . }}-jaeger:14268/api/sampling?service=proxy" | jq .;
{{- end }}
restartPolicy: Never