Skip to content

Commit 05a4925

Browse files
author
Leonid Podolinskiy
authored
Devops 1871 deprecate kube proxy (#25)
* fix eks/gke semver restriction by `kubeVersion` * add pprof optional endpoint * deprecate kube-proxy due to [PR](kubernetes-sigs/kubebuilder#3899) * fix e2e pipeline
1 parent 6ba0921 commit 05a4925

File tree

10 files changed

+71
-195
lines changed

10 files changed

+71
-195
lines changed

.github/workflows/e2e.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,13 @@ jobs:
148148
149149
150150
151-
printf "\n\nAgent INFO log\n"
152-
kubectl exec -t deploy/sample-deployment -c app -- cat /tmp/lightrun_java_agent.INFO
153-
printf "\n\nAgent ERROR log\n"
154-
kubectl exec -t deploy/sample-deployment -c app -- cat /tmp/lightrun_java_agent.ERROR || true
151+
printf "\n\nAgent log\n"
155152
153+
log_file_name=/tmp/$(kubectl exec -t deploy/sample-deployment - c app -- ls -t /tmp/ | grep lightrun_java_agent | head -n 1)
154+
kubectl exec -t deploy/sample-deployment -c app -- cat $log_file_name
156155
157-
printf "\nSearching for "registered" in INFO log\n"
158-
if kubectl exec -t deploy/sample-deployment -c app -- cat /tmp/lightrun_java_agent.INFO | grep Debuggee |grep registered > /dev/null; then
156+
printf "\nSearching for "registered" in log\n"
157+
if kubectl exec -t deploy/sample-deployment -c app -- cat $log_file_name | grep Debuggee |grep registered > /dev/null; then
159158
printf "\n----------------\nAgent registered succesfully!\n----------------\n"
160159
else
161160
printf "\n----------------\nAgent failed to register!\n----------------\n"

cmd/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ func getWatchNamespaces() ([]string, error) {
7272

7373
func main() {
7474
var metricsAddr string
75-
var enableLeaderElection bool
7675
var probeAddr string
76+
var pprofAddr string
77+
var enableLeaderElection bool
7778
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
7879
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
80+
flag.StringVar(&pprofAddr, "pprof-bind-address", "0", "The address the pprof endpoint binds to.")
7981
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
8082
"Enable leader election for controller manager. "+
8183
"Enabling this will ensure there is only one active controller manager.")
@@ -98,6 +100,7 @@ func main() {
98100
HealthProbeBindAddress: probeAddr,
99101
LeaderElection: enableLeaderElection,
100102
LeaderElectionID: "5b425f09.lightrun.com",
103+
PprofBindAddress: pprofAddr,
101104

102105
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
103106
// when the Manager ends. This requires the binary to immediately end when the

config/default/kustomization.yaml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ namePrefix: lightrun-k8s-operator-
1515
# someName: someValue
1616

1717
resources:
18-
- ../crd
19-
- ../rbac
20-
- ../manager
18+
- ../crd
19+
- ../rbac
20+
- ../manager
2121
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2222
# crd/kustomization.yaml
2323
#- ../webhook
@@ -26,10 +26,3 @@ resources:
2626
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2727
#- ../prometheus
2828

29-
# Protect the /metrics endpoint by putting it behind auth.
30-
# If you want your controller-manager to expose the /metrics
31-
# endpoint w/o any authn/z, please comment the following line.
32-
apiVersion: kustomize.config.k8s.io/v1beta1
33-
kind: Kustomization
34-
patches:
35-
- path: manager_auth_proxy_patch.yaml

config/default/manager_auth_proxy_patch.yaml

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

config/manager/manager.yaml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -64,40 +64,39 @@ spec:
6464
seccompProfile:
6565
type: RuntimeDefault
6666
containers:
67-
- command:
68-
- /manager
69-
env:
70-
- name: WATCH_NAMESPACE
71-
value: ""
72-
args:
73-
- --leader-elect
74-
image: controller:latest
75-
name: manager
76-
securityContext:
77-
allowPrivilegeEscalation: false
78-
capabilities:
79-
drop:
80-
- "ALL"
81-
livenessProbe:
82-
httpGet:
83-
path: /healthz
84-
port: 8081
85-
initialDelaySeconds: 15
86-
periodSeconds: 20
87-
readinessProbe:
88-
httpGet:
89-
path: /readyz
90-
port: 8081
91-
initialDelaySeconds: 5
92-
periodSeconds: 10
93-
# TODO(user): Configure the resources accordingly based on the project requirements.
94-
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
95-
resources:
96-
limits:
97-
cpu: 500m
98-
memory: 128Mi
99-
requests:
100-
cpu: 10m
101-
memory: 64Mi
67+
- command:
68+
- /manager
69+
env:
70+
- name: WATCH_NAMESPACE
71+
value: ""
72+
args:
73+
- --leader-elect
74+
- --zap-log-level=0
75+
image: controller:latest
76+
name: manager
77+
securityContext:
78+
allowPrivilegeEscalation: false
79+
capabilities:
80+
drop:
81+
- "ALL"
82+
livenessProbe:
83+
httpGet:
84+
path: /healthz
85+
port: 8081
86+
initialDelaySeconds: 15
87+
periodSeconds: 20
88+
readinessProbe:
89+
httpGet:
90+
path: /readyz
91+
port: 8081
92+
initialDelaySeconds: 5
93+
periodSeconds: 10
94+
resources:
95+
limits:
96+
cpu: 500m
97+
memory: 512Mi
98+
requests:
99+
cpu: 50m
100+
memory: 128Mi
102101
serviceAccountName: controller-manager
103102
terminationGracePeriodSeconds: 10

config/samples/operator.yaml

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -481,31 +481,6 @@ spec:
481481
spec:
482482
containers:
483483
- args:
484-
- --secure-listen-address=0.0.0.0:8443
485-
- --upstream=http://127.0.0.1:8080/
486-
- --logtostderr=true
487-
- --v=0
488-
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
489-
name: kube-rbac-proxy
490-
ports:
491-
- containerPort: 8443
492-
name: https
493-
protocol: TCP
494-
resources:
495-
limits:
496-
cpu: 500m
497-
memory: 128Mi
498-
requests:
499-
cpu: 5m
500-
memory: 64Mi
501-
securityContext:
502-
allowPrivilegeEscalation: false
503-
capabilities:
504-
drop:
505-
- ALL
506-
- args:
507-
- --health-probe-bind-address=:8081
508-
- --metrics-bind-address=127.0.0.1:8080
509484
- --leader-elect
510485
- --zap-log-level=0
511486
command:
@@ -530,10 +505,10 @@ spec:
530505
resources:
531506
limits:
532507
cpu: 500m
533-
memory: 128Mi
508+
memory: 512Mi
534509
requests:
535-
cpu: 10m
536-
memory: 64Mi
510+
cpu: 50m
511+
memory: 128Mi
537512
securityContext:
538513
allowPrivilegeEscalation: false
539514
capabilities:

examples/operator.yaml

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -480,32 +480,9 @@ spec:
480480
kubectl.kubernetes.io/default-container: manager
481481
spec:
482482
containers:
483-
- args:
484-
- --secure-listen-address=0.0.0.0:8443
485-
- --upstream=http://127.0.0.1:8080/
486-
- --logtostderr=true
487-
- --v=0
488-
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0
489-
name: kube-rbac-proxy
490-
ports:
491-
- containerPort: 8443
492-
name: https
493-
protocol: TCP
494-
resources:
495-
limits:
496-
cpu: 500m
497-
memory: 128Mi
498-
requests:
499-
cpu: 5m
500-
memory: 64Mi
501-
securityContext:
502-
allowPrivilegeEscalation: false
503-
capabilities:
504-
drop:
505-
- "ALL"
506483
- args:
507484
- --health-probe-bind-address=:8081
508-
- --metrics-bind-address=127.0.0.1:8080
485+
- --metrics-bind-address=:8080
509486
- --leader-elect
510487
- --zap-log-level=info
511488
command:

helm-chart/Chart.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ type: application
1313
icon: https://lightrun-public.s3.amazonaws.com/img/lightrun-logo.png
1414

1515
## Kubeversion due to "seccompProfile" in the controller deployment
16-
kubeVersion: ">= 1.19.0"
16+
## -0 is used to allow any patch version
17+
## it is resolving GKE and EKS versioning
18+
## Example of EKS version: v1.28.9-eks-036c24b
19+
kubeVersion: ">= 1.19.0-0"
1720

1821
# This is the chart version. This version number should be incremented each time you make changes
1922
# to the chart and its templates, including the app version.
2023
# Versions are expected to follow Semantic Versioning (https://semver.org/)
2124
version: 0.1.0 # Will be updated by CI pipeline
2225

23-
24-
2526
# ArtifactHub.io annotations
2627
annotations:
2728
artifacthub.io/crds: |
@@ -43,16 +44,14 @@ annotations:
4344
serverHostname: app.lightrun.com
4445
agentEnvVarName: JAVA_TOOL_OPTIONS
4546
initContainer:
46-
image: "lightruncom/k8s-operator-init-java-agent-linux:1.8.5-init.1"
47+
image: "lightruncom/k8s-operator-init-java-agent-linux:latest"
4748
sharedVolumeName: lightrun-agent-init
4849
sharedVolumeMountPath: "/lightrun"
4950
agentTags:
5051
- operator
5152
- example
5253
- 1.8.3
5354
54-
55-
5655
artifacthub.io/license: Apache-2.0
5756
artifacthub.io/links: |
5857
- name: Operator repo
@@ -63,8 +62,7 @@ annotations:
6362
- name: Lightrun devops team
6463
6564
- name: LeonidP
66-
65+
6766
artifacthub.io/operator: "true"
6867
artifacthub.io/operatorCapabilities: Basic Install
6968
artifacthub.io/prerelease: "false"
70-

helm-chart/templates/deployment.yaml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,13 @@ spec:
2828
spec:
2929
containers:
3030
- args:
31-
- --secure-listen-address=0.0.0.0:8443
32-
- --upstream=http://127.0.0.1:8080/
33-
- --logtostderr=true
34-
- --v=0
35-
image: {{ .Values.controllerManager.kubeRbacProxy.image.repository }}:{{ .Values.controllerManager.kubeRbacProxy.image.tag }}
36-
name: kube-rbac-proxy
37-
ports:
38-
- containerPort: 8443
39-
name: https
40-
protocol: TCP
41-
resources: {{- toYaml .Values.controllerManager.kubeRbacProxy.resources | nindent 10 }}
42-
securityContext:
43-
allowPrivilegeEscalation: false
44-
capabilities:
45-
drop:
46-
- "ALL"
47-
- args:
48-
- --health-probe-bind-address=:8081
49-
- --metrics-bind-address=127.0.0.1:8080
31+
- --health-probe-bind-address={{ .Values.managerConfig.healthProbe.bindAddress }}
32+
- --metrics-bind-address={{ .Values.managerConfig.metrics.bindAddress }}
5033
- --leader-elect
5134
- --zap-log-level={{ .Values.managerConfig.logLevel }}
35+
{{- if .Values.managerConfig.profiler.bindAddress }}
36+
- --pprof-bind-address={{ .Values.managerConfig.profiler.bindAddress }}
37+
{{- end }}
5238
command:
5339
- /manager
5440
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag | default .Chart.AppVersion }}

helm-chart/values.yaml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,6 @@
22
controllerManager:
33
replicas: 1
44

5-
## Kube proxy config
6-
## In most cases you don't need to change those
7-
kubeRbacProxy:
8-
image:
9-
repository: gcr.io/kubebuilder/kube-rbac-proxy
10-
tag: v0.15.0
11-
resources:
12-
limits:
13-
cpu: 500m
14-
memory: 128Mi
15-
requests:
16-
cpu: 5m
17-
memory: 64Mi
18-
195
## Controller image
206
manager:
217
image:
@@ -60,16 +46,16 @@ managerConfig:
6046
logLevel: info
6147

6248
## Default values of the container inside pod. In most cases you don't need to change those
63-
controllerManagerConfigYaml:
64-
health:
65-
healthProbeBindAddress: :8081
66-
leaderElection:
67-
leaderElect: true
68-
resourceName: 5b425f09.lightrun.com
69-
metrics:
70-
bindAddress: 127.0.0.1:8080
71-
webhook:
72-
port: 9443
49+
healthProbe:
50+
bindAddress: ":8081"
51+
metrics:
52+
bindAddress: ":8080"
53+
# -- Profiler is used for debugging and performance analysis
54+
# It is disabled by default
55+
# To enable it, specify the bindAddress, similar to the metrics or the health probes
56+
# Make sure to protect this endpoint as it is containing sensitive information
57+
profiler:
58+
bindAddress: ""
7359
# -- Operator may work in 2 scopes: cluster and namespaced
7460
# Cluster scope will give permissions to operator to watch and patch deployment in the whole cluster
7561
# With namespaced scope you need to provide list of namespaces that operator will be able to watch.

0 commit comments

Comments
 (0)