Skip to content

Commit 1462b33

Browse files
committed
Create ready-to-install kustomizations
As described in #729, there is a desire to install kro with a plain kubectl apply (or kustomize) This commit is the first step to achieve this goal. It enables installing kro with and without prometheus metrics directly with kubectl. The simplest way to achieve the whole experience is to upload the generated manifests to the github release. Alternatively, there can be an automation to update the manifests as part of the release process. Manifests are generated with ``` kubectl kustomize ./manifests/core-install/ kubectl kustomize ./manifests/core-install-with-metrics ```
1 parent d3fd813 commit 1462b33

25 files changed

+205
-404
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: kro
5+
namespace: default
6+
spec:
7+
selector:
8+
matchLabels:
9+
app.kubernetes.io/instance: kro
10+
template:
11+
metadata:
12+
labels:
13+
app.kubernetes.io/version: "0.4.1"
14+
app.kubernetes.io/managed-by: kustomize
15+
app.kubernetes.io/instance: kro

config/default/kustomization.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,17 @@ patches:
3030
# Protect the /metrics endpoint by putting it behind auth.
3131
# If you want your controller-manager to expose the /metrics
3232
# endpoint w/o any authn/z, please comment the following line.
33-
- path: manager_auth_proxy_patch.yaml
33+
- path: deployment_image_patch.yaml
34+
35+
images:
36+
- name: ghcr.io/kro-run/kro/controller
37+
newName: ghcr.io/kro-run/kro/controller
38+
newTag: "0.4.1"
39+
40+
commonLabels:
41+
app.kubernetes.io/version: "0.4.1"
42+
app.kubernetes.io/managed-by: kustomize
43+
app.kubernetes.io/instance: kro
3444

3545
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
3646
# crd/kustomization.yaml

config/default/manager_auth_proxy_patch.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.

config/default/manager_config_patch.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: kro-metrics
5+
namespace: default
6+
spec:
7+
selector:
8+
app.kubernetes.io/instance: kro

config/manager/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
resources:
22
- manager.yaml
3+
- namespace.yaml

config/manager/manager.yaml

Lines changed: 91 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,105 @@
1-
apiVersion: v1
2-
kind: Namespace
3-
metadata:
4-
labels:
5-
control-plane: controller-manager
6-
app.kubernetes.io/name: namespace
7-
app.kubernetes.io/instance: system
8-
app.kubernetes.io/component: manager
9-
app.kubernetes.io/created-by: kro
10-
app.kubernetes.io/part-of: kro
11-
app.kubernetes.io/managed-by: kustomize
12-
name: system
13-
---
141
apiVersion: apps/v1
152
kind: Deployment
163
metadata:
17-
name: controller-manager
18-
namespace: system
4+
name: kro
5+
namespace: default
196
labels:
20-
control-plane: controller-manager
21-
app.kubernetes.io/name: deployment
22-
app.kubernetes.io/instance: controller-manager
23-
app.kubernetes.io/component: manager
24-
app.kubernetes.io/created-by: kro
7+
app.kubernetes.io/instance: kro
8+
app.kubernetes.io/component: controller
259
app.kubernetes.io/part-of: kro
26-
app.kubernetes.io/managed-by: kustomize
2710
spec:
11+
replicas: 1
2812
selector:
2913
matchLabels:
30-
control-plane: controller-manager
31-
replicas: 1
14+
app.kubernetes.io/name: kro
15+
app.kubernetes.io/component: controller
3216
template:
3317
metadata:
34-
annotations:
35-
kubectl.kubernetes.io/default-container: manager
3618
labels:
37-
control-plane: controller-manager
19+
app.kubernetes.io/name: kro
20+
app.kubernetes.io/component: controller
21+
app.kubernetes.io/part-of: kro
3822
spec:
39-
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
40-
# according to the platforms which are supported by your solution.
41-
# It is considered best practice to support multiple architectures. You can
42-
# build your manager image using the makefile target docker-buildx.
43-
# affinity:
44-
# nodeAffinity:
45-
# requiredDuringSchedulingIgnoredDuringExecution:
46-
# nodeSelectorTerms:
47-
# - matchExpressions:
48-
# - key: kubernetes.io/arch
49-
# operator: In
50-
# values:
51-
# - amd64
52-
# - arm64
53-
# - ppc64le
54-
# - s390x
55-
# - key: kubernetes.io/os
56-
# operator: In
57-
# values:
58-
# - linux
23+
serviceAccountName: kro
5924
securityContext:
60-
runAsNonRoot: true
61-
# TODO(user): For common cases that do not require escalating privileges
62-
# it is recommended to ensure that all your Pods/Containers are restrictive.
63-
# More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
64-
# Please uncomment the following code if your project does NOT have to work on old Kubernetes
65-
# versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ).
66-
# seccompProfile:
67-
# type: RuntimeDefault
25+
seccompProfile:
26+
type: RuntimeDefault
6827
containers:
69-
- command:
70-
- /manager
71-
args:
72-
- --leader-elect
73-
image: controller:latest
74-
name: manager
75-
securityContext:
76-
allowPrivilegeEscalation: false
77-
capabilities:
78-
drop:
79-
- "ALL"
80-
livenessProbe:
81-
httpGet:
82-
path: /healthz
83-
port: 8081
84-
initialDelaySeconds: 15
85-
periodSeconds: 20
86-
readinessProbe:
87-
httpGet:
88-
path: /readyz
89-
port: 8081
90-
initialDelaySeconds: 5
91-
periodSeconds: 10
92-
# TODO(user): Configure the resources accordingly based on the project requirements.
93-
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
94-
resources:
95-
limits:
96-
cpu: 500m
97-
memory: 128Mi
98-
requests:
99-
cpu: 10m
100-
memory: 64Mi
101-
serviceAccountName: controller-manager
102-
terminationGracePeriodSeconds: 10
28+
- name: kro
29+
securityContext:
30+
allowPrivilegeEscalation: false
31+
capabilities:
32+
drop:
33+
- ALL
34+
privileged: false
35+
runAsNonRoot: true
36+
runAsUser: 1000
37+
image: "ghcr.io/kro-run/kro/controller:latest"
38+
imagePullPolicy: IfNotPresent
39+
ports:
40+
- name: metricsport
41+
containerPort: 8078
42+
resources:
43+
limits:
44+
cpu: 1000m
45+
memory: 1024Mi
46+
requests:
47+
cpu: 256m
48+
memory: 128Mi
49+
env:
50+
- name: KRO_METRICS_BIND_ADDRESS
51+
value: ":8078"
52+
- name: KRO_HEALTH_PROBE_BIND_ADDRESS
53+
value: ":8079"
54+
- name: KRO_RESOURCE_GROUP_CONCURRENT_RECONCILES
55+
value: "1"
56+
- name: KRO_DYNAMIC_CONTROLLER_CONCURRENT_RECONCILES
57+
value: "1"
58+
- name: KRO_LOG_LEVEL
59+
value: "3"
60+
- name: KRO_DYNAMIC_CONTROLLER_DEFAULT_RESYNC_PERIOD
61+
value: "36000"
62+
- name: KRO_DYNAMIC_CONTROLLER_DEFAULT_QUEUE_MAX_RETRIES
63+
value: "20"
64+
- name: KRO_GRACEFUL_SHUTDOWN_TIMEOUT
65+
value: "60s"
66+
- name: KRO_CLIENT_QPS
67+
value: "100"
68+
- name: KRO_CLIENT_BURST
69+
value: "150"
70+
args:
71+
- --metrics-bind-address
72+
- "$(KRO_METRICS_BIND_ADDRESS)"
73+
- --health-probe-bind-address
74+
- "$(KRO_HEALTH_PROBE_BIND_ADDRESS)"
75+
- --resource-graph-definition-concurrent-reconciles
76+
- "$(KRO_RESOURCE_GROUP_CONCURRENT_RECONCILES)"
77+
- --dynamic-controller-concurrent-reconciles
78+
- "$(KRO_DYNAMIC_CONTROLLER_CONCURRENT_RECONCILES)"
79+
- --log-level
80+
- "$(KRO_LOG_LEVEL)"
81+
- --graceful-shutdown-timeout
82+
- "$(KRO_GRACEFUL_SHUTDOWN_TIMEOUT)"
83+
- --dynamic-controller-default-resync-period
84+
- "$(KRO_DYNAMIC_CONTROLLER_DEFAULT_RESYNC_PERIOD)"
85+
- --dynamic-controller-default-queue-max-retries
86+
- "$(KRO_DYNAMIC_CONTROLLER_DEFAULT_QUEUE_MAX_RETRIES)"
87+
- --client-qps
88+
- "$(KRO_CLIENT_QPS)"
89+
- --client-burst
90+
- "$(KRO_CLIENT_BURST)"
91+
- --leader-elect
92+
livenessProbe:
93+
httpGet:
94+
path: /healthz
95+
port: 8079
96+
initialDelaySeconds: 15
97+
periodSeconds: 10
98+
readinessProbe:
99+
httpGet:
100+
path: /readyz
101+
port: 8079
102+
initialDelaySeconds: 10
103+
periodSeconds: 10
104+
nodeSelector:
105+
kubernetes.io/os: linux

config/manager/namespace.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: kro
6+
app.kubernetes.io/part-of: kro
7+
name: kro
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
resources:
22
- monitor.yaml
3+
- service.yaml

config/prometheus/monitor.yaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
# Prometheus Monitor Service (Metrics)
21
apiVersion: monitoring.coreos.com/v1
32
kind: ServiceMonitor
43
metadata:
4+
name: kro
5+
namespace: default
56
labels:
6-
control-plane: controller-manager
7-
app.kubernetes.io/name: servicemonitor
8-
app.kubernetes.io/instance: controller-manager-metrics-monitor
7+
app.kubernetes.io/instance: kro
98
app.kubernetes.io/component: metrics
10-
app.kubernetes.io/created-by: kro
119
app.kubernetes.io/part-of: kro
12-
app.kubernetes.io/managed-by: kustomize
13-
name: controller-manager-metrics-monitor
14-
namespace: system
1510
spec:
16-
endpoints:
17-
- path: /metrics
18-
port: https
19-
scheme: https
20-
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
21-
tlsConfig:
22-
insecureSkipVerify: true
11+
jobLabel: kro
12+
namespaceSelector:
13+
matchNames:
14+
- default
2315
selector:
2416
matchLabels:
25-
control-plane: controller-manager
17+
app.kubernetes.io/name: kro
18+
app.kubernetes.io/instance: kro
19+
endpoints:
20+
- port: metrics
21+
path: /metrics
22+
interval: 1m
23+
scrapeTimeout: 10s

0 commit comments

Comments
 (0)