Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plugins helm chart to pull files from infra #101

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/javadoc/templates/deployment.yaml
Expand Up @@ -69,4 +69,4 @@ spec:
{{ toYaml .Values.htmlVolume | indent 10 }}
- name: config
configMap:
name: javadoc
name: javadoc
12 changes: 6 additions & 6 deletions charts/plugin-site/README.md
Expand Up @@ -26,14 +26,14 @@ ingress:
nginx.ingress.kubernetes.io/rewrite-target: /$1
hosts:
- host: plugins-local.jenkins.io
paths:
- path: /api/(.*)
port: backend
- path: /(.*)
port: frontend

restApiUrl: http://plugins-local.jenkins.io/api

# Should point to somewhere where the plugin-site's built public directory is
htmlVolume:
hostPath:
path: /src/path/to/your/build/public

```

The `ingress host` and the `restApiUrl` need to be reachable from both your desktop and from the k8s cluster
Expand All @@ -49,4 +49,4 @@ hostAliases:
- ip: "<minikube ip, can get from kubectl get ingress>"
hostnames:
- "plugins-local.jenkins.io"
```
```
4 changes: 1 addition & 3 deletions charts/plugin-site/templates/NOTES.txt
@@ -1,9 +1,7 @@
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 }}{{ .path }}
{{- end }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}/
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "plugin-site.fullname" . }})
Expand Down
@@ -1,10 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "plugin-site.fullname" . }}
name: {{ include "plugin-site.fullname" . }}-backend
labels: {{ include "plugin-site.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
replicas: {{ .Values.backend.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "plugin-site.name" . }}
Expand All @@ -22,9 +22,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
- name: {{ .Chart.Name }}-backend
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}"
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
env:
- name: GITHUB_CLIENT_ID
valueFrom:
Expand All @@ -36,34 +36,28 @@ spec:
secretKeyRef:
name: {{ include "plugin-site.fullname" . }}
key: github_client_secret
- name: REST_API_URL
value: {{ .Values.restApiUrl }}
- name: DATA_FILE_URL
value: {{ .Values.dataFileUrl }}

ports:
- name: frontend
containerPort: 5000
protocol: TCP
- name: backend
containerPort: 8080
containerPort: {{ .Values.backend.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /labels
port: 8080
port: {{ .Values.backend.port }}
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /labels
port: 8080
port: {{ .Values.backend.port }}
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- toYaml .Values.backend.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
68 changes: 68 additions & 0 deletions charts/plugin-site/templates/deployment-frontend.yaml
@@ -0,0 +1,68 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "plugin-site.fullname" . }}-frontend
labels: {{ include "plugin-site.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.frontend.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "plugin-site.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels: {{ include "plugin-site.labels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.hostAliases }}
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-frontend
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
ports:
- name: frontend
containerPort: {{ .Values.frontend.port }}
protocol: TCP
env:
- name: REST_API_URL
value: {{ .Values.restApiUrl }}
livenessProbe:
httpGet:
path: /
port: {{ .Values.frontend.port }}
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
port: {{ .Values.frontend.port }}
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 5
volumeMounts:
- name: html
mountPath: /pub
resources:
{{- toYaml .Values.frontend.resources | nindent 12 }}
{{- 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: html
{{ toYaml .Values.htmlVolume | indent 10 }}
13 changes: 7 additions & 6 deletions charts/plugin-site/templates/ingress.yaml
@@ -1,5 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "plugin-site.fullname" . -}}
{{- $paths := .Values.ingress.paths -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
Expand All @@ -13,20 +14,20 @@ metadata:
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
{{- range $ingress := .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
{{- range $ingress.hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
secretName: {{ $ingress.secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
{{- range $ingress := .Values.ingress.hosts }}
- host: {{ $ingress.host | quote }}
http:
paths:
{{- range .paths }}
{{- range $paths }}
- path: {{ .path }}
backend:
serviceName: {{ $fullName }}
Expand Down
6 changes: 6 additions & 0 deletions charts/plugin-site/templates/secret.yaml
Expand Up @@ -9,3 +9,9 @@ type: Opaque
data:
github_client_id: {{ .Values.github.clientId | b64enc }}
github_client_secret: {{ .Values.github.clientSecret | b64enc }}
{{ if .Values.azureStorageAccountName }}
azurestorageaccountname: {{ .Values.azureStorageAccountName | b64enc }}
{{- end }}
{{ if .Values.azureStorageAccountKey }}
azurestorageaccountkey: {{ .Values.azureStorageAccountKey | b64enc }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/plugin-site/templates/service.yaml
Expand Up @@ -9,11 +9,11 @@ spec:
- name: frontend
protocol: TCP
targetPort: frontend
port: 5000
port: {{ .Values.frontend.port }}
- name: backend
protocol: TCP
targetPort: backend
port: 8080
port: {{ .Values.backend.port }}
selector:
app.kubernetes.io/name: {{ include "plugin-site.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
71 changes: 50 additions & 21 deletions charts/plugin-site/values.yaml
Expand Up @@ -2,12 +2,36 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: jenkinsciinfra/plugin-site
tag: 122-bd2a5f
pullPolicy: IfNotPresent
backend:
replicaCount: 1
image:
repository: jenkinsciinfra/plugin-site-api
tag: 133-b6e652
pullPolicy: IfNotPresent
port: 8080
resources:
limits:
cpu: 2000m
memory: 2048Mi
requests:
cpu: 500m
memory: 1024Mi

frontend:
replicaCount: 1
image:
repository: gatsbyjs/gatsby
tag: latest
pullPolicy: Always
port: 80
resources:
limits:
cpu: 10m
memory: 32Mi
requests:
cpu: 10m
memory: 32Mi

imagePullSecrets: []
nameOverride: ""
Expand All @@ -17,44 +41,49 @@ service:
type: ClusterIP

# Please define ingress settings into environment variable
#ingress:
# enabled: true
ingress:
enabled: false
paths:
- path: /api/(.*)
port: backend
- path: /(.*)
port: frontend

# annotations:
# "cert-manager.io/cluster-issuer": "letsencrypt-prod"
# "kubernetes.io/ingress.class": "public-ingress"
# "nginx.ingress.kubernetes.io/proxy-body-size": "500m"
#
# hosts:
# - host: plugins.jenkins.io
# paths:
# - /
#
# tls:
# - secretName: plugins-tls
# hosts:
# - plugins.jenkins.io

resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

restApiUrl: ""
dataFileUrl: https://ci.jenkins.io/job/Infra/job/plugin-site-api/job/generate-data/lastSuccessfulBuild/artifact/plugins.json.gzip
restApiUrl: https://plugins.jenkins.io/api

github:
clientId: ""
clientSecret: ""

# the volume to mount
# e.g.
# htmlVolume:
# hostPath:
# path: /host
htmlVolume:

# name of the azure storage account to be used
azureStorageAccountName:
# key for accessing the azure storage account
azureStorageAccountKey:
21 changes: 7 additions & 14 deletions config/default/plugin-site.yaml
Expand Up @@ -10,14 +10,8 @@ ingress:
"nginx.ingress.kubernetes.io/cors-allow-methods": "GET, OPTIONS"
"nginx.ingress.kubernetes.io/cors-allow-origin": "*"


hosts:
- host: plugins.jenkins.io
paths:
- path: /api/(.*)
port: backend
- path: /(.*)
port: frontend

tls:
- secretName: plugins-tls
Expand All @@ -26,12 +20,11 @@ ingress:

restApiUrl: https://plugins.jenkins.io/api

replicaCount: 2
backend:
replicaCount: 2

resources:
limits:
cpu: 2000m
memory: 2048Mi
requests:
cpu: 1000m
memory: 1024Mi
htmlVolume:
azureFile:
secretName: plugin-site
shareName: prodpluginsite
halkeye marked this conversation as resolved.
Show resolved Hide resolved
readOnly: true