refactor: rename template names

This commit is contained in:
Felipe M 2022-08-13 09:50:18 +02:00
parent a6ccce98a5
commit 20e75dcfeb
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
15 changed files with 42 additions and 41 deletions

View File

@ -20,7 +20,7 @@ builds:
goarch: arm
- goos: windows
goarch: arm64
main: ./cmd/golang-app-template
main: ./cmd/notion2ical
ldflags:
- -s -w
archives:

View File

@ -1,4 +1,4 @@
PROJECT_NAME := golang-app-template
PROJECT_NAME := notion2ical
SOURCE_FILES ?=./internal/... ./cmd/... ./pkg/...
@ -61,6 +61,7 @@ clean: ### clean test cache, build files
$(info: Make: Clean)
@rm -rf ${BUILDS_PATH}
@go clean ${CLEAN_OPTIONS}
@docker buildx rm -f ${PROJECT_NAME}_builder
.PHONY: build
build: clean ### builds the project for the setup os/arch combinations

View File

@ -1 +1 @@
# golang-app-template
# notion2ical

2
go.mod
View File

@ -1,3 +1,3 @@
module github.com/fmartingr/golang-app-template
module github.com/fmartingr/notion2ical
go 1.19

View File

@ -1,5 +1,5 @@
apiVersion: v2
name: golang-app-template
name: notion2ical
description: A Helm chart for Kubernetes
type: application
# This is the chart version. This version number should be incremented each time you make changes

View File

@ -3,13 +3,13 @@
## Install the chart
```
helm install --namespace golang-app-template --atomic golang-app-template .
helm install --namespace notion2ical --atomic notion2ical .
```
## Upgrading the chart
```
helm upgrade --namespace golang-app-template --atomic golang-app-template .
helm upgrade --namespace notion2ical --atomic notion2ical .
```
## Using locally with latest dev image

View File

@ -6,16 +6,16 @@
{{- 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 "golang-app-template.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "notion2ical.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 "golang-app-template.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "golang-app-template.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "notion2ical.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "notion2ical.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 "golang-app-template.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "notion2ical.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

View File

@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "golang-app-template.name" -}}
{{- define "notion2ical.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
@ -10,7 +10,7 @@ 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 "golang-app-template.fullname" -}}
{{- define "notion2ical.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "golang-app-template.chart" -}}
{{- define "notion2ical.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "golang-app-template.labels" -}}
helm.sh/chart: {{ include "golang-app-template.chart" . }}
{{ include "golang-app-template.selectorLabels" . }}
{{- define "notion2ical.labels" -}}
helm.sh/chart: {{ include "notion2ical.chart" . }}
{{ include "notion2ical.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "golang-app-template.selectorLabels" -}}
app.kubernetes.io/name: {{ include "golang-app-template.name" . }}
{{- define "notion2ical.selectorLabels" -}}
app.kubernetes.io/name: {{ include "notion2ical.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "golang-app-template.serviceAccountName" -}}
{{- define "notion2ical.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "golang-app-template.fullname" .) .Values.serviceAccount.name }}
{{- default (include "notion2ical.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}

View File

@ -1,5 +1,5 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "golang-app-template.fullname" . -}}
{{- $fullName := include "notion2ical.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
@ -17,7 +17,7 @@ kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "golang-app-template.labels" . | nindent 4 }}
{{- include "notion2ical.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}

View File

@ -1,9 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "golang-app-template.fullname" . }}
name: {{ include "notion2ical.fullname" . }}
labels:
{{- include "golang-app-template.labels" . | nindent 4 }}
{{- include "notion2ical.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
@ -12,4 +12,4 @@ spec:
protocol: TCP
name: http
selector:
{{- include "golang-app-template.selectorLabels" . | nindent 4 }}
{{- include "notion2ical.selectorLabels" . | nindent 4 }}

View File

@ -2,9 +2,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "golang-app-template.serviceAccountName" . }}
name: {{ include "notion2ical.serviceAccountName" . }}
labels:
{{- include "golang-app-template.labels" . | nindent 4 }}
{{- include "notion2ical.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}

View File

@ -1,17 +1,17 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "golang-app-template.fullname" . }}
name: {{ include "notion2ical.fullname" . }}
labels:
{{- include "golang-app-template.labels" . | nindent 4 }}
{{- include "notion2ical.labels" . | nindent 4 }}
spec:
serviceName: {{ include "golang-app-template.fullname" . }}
serviceName: {{ include "notion2ical.fullname" . }}
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "golang-app-template.selectorLabels" . | nindent 6 }}
{{- include "notion2ical.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
@ -19,13 +19,13 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "golang-app-template.selectorLabels" . | nindent 8 }}
{{- include "notion2ical.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "golang-app-template.serviceAccountName" . }}
serviceAccountName: {{ include "notion2ical.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:

View File

@ -1,9 +1,9 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "golang-app-template.fullname" . }}-test-connection"
name: "{{ include "notion2ical.fullname" . }}-test-connection"
labels:
{{- include "golang-app-template.labels" . | nindent 4 }}
{{- include "notion2ical.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
@ -11,5 +11,5 @@ spec:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "golang-app-template.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "notion2ical.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never

View File

@ -5,7 +5,7 @@
replicaCount: 1
image:
repository: ghcr.io/fmartingr/golang-app-template
repository: ghcr.io/fmartingr/notion2ical
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
# tag: "dev"
@ -50,14 +50,14 @@ ingress:
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: golang-app-template.local
- host: notion2ical.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: golang-app-template-tls
# - secretName: notion2ical-tls
# hosts:
# - golang-app-template.local
# - notion2ical.local
resources:
{}