This commit is contained in:
Aram 🍐 2020-12-04 23:21:17 -05:00
parent a2a9944659
commit 69cc2b1dfb
11 changed files with 267 additions and 1 deletions

View file

@ -4,10 +4,12 @@ variables:
TEAMSPEAK_SRC: ${CI_PROJECT_DIR}/teamspeak
DEFIANT_SRC: ${CI_PROJECT_DIR}/defiant
CHARTMUSEUM_SRC: ${CI_PROJECT_DIR}/chartmuseum
ABITIBI_SRC: ${CI_PROJECT_DIR}/abitibi
IMAGE_PREFIX: registry.gitlab.com/momothereal/momoperes.ca
WEBSITE_IMAGE: ${IMAGE_PREFIX}/website
DEFIANT_IMAGE: ${IMAGE_PREFIX}/defiant
ABITIBI_IMAGE: ${IMAGE_PREFIX}/abitibi
KUBECONFIG_PARENT: /etc/deploy
KUBECONFIG: ${KUBECONFIG_PARENT}/config
@ -49,6 +51,37 @@ website:deploy:
changes:
- website/**/*
### ABITIBI ###
abitibi:release:
stage: release
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "Building to ${ABITIBI_IMAGE}:${CI_COMMIT_TAG}"
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${ABITIBI_SRC} --dockerfile ${ABITIBI_SRC}/docker/Dockerfile --destination ${ABITIBI_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} --destination ${ABITIBI_IMAGE}:${CI_COMMIT_REF_SLUG}
only:
changes:
- abitibi/**/*
abitibi:deploy:
stage: deploy
image: lwolf/helm-kubectl-docker:v1.15.4-v2.14.3
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy using helm chart
- cd ${ABITIBI_SRC}
- helm upgrade --install --force --namespace ${DEPLOY_NAMESPACE} --set image.name=${ABITIBI_IMAGE},image.tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} website ./chart/abitibi
only:
refs:
- master
changes:
- abitibi/**/*
# INFRA #
infra:deploy:

2
abitibi/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.idea/
chart/abitibi/manifests/

View file

@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: Helm chart for my personal abitibi
name: abitibi
version: 0.1.0

View file

@ -0,0 +1,45 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "abitibi.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 "abitibi.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 "abitibi.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "abitibi.labels" -}}
app.kubernetes.io/name: {{ include "abitibi.name" . }}
helm.sh/chart: {{ include "abitibi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

View file

@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "abitibi.fullname" . }}
labels:
{{ include "abitibi.labels" . | indent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "abitibi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "abitibi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.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 }}

View file

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "abitibi.fullname" . }}
labels:
{{ include "abitibi.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- if (eq .Values.service.type "ClusterIP") }}
nodePort: null
{{- end }}
selector:
app.kubernetes.io/name: {{ include "abitibi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

View file

@ -0,0 +1,15 @@
replicaCount: 2
image:
name: notset
tag: latest
pullPolicy: Always
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
service:
type: ClusterIP
port: 9000

View file

@ -0,0 +1,3 @@
FROM nginx:alpine
COPY src/ /usr/share/nginx/html
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf

21
abitibi/docker/nginx.conf Normal file
View file

@ -0,0 +1,21 @@
server {
listen 80;
server_name localhost;
add_header Content-Security-Policy "default-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'";
add_header X-Frame-Options "SAMEORIGIN";
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location = /resume.txt {
root /usr/share/nginx/html;
}
}

61
abitibi/src/index.html Normal file
View file

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Abitibi Temiscamingue E-sports</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:description" content="Abitibi Temiscamingue E-sports Rocket League masters">
<meta property="og:site_name" content="Abitibi Temiscamingue E-sports">
<meta name="robots" content="index,follow">
<style>
html,
body {
font-family: Arial, Helvetica, sans-serif;
margin: 0;
}
.page-container {
margin: 0 auto;
width: 100%;
max-width: 800px;
margin-bottom: 50px;
}
.headline {
text-align: center;
margin: 20px;
}
.examples {
margin-top: 20px;
margin-left: 85px;
margin-right: 20px;
}
.footer {
text-align: center;
margin-top: 50px;
margin-left: 20px;
margin-right: 20px;
font-size: 12px;
font-style: italic;
}
@media only screen and (max-width: 900px) {
.examples {
margin-left: 20px;
}
}
</style>
</head>
<body>
<div class="page-container">
<p class="headline">
Abitibi Temiscamingue E-sports.
</p>
</div>
</body>
</html>

View file

@ -11,6 +11,9 @@ spec:
- defiant.momoperes.ca
- charts.momoperes.ca
secretName: momoperes.ca-wildcard-tls
- hosts:
- abitibitemiscamingueesports.club
secretName: abitibi-wildcard-tls
rules:
- host: momoperes.ca
http:
@ -22,7 +25,7 @@ spec:
- path: /files
backend:
serviceName: website-files
servicePort: 9000
servicePort: 9000
- host: defiant.momoperes.ca
http:
paths:
@ -37,3 +40,10 @@ spec:
backend:
serviceName: chartmuseum
servicePort: 8080
- host: abitibitemiscamingueesports.club
http:
paths:
- path: /
backend:
serviceName: abitibi
servicePort: 9000