From b1689faab703591e9274781165627a77b17912ad Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 26 May 2026 15:12:54 +0900 Subject: [PATCH] feat: initial template structure --- CHANGELOG.md | 6 +++ README.md | 45 ++++++++++++++++++++- charts/SERVICE/Chart.yaml | 6 +++ charts/SERVICE/templates/00-namespace.yaml | 5 +++ charts/SERVICE/templates/10-pv.yaml | 14 +++++++ charts/SERVICE/templates/20-pvc.yaml | 13 ++++++ charts/SERVICE/templates/30-secret.yaml | 9 +++++ charts/SERVICE/templates/40-configmap.yaml | 8 ++++ charts/SERVICE/templates/50-deployment.yaml | 28 +++++++++++++ charts/SERVICE/templates/60-service.yaml | 17 ++++++++ charts/SERVICE/templates/70-ingress.yaml | 21 ++++++++++ charts/SERVICE/templates/80-hpa.yaml | 13 ++++++ charts/SERVICE/values.yaml | 36 +++++++++++++++++ 13 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md create mode 100644 charts/SERVICE/Chart.yaml create mode 100644 charts/SERVICE/templates/00-namespace.yaml create mode 100644 charts/SERVICE/templates/10-pv.yaml create mode 100644 charts/SERVICE/templates/20-pvc.yaml create mode 100644 charts/SERVICE/templates/30-secret.yaml create mode 100644 charts/SERVICE/templates/40-configmap.yaml create mode 100644 charts/SERVICE/templates/50-deployment.yaml create mode 100644 charts/SERVICE/templates/60-service.yaml create mode 100644 charts/SERVICE/templates/70-ingress.yaml create mode 100644 charts/SERVICE/templates/80-hpa.yaml create mode 100644 charts/SERVICE/values.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..60f1e8b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +## [Unreleased] + +## [v0.1.0] +- Initial manifest snapshot (as-is) diff --git a/README.md b/README.md index c87f566..875ddc3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,46 @@ # template -k3sマニフェスト管理テンプレートリポジトリ \ No newline at end of file +k3s-manifests 組織のリポジトリテンプレートです。 + +## ファイル構成 + + charts/SERVICE/ + ├── Chart.yaml + ├── values.yaml + └── templates/ + ├── 00-namespace.yaml # Namespace + ├── 10-pv.yaml # PersistentVolume + ├── 20-pvc.yaml # PersistentVolumeClaim + ├── 30-secret.yaml # Secret + ├── 40-configmap.yaml # ConfigMap + ├── 50-deployment.yaml # Deployment / StatefulSet + ├── 60-service.yaml # Service + ├── 70-ingress.yaml # Ingress + └── 80-hpa.yaml # HorizontalPodAutoscaler + +## 番号規約 + +- 10区切りで読み込み順を管理 +- 並列インスタンスは1区切り(例: 50-deployment-admin.yaml, 51-deployment-usera.yaml) +- 不要なファイルは作らない(欠番OK、番号は詰めない) +- ファイル名固定(中身がStatefulSetでも50-deployment.yaml) + +## バージョニング + +- semver(MAJOR.MINOR.PATCH) +- v0.x.x: ペライチマニフェスト管理 +- v1.0.0: Helm化完了 + +## ラベル規約 + + labels: + app.kubernetes.io/name: {service} + app.kubernetes.io/version: {version} + app.kubernetes.io/managed-by: gitea-actions + +## 使い方 + +1. このリポジトリをテンプレートとして新規リポジトリを作成 +2. SERVICE を実際のサービス名に置き換え +3. 不要なtemplateファイルは削除 +4. values.yaml を環境に合わせて編集 diff --git a/charts/SERVICE/Chart.yaml b/charts/SERVICE/Chart.yaml new file mode 100644 index 0000000..6eab1f2 --- /dev/null +++ b/charts/SERVICE/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: SERVICE +description: SERVICE on mitaconserver +type: application +version: 0.1.0 +appVersion: "latest" diff --git a/charts/SERVICE/templates/00-namespace.yaml b/charts/SERVICE/templates/00-namespace.yaml new file mode 100644 index 0000000..fb9d11b --- /dev/null +++ b/charts/SERVICE/templates/00-namespace.yaml @@ -0,0 +1,5 @@ +# 使用する場合のみ残す +# apiVersion: v1 +# kind: Namespace +# metadata: +# name: core diff --git a/charts/SERVICE/templates/10-pv.yaml b/charts/SERVICE/templates/10-pv.yaml new file mode 100644 index 0000000..c78b147 --- /dev/null +++ b/charts/SERVICE/templates/10-pv.yaml @@ -0,0 +1,14 @@ +# 使用する場合のみ残す +# apiVersion: v1 +# kind: PersistentVolume +# metadata: +# name: {{ .Release.Name }}-pv +# spec: +# capacity: +# storage: {{ .Values.persistence.size }} +# accessModes: +# - ReadWriteOnce +# persistentVolumeReclaimPolicy: Retain +# storageClassName: local-storage-ssd +# hostPath: +# path: {{ .Values.persistence.hostPath }} diff --git a/charts/SERVICE/templates/20-pvc.yaml b/charts/SERVICE/templates/20-pvc.yaml new file mode 100644 index 0000000..c813dae --- /dev/null +++ b/charts/SERVICE/templates/20-pvc.yaml @@ -0,0 +1,13 @@ +# 使用する場合のみ残す +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: {{ .Release.Name }}-pvc +# namespace: core +# spec: +# accessModes: +# - ReadWriteOnce +# storageClassName: local-storage-ssd +# resources: +# requests: +# storage: {{ .Values.persistence.size }} diff --git a/charts/SERVICE/templates/30-secret.yaml b/charts/SERVICE/templates/30-secret.yaml new file mode 100644 index 0000000..3b41102 --- /dev/null +++ b/charts/SERVICE/templates/30-secret.yaml @@ -0,0 +1,9 @@ +# 使用する場合のみ残す +# apiVersion: v1 +# kind: Secret +# metadata: +# name: {{ .Release.Name }}-secret +# namespace: core +# type: Opaque +# stringData: +# password: "" diff --git a/charts/SERVICE/templates/40-configmap.yaml b/charts/SERVICE/templates/40-configmap.yaml new file mode 100644 index 0000000..30dbf4c --- /dev/null +++ b/charts/SERVICE/templates/40-configmap.yaml @@ -0,0 +1,8 @@ +# 使用する場合のみ残す +# apiVersion: v1 +# kind: ConfigMap +# metadata: +# name: {{ .Release.Name }}-config +# namespace: core +# data: +# key: value diff --git a/charts/SERVICE/templates/50-deployment.yaml b/charts/SERVICE/templates/50-deployment.yaml new file mode 100644 index 0000000..9dd831a --- /dev/null +++ b/charts/SERVICE/templates/50-deployment.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} + namespace: core + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Values.image.tag }} + app.kubernetes.io/managed-by: gitea-actions +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }} + app.kubernetes.io/name: {{ .Release.Name }} + spec: + containers: + - name: {{ .Release.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.service.port }} + resources: + {{- toYaml .Values.resources | nindent 10 }} diff --git a/charts/SERVICE/templates/60-service.yaml b/charts/SERVICE/templates/60-service.yaml new file mode 100644 index 0000000..cb0cac0 --- /dev/null +++ b/charts/SERVICE/templates/60-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + namespace: core + labels: + app.kubernetes.io/name: {{ .Release.Name }} + app.kubernetes.io/managed-by: gitea-actions +spec: + type: {{ .Values.service.type }} + selector: + app: {{ .Release.Name }} + ports: + - name: http + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP diff --git a/charts/SERVICE/templates/70-ingress.yaml b/charts/SERVICE/templates/70-ingress.yaml new file mode 100644 index 0000000..1a3af9f --- /dev/null +++ b/charts/SERVICE/templates/70-ingress.yaml @@ -0,0 +1,21 @@ +# 使用する場合のみ残す +# {{- if .Values.ingress.enabled }} +# apiVersion: networking.k8s.io/v1 +# kind: Ingress +# metadata: +# name: {{ .Release.Name }}-ingress +# namespace: core +# spec: +# ingressClassName: {{ .Values.ingress.className }} +# rules: +# - host: {{ .Values.ingress.host }} +# http: +# paths: +# - path: / +# pathType: Prefix +# backend: +# service: +# name: {{ .Release.Name }} +# port: +# number: {{ .Values.service.port }} +# {{- end }} diff --git a/charts/SERVICE/templates/80-hpa.yaml b/charts/SERVICE/templates/80-hpa.yaml new file mode 100644 index 0000000..732866d --- /dev/null +++ b/charts/SERVICE/templates/80-hpa.yaml @@ -0,0 +1,13 @@ +# 使用する場合のみ残す +# apiVersion: autoscaling/v2 +# kind: HorizontalPodAutoscaler +# metadata: +# name: {{ .Release.Name }}-hpa +# namespace: core +# spec: +# scaleTargetRef: +# apiVersion: apps/v1 +# kind: Deployment +# name: {{ .Release.Name }} +# minReplicas: 1 +# maxReplicas: 3 diff --git a/charts/SERVICE/values.yaml b/charts/SERVICE/values.yaml new file mode 100644 index 0000000..639c1c8 --- /dev/null +++ b/charts/SERVICE/values.yaml @@ -0,0 +1,36 @@ +# イメージ設定 +image: + repository: "" + tag: "latest" + pullPolicy: IfNotPresent + +# レプリカ数 +replicaCount: 1 + +# リソース制限 +resources: {} + # limits: + # cpu: 500m + # memory: 512Mi + # requests: + # cpu: 100m + # memory: 128Mi + +# ストレージ設定 +persistence: + enabled: true + storageClass: "" + size: 1Gi + hostPath: "" + +# サービス設定 +service: + type: ClusterIP + port: 80 + +# Ingress設定 +ingress: + enabled: false + className: "" + host: "" + tls: false