-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathtemplate.yaml
More file actions
185 lines (178 loc) · 6.32 KB
/
template.yaml
File metadata and controls
185 lines (178 loc) · 6.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Sealos Application Template Reference
#
# This file serves as a template reference for creating Sealos application templates.
# Copy this file and customize it for your application.
#
# Required fields are marked with [REQUIRED]
# Fill in the placeholders with your application-specific information.
---
apiVersion: app.sealos.io/v1
kind: Template
metadata:
name: myapp-template
spec:
# Application metadata
title: "" # [REQUIRED] Application display name
url: "" # [REQUIRED] Your app's official website
gitRepo: "" # [REQUIRED] Your app's GitHub repository URL
author: "" # [REQUIRED] Your name or organization
description: "" # [REQUIRED] Brief description of your app
readme: 'https://raw.githubusercontent.com/labring-actions/templates/main/template/<app-name>/README.md' # Update <app-name> with actual app name
icon: "" # [REQUIRED] URL to your app's icon
templateType: inline # Template type: inline (all resources in one file)
locale: en
i18n:
zh:
title: '应用标题' # Chinese title for your app
description: '应用描述' # Chinese description for your app
categories:
- tool # [REQUIRED] Choose from: ai, database, tool, low-code, blog, storage, frontend, backend, dev-ops, monitor, game
# Default values for template variables
defaults:
app_host:
type: string
value: myapp-${{ random(8) }} # Replace "myapp" with your app's name prefix
app_name:
type: string
value: myapp-${{ random(8) }} # Replace "myapp" with your app's name prefix
# User-configurable inputs (will be rendered as form fields)
inputs:
volume_size:
description: "Persistent storage size (GiB)"
type: string
default: "1"
required: false
# Add more inputs as needed, e.g.:
# - app_password:
# description: "Admin password"
# type: string
# required: true
---
# StatefulSet - Manages your application pods
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ${{ defaults.app_name }}
annotations:
originImageName: "" # [REQUIRED] Your app's Docker image URL
deploy.cloud.sealos.io/minReplicas: "1"
deploy.cloud.sealos.io/maxReplicas: "1"
labels:
cloud.sealos.io/app-deploy-manager: ${{ defaults.app_name }}
app: ${{ defaults.app_name }}
spec:
replicas: 1
revisionHistoryLimit: 1
minReadySeconds: 10
serviceName: ${{ defaults.app_name }}
selector:
matchLabels:
app: ${{ defaults.app_name }}
template:
metadata:
labels:
app: ${{ defaults.app_name }}
spec:
terminationGracePeriodSeconds: 10
automountServiceAccountToken: false # Security: disable service account token mounting
containers:
- name: ${{ defaults.app_name }}
image: "" # [REQUIRED] Your app's Docker image URL
env: [] # Environment variables (add as needed)
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 1000m
memory: 1024Mi
command: [] # Override entrypoint if needed
args: [] # Command arguments
ports:
- containerPort: 80 # [REQUIRED] Your app's internal port
imagePullPolicy: IfNotPresent
volumeMounts:
- name: data-volume
mountPath: /app/data # Path where your app stores data
volumes: [] # Additional volumes (if any)
volumeClaimTemplates:
- metadata:
annotations:
path: /app/data # Path to store persistent data
value: "1"
name: data-volume
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: ${{ inputs.volume_size }}Gi
---
# Service - Exposes your application within the cluster
apiVersion: v1
kind: Service
metadata:
name: ${{ defaults.app_name }}
labels:
cloud.sealos.io/app-deploy-manager: ${{ defaults.app_name }}
spec:
ports:
- port: 80 # Service port (usually same as containerPort)
selector:
app: ${{ defaults.app_name }}
---
# Ingress - Exposes your application to the internet
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ${{ defaults.app_name }}
labels:
cloud.sealos.io/app-deploy-manager: ${{ defaults.app_name }}
cloud.sealos.io/app-deploy-manager-domain: ${{ defaults.app_host }}
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/proxy-body-size: 32m
nginx.ingress.kubernetes.io/server-snippet: |
client_header_buffer_size 64k;
large_client_header_buffers 4 128k;
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/backend-protocol: HTTP
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/client-body-buffer-size: 64k
nginx.ingress.kubernetes.io/proxy-buffer-size: 64k
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($request_uri ~* \.(js|css|gif|jpe?g|png)) {
expires 30d;
add_header Cache-Control "public";
}
spec:
rules:
- host: ${{ defaults.app_host }}.${{ SEALOS_CLOUD_DOMAIN }}
http:
paths:
- pathType: Prefix
path: /()(.*)
backend:
service:
name: ${{ defaults.app_name }}
port:
number: 80
tls:
- hosts:
- ${{ defaults.app_host }}.${{ SEALOS_CLOUD_DOMAIN }}
secretName: ${{ SEALOS_CERT_SECRET_NAME }}
---
# App - Application metadata for Sealos UI (must be the last resource)
apiVersion: app.sealos.io/v1
kind: App
metadata:
name: ${{ defaults.app_name }}
labels:
cloud.sealos.io/app-deploy-manager: ${{ defaults.app_name }}
spec:
data:
url: https://${{ defaults.app_host }}.${{ SEALOS_CLOUD_DOMAIN }}
displayType: normal
icon: "" # [REQUIRED] URL to your app's icon
name: "" # [REQUIRED] Application display name
type: link