Skip to content

Commit

Permalink
Merge pull request #4 from GGGGarlic/fix/git-ignore
Browse files Browse the repository at this point in the history
Fix/git ignore
  • Loading branch information
draJiang authored Jan 18, 2024
2 parents 1c68c91 + 633f263 commit ebd28b6
Show file tree
Hide file tree
Showing 20 changed files with 761 additions and 21 deletions.
39 changes: 39 additions & 0 deletions .deploy/blog.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;

underscores_in_headers on;

server {
listen 80 default_server;
root /var/www/;
gzip on;
gzip_min_length 1000;
gzip_types text/plain application/x-javascript application/javascript text/css application/xml application/json;
charset utf-8;
charset_types text/plain application/javascript application/x-javascript application/json text/css;

location / {
try_files $uri /index.html;
}

location ~* \.html$ {
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|mp3|js|css|otf|eot|svg|ttf|woff)$ {
add_header Cache-Control max-age=2592000;
}

location = /ping {
return 200 'pong';
}
}
}
23 changes: 23 additions & 0 deletions .deploy/go-heptabase/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions .deploy/go-heptabase/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: go-heptabase
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
5 changes: 5 additions & 0 deletions .deploy/go-heptabase/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
install:
helm -n blog upgrade frontend . -f local.values.yaml --create-namespace --install --kube-context kiila

uninstall:
helm -n blog uninstall frontend --kube-context kiila
15 changes: 15 additions & 0 deletions .deploy/go-heptabase/local.values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ingress:
enabled: true
className: nginx
annotations:
kubernetes.io/tls-acme: "true"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
hosts:
- host: blog.kii.la
paths:
- path: /
pathType: ImplementationSpecific
tls:
- secretName: blog.kii.la
hosts:
- blog.kii.la
159 changes: 159 additions & 0 deletions .deploy/go-heptabase/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
---
# Source: go-heptabase/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: go-heptabase
labels:
helm.sh/chart: go-heptabase-0.1.0
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
app.kubernetes.io/version: "1.16.0"
app.kubernetes.io/managed-by: Helm
---
# Source: go-heptabase/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: go-heptabase
labels:
helm.sh/chart: go-heptabase-0.1.0
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
app.kubernetes.io/version: "1.16.0"
app.kubernetes.io/managed-by: Helm
data:
config.yaml: |-
env: debug
heptabase:
shared_id: 5b32b02b51a359eb2e4d5bbbfe41003a043924131f374c0950f444f79fdf65e0
timeout: 10
---
# Source: go-heptabase/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: go-heptabase
labels:
helm.sh/chart: go-heptabase-0.1.0
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
app.kubernetes.io/version: "1.16.0"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
---
# Source: go-heptabase/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: go-heptabase
labels:
helm.sh/chart: go-heptabase-0.1.0
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
app.kubernetes.io/version: "1.16.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
template:
metadata:
labels:
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
spec:
serviceAccountName: go-heptabase
securityContext:
{}
containers:
- name: go-heptabase
volumeMounts:
- mountPath: /usr/share/nginx/html
name: go-heptabase
securityContext:
{}
image: "ccr.ccs.tencentyun.com/farfalle/blog:server-latest"
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{}
volumes:
- name: go-heptabase
hostPath:
path: /go-heptabase
---
# Source: go-heptabase/templates/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: go-heptabase
labels:
helm.sh/chart: go-heptabase-0.1.0
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
app.kubernetes.io/version: "1.16.0"
app.kubernetes.io/managed-by: Helm
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/tls-acme: "true"
spec:
ingressClassName: nginx
tls:
- hosts:
- "go-heptabase.vs-game.com"
secretName: go-heptabase.vs-game.com
rules:
- host: "go-heptabase.vs-game.com"
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: go-heptabase
port:
number: 80
---
# Source: go-heptabase/templates/tests/test-connection.yaml
apiVersion: v1
kind: Pod
metadata:
name: "go-heptabase-test-connection"
labels:
helm.sh/chart: go-heptabase-0.1.0
app.kubernetes.io/name: go-heptabase
app.kubernetes.io/instance: go-heptabase
app.kubernetes.io/version: "1.16.0"
app.kubernetes.io/managed-by: Helm
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['go-heptabase:80']
restartPolicy: Never
22 changes: 22 additions & 0 deletions .deploy/go-heptabase/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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 }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "go-heptabase.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 "go-heptabase.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "go-heptabase.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 "go-heptabase.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions .deploy/go-heptabase/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "go-heptabase.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 "go-heptabase.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 "go-heptabase.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "go-heptabase.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "go-heptabase.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading

0 comments on commit ebd28b6

Please sign in to comment.