Skip to content

Commit

Permalink
Merge pull request #34 from StackStorm/enh/loadbalancer
Browse files Browse the repository at this point in the history
Support additional st2web service types (ClusterIP, NodePort, LoadBalancer and ExternalName)
  • Loading branch information
warrenvw authored Nov 13, 2018
2 parents 5dcac08 + b4815f9 commit afc760a
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
charts
*.lock
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## In Development

## v0.8.0
* Add ability to specify service type for st2web (#35)

## v0.7.1
* Fix st2web re-deployment is not triggered when updating SSL cert (#33)
Expand Down
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
# Update StackStorm version here to rely on other Docker images tags
appVersion: 3.0dev
name: stackstorm-ha
version: 0.7.1
version: 0.8.0
description: StackStorm K8s Helm Chart, optimized for running StackStorm in HA environment.
home: https://stackstorm.com/#product
icon: https://avatars1.githubusercontent.com/u/4969009
Expand Down
4 changes: 4 additions & 0 deletions requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ dependencies:
version: 0.2.2
repository: https://kubernetes-charts-incubator.storage.googleapis.com/
condition: docker-registry.enabled
- name: external-dns
version: 1.0.2
repository: https://kubernetes-charts.storage.googleapis.com/
condition: external-dns.enabled
22 changes: 20 additions & 2 deletions templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,29 @@ Congratulations! You have just deployed StackStorm {{ if .Values.enterprise.enab
███████║ ██║ ███████╗ ██║ ██║██║ ██║ ╚██████╔╝██║ ██╗
╚══════╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝

1. Get the StackStorm Web UI URL by running these commands:
1. Get the StackStorm Web UI URL:
{{- if contains "LoadBalancer" .Values.st2web.service.type }}

NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with "kubectl get service st2cicd-st2web-enterprise -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'"

export ST2WEB_IP=$(kubectl get service st2cicd-st2web-enterprise -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
echo https://${ST2WEB_IP}/

{{- else if contains "ClusterIP" .Values.st2web.service.type }}

echo https://127.0.0.1:8443
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ .Release.Name }}-st2web-{{ if .Values.enterprise.enabled }}-enterprise {{ end }} 8443:443

{{- end }}
{{- if contains "NodePort" .Values.st2web.service.type }}

export ST2WEB_IP=$(minikube ip 2>/dev/null || kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
export ST2WEB_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ .Release.Name }}-st2web{{ template "enterpriseSuffix" . }})
export ST2WEB_PORT="$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ .Release.Name }}-st2web{{ template "enterpriseSuffix" . }})"
echo https://${ST2WEB_IP}:${ST2WEB_PORT}/

{{- end }}

2. Login with the following credentials:
username: {{ .Values.secrets.st2.username }}
password: {{ .Values.secrets.st2.password }}
Expand Down
14 changes: 12 additions & 2 deletions templates/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ metadata:
name: {{ .Release.Name }}-st2web{{ template "enterpriseSuffix" . }}
annotations:
description: StackStorm st2web, - an admin Web UI and main entry point for external API requests
{{- if .Values.st2web.service.hostname }}
external-dns.alpha.kubernetes.io/hostname: {{ .Values.st2web.service.hostname | quote }}
{{- end }}
{{- if .Values.st2web.annotations }}
{{ toYaml .Values.st2web.annotations | indent 4 }}
{{- end }}
labels:
app: st2web
tier: frontend
Expand All @@ -93,8 +99,12 @@ spec:
app: st2web
support: {{ template "supportMethod" . }}
release: {{ .Release.Name }}
# TODO: Consider to template it, if needed
type: NodePort
type: {{ .Values.st2web.service.type }}
{{- if contains "ExternalName" .Values.st2web.service.type }}
{{- if .Values.st2web.service.hostname }}
externalName: {{ .Values.st2web.service.hostname }}
{{- end }}
{{- end }}
ports:
- protocol: TCP
port: 443
25 changes: 24 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,16 @@ st2web:
cpu: "50m"
limits:
memory: "100Mi"
# TODO: Add Ingress and/or LoadBalancer setting as a way to expose service to public (#6)
# TODO: Add Ingress setting as a way to expose service to public (#6).
# ingress:
service:
# type can be one of "ClusterIP", "NodePort", "LoadBalancer" or "ExternalName"
type: "NodePort"
# The hostname associated with st2web service (externalName, added to external DNS, etc.)
hostname: ""
# For more information regarding annotations, see
# https://kubernetes.io/docs/concepts/services-networking/service/#ssl-support-on-aws
annotations: {}
# Additional advanced settings to control pod/deployment placement
nodeSelector: {}
tolerations: []
Expand Down Expand Up @@ -388,3 +396,18 @@ kube-registry-proxy:
host: st2packs-docker-registry.default.svc.cluster.local
port: 5000
hostPort: 5000

##
## External DNS configuration (3rd party chart dependency)
##
## Creates a deployment of external-dns within the cluster to update DNS with CNAME -> ELB
##
## For values.yaml reference:
## https://github.com/helm/charts/tree/master/stable/external-dns
##
## TODO: If eq st2web.service.type "LoadBalancer", set enabled to true. Any other cases?
external-dns:
enabled: false
aws:
zoneType: "public"
domainFilters: []

0 comments on commit afc760a

Please sign in to comment.