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
+16
View File
@@ -0,0 +1,16 @@
apiVersion: v1
name: athens-proxy
version: 0.15.1
appVersion: v0.16.0
kubeVersion: ">= 1.19-0"
description: The proxy server for Go modules
icon: https://raw.githubusercontent.com/gomods/athens/main/docs/static/banner.png
keywords:
- Golang
- Package Management
- Goproxy
- Athens
home: https://github.com/gomods/athens-charts
sources:
- https://github.com/gomods/athens-charts
engine: gotpl
+203
View File
@@ -0,0 +1,203 @@
# Athens Proxy Helm Chart: athens-proxy
![Version: 0.15.1](https://img.shields.io/badge/Version-0.15.1-informational?style=flat-square) ![AppVersion: v0.16.0](https://img.shields.io/badge/AppVersion-v0.16.0-informational?style=flat-square)
## What is Athens?
[Athens](https://docs.gomods.io) is a repository for packages used by your go packages.
Athens provides a repository for [Go Modules](https://github.com/golang/go/wiki/Modules) that you can run. It serves public code and your private code for you, so you don't have to pull directly from a version control system (VCS) like GitHub or GitLab.
## Prerequisites
Kubernetes: `>= 1.19-0`
## Requirements
- A running Kubernetes cluster
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed and setup to use the cluster
- [Helm](https://helm.sh/) [installed](https://github.com/helm/helm#install) and setup to use the cluster (helm init) or [Tillerless Helm](https://github.com/rimusz/helm-tiller)
## Deploy Athens
The fastest way to install Athens using Helm is to deploy it from our public Helm chart repository. First, add the repository with this command:
```console
$ helm repo add athens https://gomods.github.io/athens-charts
$ helm repo update
```
Next, install the chart with default values in the `athens` namespace:
```
$ helm install athens/athens-proxy -n athens --namespace athens
```
This will deploy a single Athens instance in the `athens` namespace with `disk` storage enabled. Additionally, a `ClusterIP` service will be created.
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling |
| annotations | object | `{}` | Add extra annotations to the athens pods |
| autoscaling.apiVersionOverride | string | `""` | Overwrite the API version used for HPA, uses 'autoscaling/v2' by default. see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/horizontal-pod-autoscaler-v2/ |
| autoscaling.behavior | object | `{}` | Define scaling behavior for HPA |
| autoscaling.enabled | bool | `false` | Enable Horizontal Pod Autoscaling |
| autoscaling.maxReplicas | int | `3` | |
| autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| autoscaling.targetMemoryUtilizationPercentage | int | `80` | |
| basicAuth.enabled | bool | `false` | If enabled, it expects to find the username and password in the named secret provided below |
| basicAuth.passwordSecretKey | string | `"password"` | |
| basicAuth.secretName | string | `"athens-proxy-basic-auth"` | Secret name, containing the 'passwordSecretKey' and 'usernameSecretKey' |
| basicAuth.usernameSecretKey | string | `"username"` | |
| configEnvVars | list | `[]` | Set environment variables to be passed to athens pods |
| extraInitContainers | list | `[]` | Define extra init containers for athens-proxy |
| extraLabels | object | `{}` | Add extra labels to all resources |
| extraVolumeMounts | object | `{}` | Add extra volume mounts to deployment pod primary container |
| extraVolumes | object | `{}` | Add extra volumes to deployment pod |
| gitconfig.enabled | bool | `false` | If enabled, it expects to find git configuration in the named secret provided below. By default, gitconfig is disabled |
| gitconfig.secretKey | string | `"gitconfig"` | Key in the kubernetes secret that contains git config data |
| gitconfig.secretName | string | `"athens-proxy-gitconfig"` | Name of the kubernetes secret (in the same namespace as athens-proxy) that contains git config |
| goGetWorkers | int | `3` | Specify the number of go workers |
| image.pullPolicy | string | `"IfNotPresent"` | Specify a imagePullPolicy. see http://kubernetes.io/docs/user-guide/images/#pre-pulling-images |
| image.pullSecrets | list | `[]` | Specify secrets containing credentials for pulling images |
| image.registry | string | `"docker.io"` | |
| image.repository | string | `"gomods/athens"` | |
| image.runAsNonRoot | bool | `false` | Determine if the image should run as `root` or user `athens` |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | |
| ingress.enabled | bool | `false` | Create an Ingress resource for athens |
| ingress.hosts | list | `[]` | Provide an array of values for the ingress host mapping |
| ingress.tls | list | `[]` | |
| initContainerResources | object | `{}` | sshGitServers init container resources |
| initContainerSecurityContext | object | `{}` | sshGitServers init container security context configuration |
| intiContainerResources | object | `{}` | sshGitServers init container resources (deprecated naming, if initContainerResources is defined, that will be used in preference to this value) |
| jaeger.annotations | object | `{}` | |
| jaeger.enabled | bool | `false` | Deploy a jaeger "all-in-one" pod for tracing |
| jaeger.image.repository | string | `"jaegertracing/all-in-one"` | |
| jaeger.image.tag | string | `"latest"` | |
| jaeger.type | string | `"ClusterIP"` | Type of service; valid values are "ClusterIP", "LoadBalancer", and "NodePort". |
| jaeger.url | string | `""` | Specify the jaeger URL for the environment variable used by athens. With default settings, it uses the jaeger-collector-http port of the jaeger service. |
| lifecycle | object | `{}` | Container lifecycle hooks configuration. see API reference: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/ |
| livenessProbe.failureThreshold | int | `3` | |
| livenessProbe.periodSeconds | int | `10` | |
| livenessProbe.successThreshold | int | `1` | |
| livenessProbe.timeoutSeconds | int | `1` | |
| metrics.serviceMonitor.enabled | bool | `false` | Create a ServiceMonitor for prometheus |
| metrics.serviceScrape.enabled | bool | `false` | Create a VMServiceScrape for victoria |
| netrc.enabled | bool | `false` | If enabled, it expects to find the content of a valid '.netrc' file in the named secret provided below |
| netrc.existingSecret | string | `"netrcsecret"` | Secret name, containing the '.netrc' file |
| nodeSelector | object | `{}` | see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling |
| priorityClassName | string | `""` | Priority class for pod scheduling. see API reference: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass |
| readinessProbe.failureThreshold | int | `3` | |
| readinessProbe.periodSeconds | int | `10` | |
| readinessProbe.successThreshold | int | `1` | |
| readinessProbe.timeoutSeconds | int | `1` | |
| replicaCount | int | `1` | Set the number of athens-proxy replicas, unless autoscaling is enabled |
| resources | object | `{}` | Define resources for athens pods. see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources |
| securityContext | object | `{}` | Container security context configuration. see API reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core. This will override the `image.runAsNonRoot` settings in the specified container if `runAsUser` or `runAsGroup` are set |
| service.annotations | object | `{}` | Add annotations to the service |
| service.servicePort | int | `80` | Port as exposed by the service |
| service.type | string | `"ClusterIP"` | Type of service; valid values are "ClusterIP", "LoadBalancer", and "NodePort". "ClusterIP" is sufficient in the case when the Proxy will be used from within the cluster. To expose externally, consider a "NodePort" or "LoadBalancer" service or use an "Ingress". |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | Create a ServiceAccount |
| singleFlight.etcd.endpoints | string | `""` | |
| singleFlight.redis.endpoint | string | `""` | |
| singleFlight.redis.lockConfig | object | `{}` | |
| singleFlight.redis.password | string | `""` | |
| singleFlight.redisSentinel.endpoints | string | `""` | |
| singleFlight.redisSentinel.lockConfig | object | `{}` | |
| singleFlight.redisSentinel.masterName | string | `""` | |
| singleFlight.redisSentinel.redisPassword | string | `""` | |
| singleFlight.redisSentinel.redisUsername | string | `""` | |
| singleFlight.redisSentinel.sentinelPassword | string | `""` | |
| singleFlight.type | string | `""` | SingleFlight type to use. Options are ["memory", "etcd", "redis", "redis-sentinel", "gcp", "azureblob"]. see https://docs.gomods.io/configuration/storage/#running-multiple-athens-pointed-at-the-same-storage |
| sshGitServers | list | `[]` | Configuration for private git servers that will provide ssh and git config to athens in a ConfigMap |
| storage.disk.persistence.accessMode | string | `"ReadWriteOnce"` | |
| storage.disk.persistence.enabled | bool | `false` | Note if you use disk.persistence.enabled, replicaCount should be set to 1 unless your access mode is 'ReadWriteMany' and strategy type must be 'Recreate' |
| storage.disk.persistence.size | string | `"4Gi"` | |
| storage.disk.storageRoot | string | `"/var/lib/athens"` | |
| storage.gcp.bucket | string | `""` | |
| storage.gcp.projectID | string | `""` | For more information, see: https://docs.gomods.io/install/install-on-kubernetes/#google-cloud-storage you must set gcp projectID and bucket when running 'helm install' |
| storage.gcp.serviceAccount | string | `""` | Set serviceAccount to a key which has read/write access to the GCS bucket. If you are running Athens inside GCP, you will most likely not need this as GCP figures out internal authentication between products for you. |
| storage.minio.accessKey | string | `""` | |
| storage.minio.bucket | string | `""` | |
| storage.minio.endpoint | string | `""` | All these variables needs to be set when configuring athens to run with minio backend |
| storage.minio.secretKey | string | `""` | |
| storage.mongo.url | string | `""` | |
| storage.s3.accessKey | string | `""` | |
| storage.s3.bucket | string | `""` | |
| storage.s3.forcePathStyle | bool | `false` | |
| storage.s3.region | string | `""` | You must set s3 bucket and region when running 'helm install' |
| storage.s3.secretKey | string | `""` | |
| storage.s3.sessionToken | string | `""` | |
| storage.s3.useDefaultConfiguration | bool | `false` | |
| storage.type | string | `"disk"` | Storage type to use. For a single instance a PVC may be sufficient |
| strategy.rollingUpdate.maxSurge | int | `1` | |
| strategy.rollingUpdate.maxUnavailable | int | `1` | |
| strategy.type | string | `"Recreate"` | Using RollingUpdate requires a shared storage |
| terminationGracePeriodSeconds | int | `30` | see API reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#pod-v1-core. the default value is 30 seconds. |
| tolerations | list | `[]` | see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling |
| tracing.enabled | bool | `false` | Set ATHENS_TRACE_EXPORTER* environment variables to point to a tracing deployment. |
| tracing.type | string | `"jaeger"` | Value of ATHENS_TRACE_EXPORTER, supported values are "jaeger", "datadog", and "stackdriver". |
| tracing.url | string | `""` | Value of ATHENS_TRACE_EXPORTER_URL |
| upstreamProxy.enabled | bool | `false` | This is where you can set the URL for the upstream module repository. If 'enabled' is set to true, Athens will try to download modules from the upstream when it doesn't find them in its own storage. Here's a non-exhaustive list of options you can set here: - https://gocenter.io - https://proxy.golang.org |
| upstreamProxy.url | string | `"https://gocenter.io"` | |
## Advanced Configuration
For more advanced configuration options please check Athens [docs](https://docs.gomods.io/install/install-on-kubernetes/#advanced-configuration).
Available options:
- [Replicas](https://docs.gomods.io/install/install-on-kubernetes/#replicas)
- [Access to private repositories via Github](https://docs.gomods.io/install/install-on-kubernetes/#give-athens-access-to-private-repositories-via-github-token-optional)
- [Storage Providers](https://docs.gomods.io/install/install-on-kubernetes/#storage-providers)
- [Kubernetes Service](https://docs.gomods.io/install/install-on-kubernetes/#kubernetes-service)
- [Ingress Resource](https://docs.gomods.io/install/install-on-kubernetes/#ingress-resource)
- [Upstream module repository](https://docs.gomods.io/install/install-on-kubernetes/#upstream-module-repository)
- [.netrc file support](https://docs.gomods.io/install/install-on-kubernetes/#netrc-file-support)
- [gitconfig support](https://docs.gomods.io/install/install-on-kubernetes/#gitconfig-support)
### Pass extra configuration environment variables
You can pass any extra environment variables supported in [config.dev.toml](../../../config.dev.toml).
The example below shows how to set username/password for basic auth:
```yaml
configEnvVars:
- name: BASIC_AUTH_USER
value: "some_user"
- name: BASIC_AUTH_PASS
value: "some_password"
```
### Private git servers over ssh support
One or more of git servers can added to `sshGitServers`, and the corresponding config files (git config and ssh config) and ssh keys will be created. Athens then will use these configs and keys to download the source from the git servers.
```yaml
sshGitServers:
## Private git servers over ssh
## to enable uncomment lines with single hash below
## hostname of the git server
- host: git.example.com
## ssh username
user: git
## ssh private key for the user
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
## ssh port
port: 22
```
## Testing
Using `chart-testing` to lint, install and test the chart on a local Kubernetes (Minikube, Rancher Desktop, ...)
```shell
ct lint-and-install --all
```
@@ -0,0 +1,96 @@
{{- /* run `helm-docs` (github.com/norwoodj/helm-docs) to generate README.md */ -}}
# Athens Proxy Helm Chart: {{ template "chart.name" . }}
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
## What is Athens?
[Athens](https://docs.gomods.io) is a repository for packages used by your go packages.
Athens provides a repository for [Go Modules](https://github.com/golang/go/wiki/Modules) that you can run. It serves public code and your private code for you, so you don't have to pull directly from a version control system (VCS) like GitHub or GitLab.
## Prerequisites
{{ template "chart.kubeVersionLine" . }}
## Requirements
- A running Kubernetes cluster
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) installed and setup to use the cluster
- [Helm](https://helm.sh/) [installed](https://github.com/helm/helm#install) and setup to use the cluster (helm init) or [Tillerless Helm](https://github.com/rimusz/helm-tiller)
## Deploy Athens
The fastest way to install Athens using Helm is to deploy it from our public Helm chart repository. First, add the repository with this command:
```console
$ helm repo add athens https://gomods.github.io/athens-charts
$ helm repo update
```
Next, install the chart with default values in the `athens` namespace:
```
$ helm install athens/athens-proxy -n athens --namespace athens
```
This will deploy a single Athens instance in the `athens` namespace with `disk` storage enabled. Additionally, a `ClusterIP` service will be created.
{{ template "chart.valuesSection" . }}
## Advanced Configuration
For more advanced configuration options please check Athens [docs](https://docs.gomods.io/install/install-on-kubernetes/#advanced-configuration).
Available options:
- [Replicas](https://docs.gomods.io/install/install-on-kubernetes/#replicas)
- [Access to private repositories via Github](https://docs.gomods.io/install/install-on-kubernetes/#give-athens-access-to-private-repositories-via-github-token-optional)
- [Storage Providers](https://docs.gomods.io/install/install-on-kubernetes/#storage-providers)
- [Kubernetes Service](https://docs.gomods.io/install/install-on-kubernetes/#kubernetes-service)
- [Ingress Resource](https://docs.gomods.io/install/install-on-kubernetes/#ingress-resource)
- [Upstream module repository](https://docs.gomods.io/install/install-on-kubernetes/#upstream-module-repository)
- [.netrc file support](https://docs.gomods.io/install/install-on-kubernetes/#netrc-file-support)
- [gitconfig support](https://docs.gomods.io/install/install-on-kubernetes/#gitconfig-support)
### Pass extra configuration environment variables
You can pass any extra environment variables supported in [config.dev.toml](../../../config.dev.toml).
The example below shows how to set username/password for basic auth:
```yaml
configEnvVars:
- name: BASIC_AUTH_USER
value: "some_user"
- name: BASIC_AUTH_PASS
value: "some_password"
```
### Private git servers over ssh support
One or more of git servers can added to `sshGitServers`, and the corresponding config files (git config and ssh config) and ssh keys will be created. Athens then will use these configs and keys to download the source from the git servers.
```yaml
sshGitServers:
## Private git servers over ssh
## to enable uncomment lines with single hash below
## hostname of the git server
- host: git.example.com
## ssh username
user: git
## ssh private key for the user
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
## ssh port
port: 22
```
## Testing
Using `chart-testing` to lint, install and test the chart on a local Kubernetes (Minikube, Rancher Desktop, ...)
```shell
ct lint-and-install --all
```
@@ -0,0 +1,31 @@
ingress:
enabled: true
annotations:
hosts:
- host: athens-proxy.local
paths:
- path: /
pathType: ImplementationSpecific
extraLabels:
athensIs: "awesome"
annotations:
test.annotation: "athens-proxy"
configEnvVars:
- name: KEY
value: "value"
image:
runAsNonRoot: true
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
jaeger:
enabled: true
annotations:
test.annotation: "jaeger"
service:
type: "NodePort"
terminationGracePeriodSeconds: 60
lifecycle:
preStop:
exec:
command: ["/bin/sleep", "10"]
@@ -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
+339
View File
@@ -0,0 +1,339 @@
image:
registry: docker.io
repository: gomods/athens
# Override the chart appVersion and use a specific tag
# tag: v0.12.0
# -- Specify a imagePullPolicy.
# see http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
pullPolicy: IfNotPresent
# -- Specify secrets containing credentials for pulling images
pullSecrets: []
# - name: name-of-secret
# -- Determine if the image should run as `root` or user `athens`
runAsNonRoot: false
livenessProbe:
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
strategy:
# -- Using RollingUpdate requires a shared storage
type: Recreate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
service:
# -- Add annotations to the service
annotations: {}
# -- Port as exposed by the service
servicePort: 80
# -- Type of service; valid values are "ClusterIP", "LoadBalancer", and
# "NodePort". "ClusterIP" is sufficient in the case when the Proxy will be used
# from within the cluster. To expose externally, consider a "NodePort" or "LoadBalancer" service or use an "Ingress".
type: ClusterIP
# Optional configuration if service is of type "NodePort"
# nodePort:
# -- Specify the nodePort in allowable range (e.g. 30000 - 32767 on minikube)
# port: 30080
ingress:
# -- Create an Ingress resource for athens
enabled: false
annotations: {}
className: ""
# -- Provide an array of values for the ingress host mapping
hosts: []
# - host: athens-proxy.local
# paths:
# - path: /
# pathType: ImplementationSpecific
# Provide a base64 encoded cert for TLS use
tls: []
# - hosts:
# - athens-proxy.local
# secretName: athens-proxy.local-tls
storage:
# -- Storage type to use. For a single instance a PVC may be sufficient
type: disk
disk:
storageRoot: "/var/lib/athens"
persistence:
# -- Note if you use disk.persistence.enabled, replicaCount should be set to 1 unless your access mode is
# 'ReadWriteMany' and strategy type must be 'Recreate'
enabled: false
accessMode: ReadWriteOnce
size: 4Gi
mongo:
url: ""
s3:
# -- You must set s3 bucket and region when running 'helm install'
region: ""
bucket: ""
useDefaultConfiguration: false
forcePathStyle: false
accessKey: ""
secretKey: ""
sessionToken: ""
minio:
# -- All these variables needs to be set when configuring athens to run with minio backend
endpoint: ""
accessKey: ""
secretKey: ""
bucket: ""
gcp:
# -- For more information, see:
# https://docs.gomods.io/install/install-on-kubernetes/#google-cloud-storage
# you must set gcp projectID and bucket when running 'helm install'
projectID: ""
bucket: ""
# -- Set serviceAccount to a key which has read/write access to the GCS bucket.
# If you are running Athens inside GCP, you will most likely not need this
# as GCP figures out internal authentication between products for you.
serviceAccount: ""
singleFlight:
# -- SingleFlight type to use.
# Options are ["memory", "etcd", "redis", "redis-sentinel", "gcp", "azureblob"].
# see https://docs.gomods.io/configuration/storage/#running-multiple-athens-pointed-at-the-same-storage
type: ""
etcd:
endpoints: ""
redis:
endpoint: ""
password: ""
lockConfig: {}
# ttl: 900
# timeout: 15
# maxRetries: 10
redisSentinel:
endpoints: ""
masterName: ""
sentinelPassword: ""
redisUsername: ""
redisPassword: ""
lockConfig: {}
# ttl: 900
# timeout: 15
# maxRetries: 10
# -- Priority class for pod scheduling.
# see API reference: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
priorityClassName: ""
# -- see API reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#pod-v1-core.
# the default value is 30 seconds.
terminationGracePeriodSeconds: 30
# -- Container security context configuration.
# see API reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#securitycontext-v1-core.
# This will override the `image.runAsNonRoot` settings in the specified container if `runAsUser` or `runAsGroup` are set
securityContext: {}
# allowPrivilegeEscalation: false
# runAsNonRoot: true
# -- Container lifecycle hooks configuration.
# see API reference: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
lifecycle: {}
# -- Set environment variables to be passed to athens pods
configEnvVars: []
# -- Add extra annotations to the athens pods
annotations: {}
# -- Add extra labels to all resources
extraLabels: {}
# HTTP basic auth
basicAuth:
# -- If enabled, it expects to find the username and password in the named secret provided below
enabled: false
# -- Secret name, containing the 'passwordSecretKey' and 'usernameSecretKey'
secretName: athens-proxy-basic-auth
passwordSecretKey: password
usernameSecretKey: username
netrc:
# -- If enabled, it expects to find the content of a valid '.netrc' file in the named secret provided below
enabled: false
# -- Secret name, containing the '.netrc' file
existingSecret: netrcsecret
# gitconfig section provides a way to inject git config file to make athens able to fetch modules from private git repos
gitconfig:
# -- If enabled, it expects to find git configuration in the named secret provided below.
# By default, gitconfig is disabled
enabled: false
# -- Name of the kubernetes secret (in the same namespace as athens-proxy) that contains git config
secretName: athens-proxy-gitconfig
# -- Key in the kubernetes secret that contains git config data
secretKey: gitconfig
upstreamProxy:
# -- This is where you can set the URL for the upstream module repository.
# If 'enabled' is set to true, Athens will try to download modules from the upstream when it doesn't find them in its own storage.
# Here's a non-exhaustive list of options you can set here:
#
# - https://gocenter.io
# - https://proxy.golang.org
enabled: false
url: "https://gocenter.io"
jaeger:
# -- Deploy a jaeger "all-in-one" pod for tracing
enabled: false
annotations: {}
# -- Type of service; valid values are "ClusterIP", "LoadBalancer", and "NodePort".
type: ClusterIP
image:
repository: jaegertracing/all-in-one
tag: latest
# -- Specify the jaeger URL for the environment variable used by athens.
# With default settings, it uses the jaeger-collector-http port of the jaeger service.
url: ""
tracing:
# -- Set ATHENS_TRACE_EXPORTER* environment variables to point to a tracing deployment.
enabled: false
# -- Value of ATHENS_TRACE_EXPORTER_URL
url: ""
# -- Value of ATHENS_TRACE_EXPORTER, supported values are "jaeger", "datadog", and "stackdriver".
type: "jaeger"
# -- Configuration for private git servers that will provide ssh and git config to athens in a ConfigMap
sshGitServers: []
## Private git servers over ssh
## to enable uncomment lines with single hash below
## hostname of the git server
# - host: git.example.com
## https path, "/scm" for bitbucket
# path: ""
## ssh username
# user: git
## ssh private key for the user
# privateKey: |
# -----BEGIN RSA PRIVATE KEY-----
# -----END RSA PRIVATE KEY-----
## ssh port
# port: 22
## ssh private key from the existing secret (to be added separately in "Secret" Resource)
# existingSecret:
# name: ssh-keys
# subPath: secret.id_rsa
# -- sshGitServers init container security context configuration
initContainerSecurityContext: {}
# allowPrivilegeEscalation: false
# runAsNonRoot: true
# -- sshGitServers init container resources (deprecated naming, if initContainerResources is defined, that will be used in preference to this value)
intiContainerResources: {}
# limits:
# cpu: 100m
# memory: 64Mi
# requests:
# cpu: 100m
# memory: 64Mi
# -- sshGitServers init container resources
initContainerResources: {}
# limits:
# cpu: 100m
# memory: 64Mi
# requests:
# cpu: 100m
# memory: 64Mi
# -- Define extra init containers for athens-proxy
extraInitContainers: []
# - name: init
# image: busybox:1.28
# command: ['sh', '-c', "echo 'hello world'"]
# -- Specify the number of go workers
goGetWorkers: 3
metrics:
serviceMonitor:
# -- Create a ServiceMonitor for prometheus
enabled: false
# namespace: "monitoring"
# labels:
# prometheus: default
serviceScrape:
# -- Create a VMServiceScrape for victoria
enabled: false
# namespace: "monitoring"
serviceAccount:
# -- Create a ServiceAccount
create: true
annotations: {}
# name: "athens-proxy"
# -- see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling
nodeSelector: {}
# -- see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling
tolerations: []
# -- see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#scheduling
affinity: {}
# -- Add extra volumes to deployment pod
extraVolumes: {}
# -- Add extra volume mounts to deployment pod primary container
extraVolumeMounts: {}
# -- Define resources for athens pods.
# see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources
resources: {}
# limits:
# cpu: 100m
# memory: 64Mi
# requests:
# cpu: 100m
# memory: 64Mi
# -- Set the number of athens-proxy replicas, unless autoscaling is enabled
replicaCount: 1
autoscaling:
# -- Enable Horizontal Pod Autoscaling
enabled: false
minReplicas: 1
maxReplicas: 3
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
# -- Overwrite the API version used for HPA, uses 'autoscaling/v2' by default.
# see https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/horizontal-pod-autoscaler-v2/
apiVersionOverride: ""
# -- Define scaling behavior for HPA
behavior: {}
# scaleDown:
# stabilizationWindowSeconds: 300
# policies:
# - type: Pods
# value: 1
# periodSeconds: 180
# scaleUp:
# stabilizationWindowSeconds: 300
# policies:
# - type: Pods
# value: 2
# periodSeconds: 60