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

WIP: Upgrade deployments, start upgrade init-containers #13

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
.DS_Store
.DS_Store
*~
Binary file added images/logo512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions portal/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
apiVersion: v1
apiVersion: v2
description: PhenoMeNal Portal
name: portal
version: 2.3.1
type: application
icon: https://pbs.twimg.com/profile_images/662304401990750208/4g1r_5gs.png
version: 2.4.4

dependencies:
- name: mysql
version: 1.6.2
repository: http://storage.googleapis.com/kubernetes-charts
Binary file removed portal/charts/mysql-0.2.8.tgz
Binary file not shown.
Binary file added portal/charts/mysql-1.6.2.tgz
Binary file not shown.
4 changes: 0 additions & 4 deletions portal/requirements.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions portal/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
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/login
{{- else if contains "LoadBalancer" .Values.service.type }}
{{- else if contains "LoadBalancer" .Values.frontend.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 }}
{{- else if contains "ClusterIP" .Values.frontend.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }}
kubectl port-forward $POD_NAME 8080:{{ .Values.frontend.service.externalPort }}
{{- end }}
9 changes: 6 additions & 3 deletions portal/templates/app-lib-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-app-library
spec:
replicas: {{ .Values.app_library.replicaCount }}
template:
selector:
matchLabels:
app: {{ .Release.Name }}-app-library
template:
metadata:
labels:
app: {{ .Release.Name }}-app-library
Expand All @@ -18,6 +21,6 @@ spec:
- containerPort: {{ .Values.app_library.service.internalPort }}
env:
- name: "GIT_BRANCH"
value: {{ .Values.app_library.branch }}
value: {{ .Values.app_library.branch }}
resources:
{{ toYaml .Values.app_library.resources | indent 12 }}
28 changes: 13 additions & 15 deletions portal/templates/frontend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.frontend.name }}
spec:
replicas: {{ .Values.replicaCount }}
template:
selector:
matchLabels:
app: {{ .Values.frontend.name }}
template:
metadata:
labels:
app: {{ .Values.frontend.name }}
annotations:
pod.beta.kubernetes.io/init-containers: |-
[
{
"name": "metadata-listener",
"image": "alpine",
"imagePullPolicy": "IfNotPresent",
"command": [
"sh", "-c",
"for i in $(seq 1 200); do nc -z -w3 {{ .Release.Name }}-metadata 8888 && exit 0 || sleep 3; done; exit 1"
]
}
]
spec:
initContainers:
- name: metadata-listener
image: alpine
command:
- sh
- -c
- for i in $(seq 1 200); do nc -z -w3 {{ .Release.Name }}-metadata 8888 && exit 0 || sleep 3; done; exit 1
containers:
- name: {{ .Chart.Name }}
image: '{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}'
Expand All @@ -43,7 +41,7 @@ spec:
- name: "TSI_PORTAL_URL"
value: {{ .Values.tsi_portal_url }}
- name: "AAP_URL"
value: {{ .Values.aap_url }}
value: {{ .Values.aap_url }}
- name: "PORTAL_ANNOUNCEMENT"
value: {{ .Values.portal_announcement }}
- name: "CLOUD_DEPLOY_GIT_REPO"
Expand Down
31 changes: 31 additions & 0 deletions portal/templates/frontend-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ .Values.frontend.name }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
- host: {{ .Values.frontend.name }}.{{ .Values.mydomain }}
http:
paths:
- backend:
serviceName: {{ .Values.frontend.name }}
servicePort: 80
path: /
20 changes: 20 additions & 0 deletions portal/templates/frontend-issuer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: cert-manager.io/v1alpha2
kind: Issuer
metadata:
name: portal-tls-issuer # { { .Release.Name } }-issuer
spec:
acme:
# You must replace this email address with your own.
# Let's Encrypt will use this to contact you about expiring
# certificates, and issues related to your account.
email: {{ .Values.SiteAdminEmail }}
# server: https://acme-staging-v02.api.letsencrypt.org/directory
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
# Secret resource that will be used to store the account's private key.
name: {{ .Release.Name }}-acme-key
# Add a single challenge solver, HTTP01 using nginx
solvers:
- http01:
ingress:
class: nginx
1 change: 0 additions & 1 deletion portal/templates/frontend-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ spec:
type: {{ .Values.frontend.service.type }}
ports:
- name: {{ .Values.frontend.service.name }}
nodePort: {{ .Values.frontend.service.externalPort }}
port: {{ .Values.frontend.service.internalPort }}
selector:
app: {{ .Values.frontend.name }}
27 changes: 12 additions & 15 deletions portal/templates/metadata-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-metadata
spec:
replicas: 1
template:
selector:
matchLabels:
app: {{ .Release.Name }}-metadata
template:
metadata:
labels:
app: {{ .Release.Name }}-metadata
annotations:
pod.beta.kubernetes.io/init-containers: |-
[
{
"name": "mysql-listener",
"image": "alpine",
"imagePullPolicy": "IfNotPresent",
"command": [
"sh", "-c",
"for i in $(seq 1 200); do nc -z -w3 {{ .Release.Name }}-mysql 3306 && exit 0 || sleep 3; done; exit 1"
]
}
]
spec:
initContainers:
- name: mysql-listener
image: alpine
command:
- sh
- -c
- for i in $(seq 1 200); do nc -z -w3 {{ .Release.Name }}-mysql 3306 && exit 0 || sleep 3; echo -n "." ; done; exit 1
containers:
- name: metadata
image: '{{ .Values.metadata.image.repository }}:{{ .Values.metadata.image.tag }}'
Expand Down
7 changes: 5 additions & 2 deletions portal/templates/wiki-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-wiki
spec:
replicas: {{ .Values.wiki.replicaCount }}
template:
selector:
matchLabels:
app: {{ .Release.Name }}-wiki
template:
metadata:
labels:
app: {{ .Release.Name }}-wiki
Expand Down
30 changes: 22 additions & 8 deletions portal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,30 @@
#

# global settings
mydomain: "phenomenal-h2020.eu"

replicaCount: 1
tsi_portal_url: "https://api.portal.tsi.ebi.ac.uk/"
aap_url: "https://api.aai.ebi.ac.uk/"
cloud_deploy_git_repo: "https://github.com/phnmnl/cloud-deploy-kubenow.git"
imagePullPolicy: "Always"
#cloud_deploy_git_repo: "https://github.com/phnmnl/cloud-deploy-kubenow.git"
cloud_deploy_git_repo: "https://github.com/phnmnl/cloud-deploy-kubenow-dalcotidine-20190625.git"
#imagePullPolicy: "Always"
imagePullPolicy: "IfNotPresent"
galaxy_url: "https://public.phenomenal-h2020.eu"
galaxy_api_key: ""
enable_https: "true"
SiteAdminEmail: "[email protected]"

# frontend settings
frontend:
name: phenomenal-portal
name: portal
image:
repository: container-registry.phenomenal-h2020.eu/phnmnl/phenomenal-portal
tag: latest
service:
name: http
type: NodePort
externalPort: 30767
type: ClusterIP
externalPort: 80
internalPort: 80
resources:
limits:
Expand All @@ -38,6 +43,17 @@ frontend:
cpu: 100m
memory: 128Mi

ingress:
enabled: false
annotations:
cert-manager.io/issuer: "portal-tls-issuer"
hosts:
- host: portal.phenomenal-h2020.eu
tls: []
# - secretName: portal-cert
# hosts:
# - portal.phenomenal-h2020.eu

# mysql settings
mysql:
mysqlRootPassword: "backend"
Expand All @@ -48,7 +64,7 @@ mysql:
# metadata backend settings
metadata:
name: phenomenal-portal-metadata
image:
image:
repository: container-registry.phenomenal-h2020.eu/phnmnl/portal-metadata-backend
tag: latest
port: 8888
Expand Down Expand Up @@ -94,5 +110,3 @@ wiki:
requests:
cpu: 100m
memory: 128Mi