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 1 commit
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
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
94 changes: 79 additions & 15 deletions charts/plugin-site/templates/deployment.yaml
@@ -1,10 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "plugin-site.fullname" . }}
name: {{ include "plugin-site.fullname" . }}-frontend
labels: {{ include "plugin-site.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
replicas: {{ .Values.frontend.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "plugin-site.name" . }}
Expand All @@ -22,9 +22,79 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
- name: {{ .Chart.Name }}-frontend
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
{{ if .Values.frontend.image.oldMode -}}
workingDir: /plugins
command: ["yarn"]
args: ["server"]
{{ end -}}
ports:
- name: frontend
containerPort: {{ .Values.frontend.port }}
protocol: TCP
env:
- name: REST_API_URL
value: {{ .Values.restApiUrl }}
{{ if not .Values.frontend.image.oldMode -}}
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
{{ end -}}
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 }}
---
apiVersion: apps/v1
halkeye marked this conversation as resolved.
Show resolved Hide resolved
kind: Deployment
metadata:
name: {{ include "plugin-site.fullname" . }}-backend
labels: {{ include "plugin-site.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.backend.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 }}-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 +106,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
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
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 }}
69 changes: 48 additions & 21 deletions charts/plugin-site/values.yaml
Expand Up @@ -2,12 +2,46 @@
# 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: 1000m
memory: 1024Mi

frontend:
replicaCount: 1
image:
repository: jenkinsciinfra/plugin-site
tag: 122-bd2a5f
oldMode: true
#repository: halkeye/jenkins-plugin-site
#tag: 44-14cfe6
pullPolicy: IfNotPresent
port: 80
resources:
limits:
cpu: 2000m
memory: 2048Mi
requests:
cpu: 1000m
memory: 1024Mi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The frontend doesn't probably need that amount of memory and cpu.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the javascript version does, I had it set locally to 100m cpu, and it took 15 min to test, compile, and startup.
at 1000m, it took a couple seconds

The old image is really not optimized in any way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to remember to update the resources when we enable the new static site

#resources:
# limits:
# cpu: 100m
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume these are the resources of you are using new mode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, and honestly probably a lot smaller than that, I don't fully understand the numbers :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty small I wouldn’t go smaller and should be fine for a static site

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ kubectl top pod
NAME                                                      CPU(cores)   MEMORY(bytes)
jenkins-plugins-io-plugin-site-backend-6d7c96d98b-xvb4d   7m           489Mi
jenkins-plugins-io-plugin-site-frontend-9f6665996-ng799   1m           3Mi

# memory: 64Mi
# requests:
# cpu: 100m
# memory: 64Mi

imagePullSecrets: []
nameOverride: ""
Expand All @@ -17,43 +51,36 @@ service:
type: ClusterIP

# Please define ingress settings into environment variable
#ingress:
# enabled: true
ingress:
enabled: disabled
halkeye marked this conversation as resolved.
Show resolved Hide resolved
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: ""
Expand Down
19 changes: 4 additions & 15 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,7 @@ ingress:

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

replicaCount: 2

resources:
limits:
cpu: 2000m
memory: 2048Mi
requests:
cpu: 1000m
memory: 1024Mi
backend:
replicaCount: 2
frontend:
replicaCount: 2