Skip to content

Commit

Permalink
Gitops work
Browse files Browse the repository at this point in the history
Attempting to gitops

Signed-off-by: Joe Talerico <[email protected]>
  • Loading branch information
Joe Talerico authored and jtaleric committed Jan 18, 2024
1 parent 839b17f commit aefc44b
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 16 deletions.
6 changes: 6 additions & 0 deletions deploy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: perfscale-dashboard
description: Performance and Scale Team Dashboard
type: application
version: 0.0.1
appVersion: 0.0.1
2 changes: 2 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Deploy
Work to deploy the dashboard in OpenShift w/ Argocd
21 changes: 21 additions & 0 deletions deploy/templates/NOTES.txt
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 "dashboard.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 "dashboard.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dashboard.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 "dashboard.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
62 changes: 62 additions & 0 deletions deploy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "dashboard.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 "dashboard.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 "dashboard.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "dashboard.labels" -}}
helm.sh/chart: {{ include "dashboard.chart" . }}
{{ include "dashboard.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "dashboard.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dashboard.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "dashboard.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "dashboard.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
58 changes: 58 additions & 0 deletions deploy/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "dashboard.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "dashboard.labels" . | nindent 4 }}
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
{{- include "dashboard.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "dashboard.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: frontend
image: {{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}
imagePullPolicy: "Always"
ports:
- containerPort: 3000
protocol: TCP
resources:
{{- toYaml .Values.frontend.resources | nindent 12 }}
securityContext:
{{- toYaml .Values.frontend.securityContext | nindent 12 }}
- name: backend
image: {{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}
imagePullPolicy: "Always"
securityContext:
{{- toYaml .Values.backend.securityContext | nindent 12 }}
ports:
- containerPort: 8000
protocol: TCP
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}
volumeMounts:
- name: config
mountPath: /backend/ocpperf.toml
subPath: ocpperf.toml
volumes:
- name: config
secret:
secretName: {{ .Values.elasticsearch.existingSecretName | default (printf "%s" (include "dashboard.fullname" .)) }}

36 changes: 36 additions & 0 deletions deploy/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{ if .Values.ingress.enabled }}
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{ include "dashboard.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "dashboard.labels" . | nindent 4 }}
spec:
host: {{ .Values.ingress.hostName }}.{{ .Values.ingress.baseDomain }}
port:
targetPort: 3000
to:
kind: Service
name: {{ include "dashboard.fullname" . }}
weight: 100
wildcardPolicy: None
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{ include "dashboard.fullname" . }}-api
namespace: {{ .Release.Namespace }}
labels:
{{- include "dashboard.labels" . | nindent 4 }}
spec:
host: {{ .Values.ingress.hostName }}.{{ .Values.ingress.baseDomain }}
path: "/api"
port:
targetPort: 8000
to:
kind: Service
name: {{ include "dashboard.fullname" . }}
weight: 100
wildcardPolicy: None
{{ end }}
16 changes: 16 additions & 0 deletions deploy/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{ if not .Values.elasticsearch.existingSecretName }}
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ include "dashboard.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "dashboard.labels" . | nindent 4 }}
stringData:
ocpperf.toml: |
[elasticsearch]
[ocp-server]
port = 8000
{{ end }}
21 changes: 21 additions & 0 deletions deploy/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "dashboard.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "dashboard.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- name: dashboard
port: 3000
protocol: TCP
targetPort: 3000
- name: api
port: 8000
protocol: TCP
targetPort: 8000
selector:
{{- include "dashboard.selectorLabels" . | nindent 4 }}

35 changes: 35 additions & 0 deletions deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
imagePullSecrets: []
nameOverride: ""
fullnameOverride: "dashboard"
replicaCount: 1

ingress:
enabled: true
hostName: dashboard
baseDomain: apps.sailplane.perf.lab.eng.rdu2.redhat.com

elasticsearch:
# Use existing secret
existingSecretName: "dashboard-secret"

frontend:
image:
repository: quay.io/cloud-bulldozer/frontend
tag: latest
resources: {}
securityContext:
privileged: true
allowPrivilegeEscalation: true

backend:
image:
repository: quay.io/cloud-bulldozer/backend
tag: latest
resources: {}
securityContext: {}

podAnnotations:
alpha.image.policy.openshift.io/resolve-names: '*'

podSecurityContext: {}
# fsGroup: 2000
Loading

0 comments on commit aefc44b

Please sign in to comment.