From 242a3f264fa6eb550d8267eb8327829775769629 Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Thu, 17 Jul 2025 17:39:42 +0900 Subject: [PATCH 01/10] =?UTF-8?q?feat:=20HTTP=20=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EB=B0=8F=20=EA=B8=B0=EB=B3=B8=20API=20end?= =?UTF-8?q?point=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- 2025/helm/juanxiu/cmd/main.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 2025/helm/juanxiu/cmd/main.go diff --git a/2025/helm/juanxiu/cmd/main.go b/2025/helm/juanxiu/cmd/main.go new file mode 100644 index 0000000..2fdff72 --- /dev/null +++ b/2025/helm/juanxiu/cmd/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "os" +) + +func main() { + port := os.Getenv("PORT") + if port == "" { + port = "8080" + } + + http.HandleFunc("/api/v1/juanxiu", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello, World!") + }) + + http.HandleFunc("/healthcheck", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "OK") + }) + + log.Fatal(http.ListenAndServe(":"+port, nil)) +} From 308a6f2f2e29dc4c4b5dd79b6392632912a857ab Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Thu, 17 Jul 2025 17:46:32 +0900 Subject: [PATCH 02/10] =?UTF-8?q?feat:=20Go=20=EC=9B=B9=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=EC=BB=A8=ED=85=8C=EC=9D=B4=EB=84=88=ED=99=94?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20Dockerfile=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- 2025/helm/juanxiu/Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 2025/helm/juanxiu/Dockerfile diff --git a/2025/helm/juanxiu/Dockerfile b/2025/helm/juanxiu/Dockerfile new file mode 100644 index 0000000..6c0bdfe --- /dev/null +++ b/2025/helm/juanxiu/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.24.4-alpine AS builder +WORKDIR /app +COPY cmd/ ./cmd/ +RUN go build -o myapp ./cmd + +FROM alpine:latest +WORKDIR /app +COPY --from=builder /app/myapp . +ENV PORT=8080 +EXPOSE 8080 +CMD ["./myapp"] From 07ed89e12fb01419a5d2ea2301b0dba4c02d32bd Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Fri, 18 Jul 2025 01:32:48 +0900 Subject: [PATCH 03/10] =?UTF-8?q?feat:=20kind=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EC=97=90=EC=84=9C=20NodePort=20=EB=A7=A4=ED=95=91=20=EB=B0=8F?= =?UTF-8?q?=20Helm=20chart=20=EA=B5=AC=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- 2025/helm/juanxiu/Dockerfile | 4 + 2025/helm/juanxiu/charts/.helmignore | 23 ++++ 2025/helm/juanxiu/charts/Chart.yaml | 24 ++++ 2025/helm/juanxiu/charts/templates/NOTES.txt | 22 +++ .../juanxiu/charts/templates/_helpers.tpl | 62 +++++++++ .../juanxiu/charts/templates/deployment.yaml | 78 +++++++++++ 2025/helm/juanxiu/charts/templates/hpa.yaml | 32 +++++ .../juanxiu/charts/templates/ingress.yaml | 43 ++++++ .../juanxiu/charts/templates/service.yaml | 16 +++ .../charts/templates/serviceaccount.yaml | 13 ++ .../templates/tests/test-connection.yaml | 15 +++ 2025/helm/juanxiu/charts/values.yaml | 125 ++++++++++++++++++ 2025/helm/juanxiu/go.mod | 3 + 2025/helm/juanxiu/kind_config.yaml | 14 ++ 14 files changed, 474 insertions(+) create mode 100644 2025/helm/juanxiu/charts/.helmignore create mode 100644 2025/helm/juanxiu/charts/Chart.yaml create mode 100644 2025/helm/juanxiu/charts/templates/NOTES.txt create mode 100644 2025/helm/juanxiu/charts/templates/_helpers.tpl create mode 100644 2025/helm/juanxiu/charts/templates/deployment.yaml create mode 100644 2025/helm/juanxiu/charts/templates/hpa.yaml create mode 100644 2025/helm/juanxiu/charts/templates/ingress.yaml create mode 100644 2025/helm/juanxiu/charts/templates/service.yaml create mode 100644 2025/helm/juanxiu/charts/templates/serviceaccount.yaml create mode 100644 2025/helm/juanxiu/charts/templates/tests/test-connection.yaml create mode 100644 2025/helm/juanxiu/charts/values.yaml create mode 100644 2025/helm/juanxiu/go.mod create mode 100644 2025/helm/juanxiu/kind_config.yaml diff --git a/2025/helm/juanxiu/Dockerfile b/2025/helm/juanxiu/Dockerfile index 6c0bdfe..ed96499 100644 --- a/2025/helm/juanxiu/Dockerfile +++ b/2025/helm/juanxiu/Dockerfile @@ -1,5 +1,9 @@ FROM golang:1.24.4-alpine AS builder WORKDIR /app + +COPY go.mod ./ +RUN go mod download + COPY cmd/ ./cmd/ RUN go build -o myapp ./cmd diff --git a/2025/helm/juanxiu/charts/.helmignore b/2025/helm/juanxiu/charts/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/2025/helm/juanxiu/charts/.helmignore @@ -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/ diff --git a/2025/helm/juanxiu/charts/Chart.yaml b/2025/helm/juanxiu/charts/Chart.yaml new file mode 100644 index 0000000..ecf826c --- /dev/null +++ b/2025/helm/juanxiu/charts/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: prac +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" diff --git a/2025/helm/juanxiu/charts/templates/NOTES.txt b/2025/helm/juanxiu/charts/templates/NOTES.txt new file mode 100644 index 0000000..84c4603 --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/NOTES.txt @@ -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 "charts.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 its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "charts.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "charts.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 "charts.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 }} diff --git a/2025/helm/juanxiu/charts/templates/_helpers.tpl b/2025/helm/juanxiu/charts/templates/_helpers.tpl new file mode 100644 index 0000000..68f9e0e --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "charts.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 "charts.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 "charts.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "charts.labels" -}} +helm.sh/chart: {{ include "charts.chart" . }} +{{ include "charts.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "charts.selectorLabels" -}} +app.kubernetes.io/name: {{ include "charts.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "charts.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "charts.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/2025/helm/juanxiu/charts/templates/deployment.yaml b/2025/helm/juanxiu/charts/templates/deployment.yaml new file mode 100644 index 0000000..7d03fbd --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/deployment.yaml @@ -0,0 +1,78 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "charts.fullname" . }} + labels: + {{- include "charts.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "charts.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "charts.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "charts.serviceAccountName" . }} + {{- with .Values.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + image: "{{ .Values.image.name}}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + {{- with .Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/2025/helm/juanxiu/charts/templates/hpa.yaml b/2025/helm/juanxiu/charts/templates/hpa.yaml new file mode 100644 index 0000000..353f5b1 --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "charts.fullname" . }} + labels: + {{- include "charts.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "charts.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/2025/helm/juanxiu/charts/templates/ingress.yaml b/2025/helm/juanxiu/charts/templates/ingress.yaml new file mode 100644 index 0000000..5292dde --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/ingress.yaml @@ -0,0 +1,43 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "charts.fullname" . }} + labels: + {{- include "charts.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- with .Values.ingress.className }} + ingressClassName: {{ . }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- with .pathType }} + pathType: {{ . }} + {{- end }} + backend: + service: + name: {{ include "charts.fullname" $ }} + port: + number: {{ $.Values.service.port }} + {{- end }} + {{- end }} +{{- end }} diff --git a/2025/helm/juanxiu/charts/templates/service.yaml b/2025/helm/juanxiu/charts/templates/service.yaml new file mode 100644 index 0000000..90d6d38 --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "charts.fullname" . }} + labels: + {{- include "charts.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{.Values.service.port}} + protocol: TCP + name: http + nodePort: {{.Values.service.nodePort}} + selector: + {{- include "charts.selectorLabels" . | nindent 4 }} diff --git a/2025/helm/juanxiu/charts/templates/serviceaccount.yaml b/2025/helm/juanxiu/charts/templates/serviceaccount.yaml new file mode 100644 index 0000000..4e96cce --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "charts.serviceAccountName" . }} + labels: + {{- include "charts.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/2025/helm/juanxiu/charts/templates/tests/test-connection.yaml b/2025/helm/juanxiu/charts/templates/tests/test-connection.yaml new file mode 100644 index 0000000..f482848 --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "charts.fullname" . }}-test-connection" + labels: + {{- include "charts.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "charts.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/2025/helm/juanxiu/charts/values.yaml b/2025/helm/juanxiu/charts/values.yaml new file mode 100644 index 0000000..df95d74 --- /dev/null +++ b/2025/helm/juanxiu/charts/values.yaml @@ -0,0 +1,125 @@ +# Default values for charts. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ +replicaCount: 1 + +# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ +image: + name: jinjuanxiu/ossca_prac:latest + #repository: nginx + # This sets the pull policy for images. + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + #tag: "" + +# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# This is to override the chart name. +nameOverride: "" +fullnameOverride: "" + +# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# This is for setting Kubernetes Annotations to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +podAnnotations: {} +# This is for setting Kubernetes Labels to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/ +service: + # This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + type: NodePort + # This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports + port: 8080 + nodePort: 30080 + +# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/ +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ +livenessProbe: + httpGet: + path: /healthcheck + port: 8080 +readinessProbe: + httpGet: + path: /healthcheck + port: 8080 + +# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/ +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/2025/helm/juanxiu/go.mod b/2025/helm/juanxiu/go.mod new file mode 100644 index 0000000..650cef1 --- /dev/null +++ b/2025/helm/juanxiu/go.mod @@ -0,0 +1,3 @@ +module github.com/juanxiu/ossca + +go 1.24.4 diff --git a/2025/helm/juanxiu/kind_config.yaml b/2025/helm/juanxiu/kind_config.yaml new file mode 100644 index 0000000..c3737f8 --- /dev/null +++ b/2025/helm/juanxiu/kind_config.yaml @@ -0,0 +1,14 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + # port forward 80 on the host to 80 on this node + extraPortMappings: + - containerPort: 30080 + hostPort: 30080 + # optional: set the bind address on the host + # 0.0.0.0 is the current default + listenAddress: "127.0.0.1" + # optional: set the protocol to one of TCP, UDP, SCTP. + # TCP is the default + protocol: TCP \ No newline at end of file From 7284eea2a4dcf33bf30bf2f5ba46b24bec2b9e4f Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Fri, 18 Jul 2025 23:51:40 +0900 Subject: [PATCH 04/10] =?UTF-8?q?feat:=20service=20type=EC=9D=B4=20NodePor?= =?UTF-8?q?t=20=EC=9D=BC=20=EB=95=8C=EB=A7=8C=20nodePort=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- 2025/helm/juanxiu/charts/templates/service.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/2025/helm/juanxiu/charts/templates/service.yaml b/2025/helm/juanxiu/charts/templates/service.yaml index 90d6d38..11f82e6 100644 --- a/2025/helm/juanxiu/charts/templates/service.yaml +++ b/2025/helm/juanxiu/charts/templates/service.yaml @@ -11,6 +11,8 @@ spec: targetPort: {{.Values.service.port}} protocol: TCP name: http + {{- if eq .Values.service.type "NodePort" }} nodePort: {{.Values.service.nodePort}} + {{- end }} selector: {{- include "charts.selectorLabels" . | nindent 4 }} From 355bc5ce624468028d7c2ab567466385b9fd6ee3 Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Sat, 19 Jul 2025 00:37:42 +0900 Subject: [PATCH 05/10] =?UTF-8?q?refactor:=20read/liveness=20probe=20?= =?UTF-8?q?=ED=8F=AC=ED=8A=B8=EB=A5=BC=20values=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=A7=81=EC=A0=91=20=EC=84=A4=EC=A0=95=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- 2025/helm/juanxiu/charts/templates/deployment.yaml | 8 ++++++-- 2025/helm/juanxiu/charts/values.yaml | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/2025/helm/juanxiu/charts/templates/deployment.yaml b/2025/helm/juanxiu/charts/templates/deployment.yaml index 7d03fbd..41f8e4c 100644 --- a/2025/helm/juanxiu/charts/templates/deployment.yaml +++ b/2025/helm/juanxiu/charts/templates/deployment.yaml @@ -46,11 +46,15 @@ spec: protocol: TCP {{- with .Values.livenessProbe }} livenessProbe: - {{- toYaml . | nindent 12 }} + httpGet: + path: {{ .httpGet.path | quote }} + port: {{ .httpGet.port }} {{- end }} {{- with .Values.readinessProbe }} readinessProbe: - {{- toYaml . | nindent 12 }} + httpGet: + path: {{ .httpGet.path | quote }} + port: {{ .httpGet.port }} {{- end }} {{- with .Values.resources }} resources: diff --git a/2025/helm/juanxiu/charts/values.yaml b/2025/helm/juanxiu/charts/values.yaml index df95d74..e3d0683 100644 --- a/2025/helm/juanxiu/charts/values.yaml +++ b/2025/helm/juanxiu/charts/values.yaml @@ -92,6 +92,7 @@ livenessProbe: httpGet: path: /healthcheck port: 8080 + readinessProbe: httpGet: path: /healthcheck From ba3a0c349ee0edf60dbe45e36ec5ae85c42ec075 Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Sat, 19 Jul 2025 02:36:06 +0900 Subject: [PATCH 06/10] =?UTF-8?q?refactor:=20UPX,=20scratch=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=ED=95=B4=EC=84=9C=20=EB=8F=84=EC=BB=A4=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EC=B5=9C=EC=A0=81=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- 2025/helm/juanxiu/Dockerfile | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/2025/helm/juanxiu/Dockerfile b/2025/helm/juanxiu/Dockerfile index ed96499..22cf998 100644 --- a/2025/helm/juanxiu/Dockerfile +++ b/2025/helm/juanxiu/Dockerfile @@ -1,15 +1,25 @@ +# 빌더 스테이지 FROM golang:1.24.4-alpine AS builder +RUN apk update +RUN apk add git +RUN apk add ca-certificates +RUN apk add upx + WORKDIR /app COPY go.mod ./ RUN go mod download -COPY cmd/ ./cmd/ -RUN go build -o myapp ./cmd +COPY ./cmd ./cmd + +RUN go mod tidy +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags='-s -w' -o main cmd/main.go +RUN upx --lzma main + + +# scratch 런타임 +FROM scratch +COPY --from=builder /app/main /main +CMD ["/main"] + -FROM alpine:latest -WORKDIR /app -COPY --from=builder /app/myapp . -ENV PORT=8080 -EXPOSE 8080 -CMD ["./myapp"] From a317db5227bc7a5eb55bdf14697e2378ca0db45f Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Sun, 10 Aug 2025 17:42:43 +0900 Subject: [PATCH 07/10] =?UTF-8?q?feat:=20Helm=20charts=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=EC=9D=84=20=EC=9C=84=ED=95=9C=20values.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- 2025/helm/juanxiu/charts/values.yaml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/2025/helm/juanxiu/charts/values.yaml b/2025/helm/juanxiu/charts/values.yaml index e3d0683..5783834 100644 --- a/2025/helm/juanxiu/charts/values.yaml +++ b/2025/helm/juanxiu/charts/values.yaml @@ -56,7 +56,7 @@ service: type: NodePort # This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports port: 8080 - nodePort: 30080 + nodePort: 30081 # This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/ ingress: @@ -124,3 +124,22 @@ nodeSelector: {} tolerations: [] affinity: {} + +project: + sourceRepos: + - 'https://github.com/argoproj/argocd-example-apps.git' + destinations: + - namespace: helm-guestbook + server: https://kubernetes.default.svc + +application: + metadata: + name: helm-guestbook + namespace: argocd + spec: + source: + repoURL: 'https://github.com/argoproj/argocd-example-apps.git' + path: helm-guestbook + targetRevision: HEAD + destination: + namespace: helm-guestbook From c4799fba93116eaaff42dfaac9a4f125f661a126 Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Sun, 10 Aug 2025 17:44:44 +0900 Subject: [PATCH 08/10] =?UTF-8?q?feat:=20application.yaml=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- .../juanxiu/charts/templates/application.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 2025/helm/juanxiu/charts/templates/application.yaml diff --git a/2025/helm/juanxiu/charts/templates/application.yaml b/2025/helm/juanxiu/charts/templates/application.yaml new file mode 100644 index 0000000..c104895 --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: {{ .Values.application.metadata.name }} + namespace: {{ .Values.application.metadata.namespace }} + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: {{ .Values.application.metadata.name }}-project + source: + {{- toYaml .Values.application.spec.source | nindent 4 }} + destination: + namespace: {{ .Values.application.spec.destination.namespace }} + server: {{ (index .Values.project.destinations 0).server }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file From 8fa7dbd03bab80a4c1b9f653298c3f1c2be1d2fd Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Sun, 10 Aug 2025 18:15:19 +0900 Subject: [PATCH 09/10] =?UTF-8?q?feat:=20projeect.yaml=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yeonsoo --- 2025/helm/juanxiu/charts/templates/project.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 2025/helm/juanxiu/charts/templates/project.yaml diff --git a/2025/helm/juanxiu/charts/templates/project.yaml b/2025/helm/juanxiu/charts/templates/project.yaml new file mode 100644 index 0000000..f27a3bc --- /dev/null +++ b/2025/helm/juanxiu/charts/templates/project.yaml @@ -0,0 +1,16 @@ +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: {{ .Values.application.metadata.name }}-project + namespace: {{ .Values.application.metadata.namespace }} +spec: + description: Project for the {{ .Values.application.metadata.name }} application + sourceRepos: + {{- toYaml .Values.project.sourceRepos | nindent 4 }} + destinations: + {{- toYaml .Values.project.destinations | nindent 4 }} + namespaceResourceWhitelist: + - group: '' + kind: Service + - group: 'apps' + kind: Deployment \ No newline at end of file From eca0ac5771064903a8b42f704ab504cea18d9b1f Mon Sep 17 00:00:00 2001 From: yeonsoo Date: Sat, 16 Aug 2025 11:54:04 +0900 Subject: [PATCH 10/10] =?UTF-8?q?test:=20cicd=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=B4=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2025/helm/juanxiu/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/2025/helm/juanxiu/Dockerfile b/2025/helm/juanxiu/Dockerfile index 22cf998..797d3c5 100644 --- a/2025/helm/juanxiu/Dockerfile +++ b/2025/helm/juanxiu/Dockerfile @@ -22,4 +22,3 @@ FROM scratch COPY --from=builder /app/main /main CMD ["/main"] -