Skip to content

Commit 86dca9e

Browse files
yuwenmachunglu-chou
authored andcommitted
Add a basic ghost package (kptdev#3381)
* Add ghost basic package * update ghost pacakge * remove set-labels
1 parent afe8027 commit 86dca9e

19 files changed

+483
-0
lines changed

package-examples/ghost/Kptfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: kpt.dev/v1
2+
kind: Kptfile
3+
metadata:
4+
name: ghost
5+
annotations:
6+
config.kubernetes.io/local-config: "true"
7+
info:
8+
description: sample description
9+
pipeline:
10+
mutators:
11+
- image: gcr.io/kpt-fn/set-namespace:v0.3.4
12+
configPath: package-context.yaml

package-examples/ghost/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
### Ghost Application
2+
3+
"Ghost is a powerful app for new-media creators to publish, share, and grow a business around their content. It comes with modern tools to build a website, publish content, send newsletters & offer paid subscriptions to members."
4+
https://ghost.org/
5+
6+
### Quick start
7+
8+
#### Get KPT Pacakge
9+
```bash
10+
export NAMESPACE=<YOUR NAMESPACE>
11+
# make sure the namespace is correct and exists. Otherwise, create the namespace
12+
kubectl create namespace ${NAMESPACE}
13+
14+
# You get this Ghost package by running
15+
kpt pkg get https://github.com/GoogleContainerTools/kpt.git/package-examples/ghost@main ${NAMESPACE} --for-deployment
16+
```
17+
18+
#### Update the KRM resources to your own data
19+
20+
Updating the KRM resources are easy with variant constructor
21+
```bash
22+
kpt fn render ${NAMESPACE}
23+
```
24+
25+
#### Deploy the KRM resources to your cluster
26+
27+
```bash
28+
# Initialize inventory info. You only need to run this if do not have resourcesgroup.yaml
29+
kpt live init ${NAMESPACE}
30+
31+
kpt live apply ${NAMESPACE}
32+
```
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.8.0
6+
creationTimestamp: null
7+
name: prometheusrules.monitoring.coreos.com
8+
spec:
9+
group: monitoring.coreos.com
10+
names:
11+
categories:
12+
- prometheus-operator
13+
kind: PrometheusRule
14+
listKind: PrometheusRuleList
15+
plural: prometheusrules
16+
shortNames:
17+
- promrule
18+
singular: prometheusrule
19+
scope: Namespaced
20+
versions:
21+
- name: v1
22+
schema:
23+
openAPIV3Schema:
24+
description: PrometheusRule defines recording and alerting rules for a Prometheus
25+
instance
26+
properties:
27+
apiVersion:
28+
description: 'APIVersion defines the versioned schema of this representation
29+
of an object. Servers should convert recognized schemas to the latest
30+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
31+
type: string
32+
kind:
33+
description: 'Kind is a string value representing the REST resource this
34+
object represents. Servers may infer this from the endpoint the client
35+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
36+
type: string
37+
metadata:
38+
type: object
39+
spec:
40+
description: Specification of desired alerting rule definitions for Prometheus.
41+
properties:
42+
groups:
43+
description: Content of Prometheus rule file
44+
items:
45+
description: 'RuleGroup is a list of sequentially evaluated recording
46+
and alerting rules. Note: PartialResponseStrategy is only used
47+
by ThanosRuler and will be ignored by Prometheus instances. Valid
48+
values for this field are ''warn'' or ''abort''. More info: https://github.com/thanos-io/thanos/blob/main/docs/components/rule.md#partial-response'
49+
properties:
50+
interval:
51+
type: string
52+
name:
53+
type: string
54+
partial_response_strategy:
55+
type: string
56+
rules:
57+
items:
58+
description: 'Rule describes an alerting or recording rule
59+
See Prometheus documentation: [alerting](https://www.prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)
60+
or [recording](https://www.prometheus.io/docs/prometheus/latest/configuration/recording_rules/#recording-rules)
61+
rule'
62+
properties:
63+
alert:
64+
type: string
65+
annotations:
66+
additionalProperties:
67+
type: string
68+
type: object
69+
expr:
70+
anyOf:
71+
- type: integer
72+
- type: string
73+
x-kubernetes-int-or-string: true
74+
for:
75+
type: string
76+
labels:
77+
additionalProperties:
78+
type: string
79+
type: object
80+
record:
81+
type: string
82+
required:
83+
- expr
84+
type: object
85+
type: array
86+
required:
87+
- name
88+
- rules
89+
type: object
90+
type: array
91+
type: object
92+
required:
93+
- spec
94+
type: object
95+
served: true
96+
storage: true
97+
status:
98+
acceptedNames:
99+
kind: ""
100+
plural: ""
101+
conditions: []
102+
storedVersions: []
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kpt.dev/v1
2+
kind: Kptfile
3+
metadata:
4+
name: ghost-app
5+
annotations:
6+
config.kubernetes.io/local-config: "true"
7+
info:
8+
description: The Ghost App package contains the KRM resources for a Ghost Application.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: ghost-app
5+
namespace: example
6+
spec:
7+
replicas: 1
8+
strategy:
9+
type: RollingUpdate
10+
template:
11+
spec:
12+
affinity:
13+
podAffinity:
14+
podAntiAffinity:
15+
preferredDuringSchedulingIgnoredDuringExecution:
16+
- podAffinityTerm:
17+
namespaces:
18+
- "example"
19+
topologyKey: kubernetes.io/hostname
20+
weight: 1
21+
nodeAffinity:
22+
securityContext:
23+
fsGroup: 1001
24+
containers:
25+
- name: ghost-app
26+
image: docker.io/bitnami/ghost:4.45.0-debian-10-r0
27+
imagePullPolicy: "IfNotPresent"
28+
securityContext:
29+
runAsNonRoot: true
30+
runAsUser: 1001
31+
env:
32+
- name: BITNAMI_DEBUG
33+
value: "false"
34+
- name: ALLOW_EMPTY_PASSWORD
35+
value: "yes"
36+
- name: GHOST_DATABASE_HOST
37+
value: "example-mariadb"
38+
- name: GHOST_DATABASE_PORT_NUMBER
39+
value: "3306"
40+
- name: GHOST_DATABASE_NAME
41+
value: "bitnami_ghost"
42+
- name: GHOST_DATABASE_USER
43+
value: "bn_ghost"
44+
- name: GHOST_HOST
45+
value: "aa/"
46+
- name: GHOST_PORT_NUMBER
47+
value: "2368"
48+
- name: GHOST_USERNAME
49+
value: "user"
50+
- name: GHOST_EMAIL
51+
value: "user@example.com"
52+
- name: GHOST_BLOG_TITLE
53+
value: "User's Blog"
54+
- name: GHOST_ENABLE_HTTPS
55+
value: "no"
56+
- name: GHOST_EXTERNAL_HTTP_PORT_NUMBER
57+
value: "80"
58+
- name: GHOST_EXTERNAL_HTTPS_PORT_NUMBER
59+
value: "443"
60+
- name: GHOST_SKIP_BOOTSTRAP
61+
value: "no"
62+
ports:
63+
- name: http
64+
containerPort: 2368
65+
protocol: TCP
66+
livenessProbe:
67+
httpGet:
68+
path: /
69+
port: "http"
70+
scheme: HTTP
71+
initialDelaySeconds: 120
72+
periodSeconds: 10
73+
timeoutSeconds: 5
74+
failureThreshold: 6
75+
successThreshold: 1
76+
readinessProbe:
77+
httpGet:
78+
path: /
79+
port: "http"
80+
scheme: HTTP
81+
initialDelaySeconds: 30
82+
periodSeconds: 5
83+
timeoutSeconds: 3
84+
failureThreshold: 6
85+
successThreshold: 1
86+
resources:
87+
limits: {}
88+
requests: {}
89+
volumeMounts:
90+
- name: ghost-data
91+
mountPath: /bitnami/ghost
92+
volumes:
93+
- name: ghost-data
94+
persistentVolumeClaim:
95+
claimName: ghost-app
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: ghost-app
5+
namespace: example
6+
spec:
7+
rules:
8+
- host: ghost.local
9+
http:
10+
paths:
11+
- path: /
12+
pathType: ImplementationSpecific
13+
backend:
14+
service:
15+
name: ghost-app
16+
port:
17+
name: http
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
name: ghost-app
5+
spec:
6+
ingress:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: kptfile.kpt.dev
5+
annotations:
6+
config.kubernetes.io/local-config: "true"
7+
data:
8+
name: example
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Source: ghost/templates/pvc.yaml
2+
kind: PersistentVolumeClaim
3+
apiVersion: v1
4+
metadata:
5+
name: ghost-app
6+
namespace: example
7+
spec:
8+
accessModes:
9+
- "ReadWriteOnce"
10+
resources:
11+
requests:
12+
storage: "8Gi"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: ghost-app
5+
namespace: example
6+
spec:
7+
type: LoadBalancer
8+
externalTrafficPolicy: Cluster
9+
sessionAffinity: None
10+
ports:
11+
- name: http
12+
port: 80
13+
protocol: TCP
14+
targetPort: http

0 commit comments

Comments
 (0)