Skip to content

Commit 8adeedd

Browse files
add redlib
1 parent f4312da commit 8adeedd

File tree

8 files changed

+201
-0
lines changed

8 files changed

+201
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
apiVersion: "kustomize.config.k8s.io/v1alpha1"
3+
kind: "Component"
4+
patches:
5+
- target:
6+
kind: "Deployment"
7+
name: "redlib"
8+
patch: |-
9+
- op: "replace"
10+
path: "/spec/replicas"
11+
value: 3
12+
- op: "/spec/topologySpreadConstraints"
13+
value:
14+
- maxSkew: 1
15+
topologyKey: "region"
16+
whenUnsatisfiable: "DoNotSchedule"
17+
labelSelector:
18+
matchLabels:
19+
app.kubernetes.io/name: "redlib"
20+
- maxSkew: 1
21+
topologyKey: "node"
22+
whenUnsatisfiable: "DoNotSchedule"
23+
labelSelector:
24+
matchLabels:
25+
app.kubernetes.io/name: "redlib"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1alpha1
3+
kind: Component
4+
patches:
5+
- target:
6+
kind: "Namespace"
7+
patch: |-
8+
- op: "add"
9+
path: "/metadata/labels/istio-injection"
10+
value: "enabled"
11+
- target:
12+
kind: "NetworkPolicy"
13+
patch: |-
14+
- op: add
15+
path: "/spec/egress/-"
16+
value:
17+
to:
18+
- namespaceSelector:
19+
matchLabels:
20+
kubernetes.io/metadata.name: "kube-system"
21+
podSelector:
22+
matchLabels:
23+
k8s-app: "kube-dns"
24+
ports:
25+
- port: 53
26+
protocol: "UDP"
27+
- port: 53
28+
protocol: "TCP"
29+
- op: add
30+
path: "/spec/egress/-"
31+
value:
32+
to:
33+
- namespaceSelector:
34+
matchLabels:
35+
kubernetes.io/metadata.name: "istio-system"
36+
podSelector: {}
37+
ports:
38+
- port: 15012
39+
protocol: "TCP"
40+
- port: 15014
41+
protocol: "TCP"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
apiVersion: "networking.istio.io/v1alpha3"
3+
kind: "VirtualService"
4+
metadata:
5+
name: "redlib"
6+
spec:
7+
hosts:
8+
- "redlib"
9+
gateways:
10+
- "istio-system/gateway"
11+
http:
12+
- match:
13+
- uri:
14+
prefix: "/"
15+
route:
16+
- destination:
17+
host: "redlib"
18+
port:
19+
number: 80
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
apiVersion: "kustomize.config.k8s.io/v1alpha1"
3+
kind: "Component"
4+
resources:
5+
- "istio-virtualservice.yaml"
6+
patches:
7+
- target:
8+
kind: "NetworkPolicy"
9+
name: "whoogle"
10+
patch: |-
11+
- op: "add"
12+
path: "/spec/ingress/0/from/-"
13+
value:
14+
namespaceSelector:
15+
matchLabels:
16+
kubernetes.io/metadata.name: "istio-system"
17+
podSelector:
18+
matchLabels:
19+
istio: "ingressgateway"

apps/redlib/deployment.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
apiVersion: "apps/v1"
3+
kind: "Deployment"
4+
metadata:
5+
name: "redlib"
6+
labels:
7+
app.kubernetes.io/name: "redlib"
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app.kubernetes.io/name: "redlib"
13+
strategy:
14+
type: "RollingUpdate"
15+
template:
16+
metadata:
17+
labels:
18+
app: "redlib"
19+
app.kubernetes.io/name: "redlib"
20+
app.kubernetes.io/component: "redlib"
21+
app.kubernetes.io/part-of: "redlib"
22+
spec:
23+
securityContext:
24+
runAsUser: 61234
25+
runAsGroup: 61234
26+
runAsNonRoot: true
27+
seccompProfile:
28+
type: "RuntimeDefault"
29+
containers:
30+
- name: "redlib"
31+
image: "quay.io/redlib/redlib:latest@sha256:c1fcda90dca9447d4aa7e18fd3ef85cc2044c29263490159e1ae4b472d0f285c"
32+
imagePullPolicy: "IfNotPresent"
33+
securityContext:
34+
runAsUser: 61234
35+
runAsGroup: 61234
36+
allowPrivilegeEscalation: false
37+
readOnlyRootFilesystem: true
38+
privileged: false
39+
seccompProfile:
40+
type: "RuntimeDefault"
41+
capabilities:
42+
drop:
43+
- "ALL"
44+
resources:
45+
requests:
46+
memory: "32Mi"
47+
cpu: "10m"
48+
limits:
49+
memory: "128Mi"
50+
readinessProbe:
51+
tcpSocket:
52+
port: 8080
53+
initialDelaySeconds: 1
54+
livenessProbe:
55+
tcpSocket:
56+
port: 8080
57+
initialDelaySeconds: 3
58+
ports:
59+
- containerPort: 8080
60+
name: "redlib"
61+
topologySpreadConstraints:
62+
- maxSkew: 1
63+
topologyKey: "location"
64+
whenUnsatisfiable: "ScheduleAnyway"

apps/redlib/kustomization.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
apiVersion: "kustomize.config.k8s.io/v1beta1"
3+
kind: "Kustomization"
4+
resources:
5+
- "deployment.yaml"
6+
- "service.yaml"
7+
- "networkpolicy.yaml"

apps/redlib/networkpolicy.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
apiVersion: "networking.k8s.io/v1"
3+
kind: "NetworkPolicy"
4+
metadata:
5+
name: "redlib"
6+
spec:
7+
podSelector: {}
8+
policyTypes:
9+
- "Ingress"
10+
ingress:
11+
- ports:
12+
- protocol: "TCP"
13+
port: "redlib"
14+
from: []
15+
egress: []

apps/redlib/service.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: "v1"
3+
kind: "Service"
4+
metadata:
5+
name: "redlib"
6+
spec:
7+
ports:
8+
- port: 80
9+
targetPort: "redlib"
10+
selector:
11+
app.kubernetes.io/name: "redlib"

0 commit comments

Comments
 (0)