Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update drift-detection-manager post rbac proxy removal #472

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ARCH ?= amd64
OS ?= $(shell uname -s | tr A-Z a-z)
K8S_LATEST_VER ?= $(shell curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
export CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
TAG ?= v0.24.0
TAG ?= dev

.PHONY: all
all: build
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ spec:
- "--report-mode=0"
- --shard-key=
- "--v=5"
- "--version=v0.24.0"
- "--version=dev"
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: projectsveltos/addon-controller-amd64:v0.24.0
- image: projectsveltos/addon-controller-amd64:dev
name: controller
4 changes: 2 additions & 2 deletions manifest/deployment-shard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ spec:
- --report-mode=0
- --shard-key={{.SHARD}}
- --v=5
- --version=v0.24.0
- --version=dev
command:
- /manager
image: projectsveltos/addon-controller-amd64:v0.24.0
image: projectsveltos/addon-controller-amd64:dev
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
4 changes: 2 additions & 2 deletions manifest/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3350,10 +3350,10 @@ spec:
- --report-mode=0
- --shard-key=
- --v=5
- --version=v0.24.0
- --version=dev
command:
- /manager
image: projectsveltos/addon-controller-amd64:v0.24.0
image: projectsveltos/addon-controller-amd64:dev
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
43 changes: 2 additions & 41 deletions pkg/drift-detection/drift-detection-manager-in-mgmt-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,7 @@ limitations under the License.
*/
package driftdetection

var driftDetectionInMgmtClusterYAML = []byte(`apiVersion: v1
kind: Service
metadata:
labels:
control-plane: $NAME
name: $NAME-metrics-service
namespace: projectsveltos
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: $NAME
---
apiVersion: apps/v1
var driftDetectionInMgmtClusterYAML = []byte(`apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -63,7 +47,7 @@ spec:
- --run-mode=do-not-send-updates
command:
- /manager
image: projectsveltos/drift-detection-manager-amd64:v0.24.0
image: projectsveltos/drift-detection-manager-amd64:dev
livenessProbe:
httpGet:
path: /healthz
Expand All @@ -89,29 +73,6 @@ spec:
capabilities:
drop:
- ALL
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=0
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.12.0
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
securityContext:
runAsNonRoot: true
serviceAccountName: drift-detection-manager
Expand Down
41 changes: 1 addition & 40 deletions pkg/drift-detection/drift-detection-manager-in-mgmt-cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: $NAME
name: $NAME-metrics-service
namespace: projectsveltos
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: $NAME
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -45,7 +29,7 @@ spec:
- --run-mode=do-not-send-updates
command:
- /manager
image: projectsveltos/drift-detection-manager-amd64:v0.24.0
image: projectsveltos/drift-detection-manager-amd64:dev
livenessProbe:
httpGet:
path: /healthz
Expand All @@ -71,29 +55,6 @@ spec:
capabilities:
drop:
- ALL
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=0
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.12.0
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
securityContext:
runAsNonRoot: true
serviceAccountName: drift-detection-manager
Expand Down
112 changes: 27 additions & 85 deletions pkg/drift-detection/drift-detection-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ rules:
- get
- list
- watch
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
- apiGroups:
- lib.projectsveltos.io
resources:
Expand Down Expand Up @@ -76,34 +88,6 @@ rules:
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: drift-detection-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: drift-detection-proxy-role
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: drift-detection-manager-rolebinding
Expand All @@ -116,35 +100,6 @@ subjects:
name: drift-detection-manager
namespace: projectsveltos
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: drift-detection-proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: drift-detection-proxy-role
subjects:
- kind: ServiceAccount
name: drift-detection-manager
namespace: projectsveltos
---
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: drift-detection-manager
name: drift-detection-manager-metrics-service
namespace: projectsveltos
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: drift-detection-manager
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -166,8 +121,7 @@ spec:
spec:
containers:
- args:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --diagnostics-address=:8443
- --v=5
- --cluster-namespace=
- --cluster-name=
Expand All @@ -176,18 +130,29 @@ spec:
- --run-mode=do-not-send-updates
command:
- /manager
image: projectsveltos/drift-detection-manager-amd64:v0.24.0
image: projectsveltos/drift-detection-manager-amd64:dev
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 8081
port: healthz
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 20
name: manager
ports:
- containerPort: 8443
name: metrics
protocol: TCP
- containerPort: 9440
name: healthz
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /readyz
port: 8081
port: healthz
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
resources:
Expand All @@ -202,29 +167,6 @@ spec:
capabilities:
drop:
- ALL
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=0
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.12.0
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
securityContext:
runAsNonRoot: true
serviceAccountName: drift-detection-manager
Expand Down
Loading