-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #642 from lemeurherve/helpdesk2649-split-mirrorbit…
…s-chart-mirrorbits-lite chore: init a dedicated `mirrorbits-lite` helm chart from `mirrorbits`
- Loading branch information
Showing
17 changed files
with
738 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,22 @@ | ||
# 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 | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains 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,4 @@ | ||
apiVersion: v1 | ||
description: Mirrobits lite helm chart for Kubernetes | ||
name: mirrorbits-lite | ||
version: 0.0.1 |
This file contains 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,116 @@ | ||
# mirrorbits-lite | ||
<!-- TODO: update to lite --> | ||
|
||
<!-- This chart deploys two services [mirrorbits](https://github.com/etix/mirrorbits) and a simple httpd (Apache2) service that return every file | ||
A "Quick Start" is available on [etix/mirrorbits](repository) | ||
Docker image used in this chart is defined from [jenkins-infra/docker-mirrorbits](https://github.com/jenkins-infra/docker-mirrorbits) | ||
Parameters can be added to a file url to display various information like: | ||
``` | ||
https://get.jenkins.io/windows/2.251/jenkins.msi.sha256?mirrorlist | ||
https://get.jenkins.io/windows/2.251/jenkins.msi.sha256?mirrorstats | ||
https://get.jenkins.io/windows/2.251/jenkins.msi.sha256?stats | ||
``` | ||
## Settings | ||
``` | ||
`replicaCount` | ||
`image.mirrorbits.reposotiry` | ||
`image.mirrorbits.tag` | ||
`image.mirrorbits.pullPolicy` | ||
`image.files.reposotiry` | ||
`image.files.tag` | ||
`image.files.pullPolicy` | ||
`nameOverride`: | ||
`fullnameOverride`: | ||
`imagePullSecrets`: | ||
`serviceAccount.create`: | ||
`serviceAccount.name`: | ||
`securityContext`: | ||
`podSecurityContext`: | ||
`service.type`: | ||
`service.port`: | ||
`ingress.enabled`: | ||
`ingress.annotations`: | ||
`ingress.hosts` | ||
`ingress.tls` | ||
`resources.limits.cpu`: | ||
`resources.limits.memory`: | ||
`resources.requests.cpu`: | ||
`resources.requests.memory`: | ||
`nodeSelector`: | ||
`tolerations`: | ||
`affinity`: | ||
`mirrorbits.conf`: "Define the mirrorbits.conf data" | ||
`repository.name`: "Enforce repository resource name used for secret-persistentVolume - persistentvolumeClaim" | ||
`repository.persistentVolumeClaim.enabled`: _"Enable the persistentVolumeClaim for the repository directory"_ | ||
`repository.persistentVolumeClaim.spec`: _Define the persistentVolumeClaim Spec_ | ||
`repository.persistentVolume.enabled`: _Enable the persistentVolume for repository directory_ | ||
`repository.persistentVolume.spec`: _Define the persistentVolume Spec_ | ||
`repository.secrets.enabled`: _Enable the secrets resource for repository directory_ | ||
`repository.secrets.spec`: _Define the secret data_ | ||
``` | ||
## Requirements | ||
This chart requires a redis database which can be deployed with the redis helm [chart](https://github.com/helm/charts/tree/master/stable/redis) | ||
## HowTo | ||
Mirrorbits is configured using its cli. The configuration is stored in the redis database which means that you can either store a configuration | ||
locally and run the cli from your machine or you can connect inside one of the pod running to use the cli. | ||
### Access mirrobits cli | ||
You need to first identify a pod name and then run a bash command inside it. | ||
* ```kubectl get pods -n mirrorbits -l "app.kubernetes.io/name=mirrorbits"``` | ||
* ```kubectl exec -i -t -n mirrorbits -c mirrorbits <POD_NAME> bash``` | ||
### Disable Mirrors | ||
You need to identify the mirror identifier that you wand to disable and then disable it. | ||
* ```mirrorbits list``` | ||
* ```mirrorbits disable [IDENTIFIER]``` | ||
### Add Mirrors Configuration | ||
Currently mirrorbits do not provide a way to configure mirrors through a configuration file and considering that this is not something that changes regularly, I will run the following commands once via "kubectl" exec | ||
``` | ||
mirrorbits add -rsync rsync://mirror.serverion.com/jenkins -ftp ftp://mirror.serverion.com/jenkins -http https://mirror.serverion.com/jenkins -sponsor-name serverion -sponsor-url serverion.com -admin-email "desmond@serverion.com" -admin-name "Desmond van der Winden" serverion.com | ||
mirrorbits add -http https://mirror.esuni.jp/jenkins/ -admin-email "kuriyama@FreeBSD.org" esuni.jp | ||
mirrorbits add -http https://mirrors.tuna.tsinghua.edu.cn/jenkins/ -rsync rsync://mirrors.tuna.tsinghua.edu.cn/jenkins/ -admin-name "Yuzhi Wang" -admin-email "yuzhi.wang@tuna.tsinghua.edu.cn" tsinghua.edu.cn | ||
mirrorbits add -http https://mirror.xmission.com/jenkins/ -rsync rsync://mirror.xmission.com/jenkins/ -ftp ftp://mirror.xmission.com/jenkins/ xmission.org | ||
# jenkins not synced on rsync | ||
mirrorbits add -http https://ftp-nyc.osuosl.org/pub/jenkins -rsync rsync://ftp-nyc.osuosl.org/jenkins -ftp ftp://ftp-nyc.osuosl.org/pub/jenkins ftp-nyc.osuosl.org | ||
mirrorbits add -http https://ftp-chi.osuosl.org/pub/jenkins -rsync rsync://ftp-chi.osuosl.org/jenkins -ftp ftp://ftp-chi.osuosl.org/pub/jenkins ftp-chi.osuosl.org | ||
mirrorbits add -http https://ftp.yz.yamagata-u.ac.jp/pub/misc/jenkins/ -rsync rsync://ftp.yz.yamagata-u.ac.jp/pub/misc/jenkins/ -admin-name "Tomohiro Ito" -admin-email "tomohiro@yz.yamagata-u.ac.jp" yamagata-u.ac.jp | ||
mirrorbits add -http https://mirror.gruenehoelle.nl/jenkins/ -rsync rsync://esme.gruenehoelle.nl/mirror/jenkins/ -admin-name "gunter@grodotzki.com" -admin-email "gunter@grodotzki.com" gruenehoelle.nl | ||
mirrorbits add -http https://ftp.halifax.rwth-aachen.de/jenkins/ -rsync rsync://ftp.halifax.rwth-aachen.de/jenkins/ -ftp ftp://ftp.halifax.rwth-aachen.de/jenkins/ -admin-name "ftp@halifax.rwth-aachen.de" -admin-email "ftp@halifax.rwth-aachen.de" rwth-aachen.de | ||
mirrorbits add -http https://ftp.belnet.be/mirror/jenkins/ -rsync rsync://rsync.belnet.be -admin-name "Belnet" -admin-email "ftpmaint@belnet.be" ftp.belnet.be | ||
``` | ||
# Low priority mirrors | ||
```shell | ||
mirrorbits add -rsync rsync://archives.jenkins.io/jenkins/ -http https://archives.jenkins.io/jenkins -sponsor-name Jenkins-infra -sponsor-url www.jenkins.io -admin-email "jenkinsci-infra@googlegroups.com" -admin-name "Jenkins" archives.jenkins.io -score -100 | ||
``` | ||
## Links | ||
* [Mirrorbits](https://github.com/etix/mirrorbits) - Upstream project | ||
* [Mirrorbits](https://github.com/jenkins-infra/docker-mirrorbits) - Docker Image --> |
This file contains 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,21 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "mirrorbits-lite.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 --namespace {{ .Release.Namespace }} svc -w {{ include "mirrorbits-lite.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mirrorbits-lite.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "mirrorbits-lite.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:8080/?mirrorstats to use your application" | ||
kubectl port-forward $POD_NAME 8080:80 | ||
{{- end }} |
This file contains 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,56 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "mirrorbits-lite.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 "mirrorbits-lite.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 "mirrorbits-lite.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "mirrorbits-lite.labels" -}} | ||
app.kubernetes.io/name: {{ include "mirrorbits-lite.name" . }} | ||
helm.sh/chart: {{ include "mirrorbits-lite.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "mirrorbits-lite.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{ default (include "mirrorbits-lite.fullname" .) .Values.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.name }} | ||
{{- end -}} | ||
{{- end -}} |
This file contains 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,118 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "mirrorbits-lite.fullname" . }} | ||
labels: | ||
{{ include "mirrorbits-lite.labels" . | indent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "mirrorbits-lite.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "mirrorbits-lite.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum | trunc 63 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ template "mirrorbits-lite.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
protocol: TCP | ||
volumeMounts: | ||
- name: conf | ||
mountPath: /etc/mirrorbits | ||
{{ if $.Values.repository.persistentVolumeClaim.enabled -}} | ||
- name: binary | ||
mountPath: /srv/repo | ||
{{- end }} | ||
- name: geoipdata | ||
mountPath: /usr/share/GeoIP | ||
livenessProbe: | ||
httpGet: | ||
path: /?mirrorstats | ||
port: 8080 | ||
readinessProbe: | ||
httpGet: | ||
path: /?mirrorstats | ||
port: 8080 | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
- name: geoipupdate | ||
image: "{{ .Values.geoipupdate.image.repository }}:{{ .Values.geoipupdate.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
volumeMounts: | ||
- name: geoipdata | ||
mountPath: /usr/share/GeoIP | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
env: | ||
- name: GEOIPUPDATE_EDITION_IDS | ||
value: {{ .Values.geoipupdate.editions }} | ||
- name: GEOIPUPDATE_FREQUENCY | ||
value: {{ .Values.geoipupdate.update_frequency | quote }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ include "mirrorbits-lite.fullname" . }}-geoipupdate | ||
initContainers: | ||
# we need to ensure the geoip data is in place before mirrorbits starts | ||
- name: geoipupdate-init | ||
image: "{{ .Values.geoipupdate.image.repository }}:{{ .Values.geoipupdate.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
volumeMounts: | ||
- name: geoipdata | ||
mountPath: /usr/share/GeoIP | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
env: | ||
- name: GEOIPUPDATE_EDITION_IDS | ||
value: {{ .Values.geoipupdate.editions }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ include "mirrorbits-lite.fullname" . }}-geoipupdate | ||
|
||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
volumes: | ||
- name: conf | ||
secret: | ||
secretName: {{ include "mirrorbits-lite.fullname" . }} | ||
items: | ||
- key: mirrorbits.conf | ||
path: mirrorbits.conf | ||
- name: geoipdata | ||
emptyDir: {} | ||
{{ if $.Values.repository.persistentVolumeClaim.enabled -}} | ||
- name: binary | ||
persistentVolumeClaim: | ||
claimName: {{ .Values.repository.name | default (printf "%s-binary" (include "mirrorbits-lite.fullname" .)) }} | ||
{{- end -}} |
This file contains 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,44 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "mirrorbits-lite.fullname" . -}} | ||
{{- $svcPort := .Values.service.port -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{ include "mirrorbits-lite.labels" . | indent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
nginx.ingress.kubernetes.io/use-regex: "true" | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.ingress.className }} | ||
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 }} | ||
pathType: {{ .pathType | default "Prefix" }} | ||
backend: | ||
service: | ||
name: {{ if .serviceNameSuffix }}{{ $fullName }}-{{ .serviceNameSuffix }}{{ else }}{{ $fullName }}{{ end }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains 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,11 @@ | ||
{{ if $.Values.repository.persistentVolume.enabled -}} | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: {{ $.Values.repository.name | default (printf "%s-binary" (include "mirrorbits-lite.fullname" .)) }} | ||
labels: | ||
data: {{ $.Values.repository.name | default (printf "%s-binary" (include "mirrorbits-lite.fullname" . )) }} | ||
spec: | ||
{{ toYaml .Values.repository.persistentVolume.spec | nindent 2 }} | ||
{{- end -}} |
Oops, something went wrong.