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

chore: RBAC cleanup #2207

Merged
merged 31 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
727d747
remove kb marker
lindnerby Jan 24, 2025
f74d9f5
Merge branch 'main' into remove-excess-permissions
lindnerby Feb 12, 2025
4a2ebd3
clean-up rbac
lindnerby Feb 13, 2025
8a34f18
remove remaining kubebuilder marker for rbac creation
lindnerby Feb 13, 2025
d3b0712
rename
lindnerby Feb 13, 2025
b18ed22
delete unused patch
lindnerby Feb 13, 2025
52adae4
rename
lindnerby Feb 13, 2025
344eddb
Merge branch 'main' into remove-excess-permissions
lindnerby Feb 13, 2025
b02e32c
revert change in main
lindnerby Feb 13, 2025
f54037e
cleanup
lindnerby Feb 13, 2025
8a1c861
rename
lindnerby Feb 13, 2025
39603c2
fix list
lindnerby Feb 13, 2025
acc120a
bump watcher
lindnerby Feb 13, 2025
3f47cdc
Merge branch 'main' into remove-excess-permissions
lindnerby Feb 24, 2025
0e40dc7
set role to istio-system. remove crd from manager role since its in c…
lindnerby Feb 25, 2025
bdae20b
format
lindnerby Feb 25, 2025
16284c6
rename certmanager role and binding
lindnerby Feb 25, 2025
71e96c7
Merge branch 'main' into remove-excess-permissions
lindnerby Feb 25, 2025
ec15b63
remove commited watcher local manifest
lindnerby Feb 25, 2025
bb99f2a
fix kustomize
lindnerby Feb 25, 2025
3b000d1
adapt e2e
lindnerby Feb 25, 2025
c4c4735
adapt e2e
lindnerby Feb 25, 2025
2998cee
adapt e2e
lindnerby Feb 25, 2025
819c6b9
adapt e2e
lindnerby Feb 25, 2025
b7f3731
bump docker version to rid of warning
lindnerby Feb 25, 2025
2a5e526
remove moduletemplate create & delete verbs
lindnerby Feb 25, 2025
91ace3b
adapt e2e
lindnerby Feb 25, 2025
018afaf
Merge branch 'main' into remove-excess-permissions
lindnerby Feb 27, 2025
7f915c7
apply renamings
lindnerby Feb 27, 2025
3fef4e5
adapt policy rules for cm, watcher and kyma
lindnerby Feb 27, 2025
1c6245f
adapt e2e
lindnerby Feb 27, 2025
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 .run/Launch KLM locally.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="Launch KLM locally" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="lifecycle-manager" />
<working_directory value="$PROJECT_DIR$" />
<parameters value="--in-kcp-mode --enable-kcp-watcher --skr-watcher-image-tag=1.1.7" />
<parameters value="--in-kcp-mode --enable-kcp-watcher --skr-watcher-image-tag=1.1.10" />
<envs>
<env name="KUBECONFIG" value="$USER_HOME$/.k3d/kcp-local.yaml" />
</envs>
Expand Down
23 changes: 6 additions & 17 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@ plugins:
projectName: operator
repo: github.com/kyma-project/lifecycle-manager
resources:
- api:
crdVersion: v1
namespaced: true
domain: kyma-project.io
group: operator
kind: Manifest
path: github.com/kyma-project/module-manager/api/v1beta1
version: v1beta1
webhooks:
conversion: true
defaulting: true
validation: true
webhookVersion: v1
- api:
crdVersion: v1
namespaced: true
Expand Down Expand Up @@ -110,10 +97,12 @@ resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: kyma-project.io
group: operator
kind: SyncResource
path: github.com/kyma-project/lifecycle-manager/api/v1alpha1
version: v1alpha1
kind: ModuleReleaseMeta
path: github.com/kyma-project/lifecycle-manager/api/v1beta2
version: v1beta2
webhooks:
conversion: true
webhookVersion: v1
version: "3"
5 changes: 2 additions & 3 deletions config/certmanager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
resources:
- certificate.yaml

- certificate.yaml
configurations:
- kustomizeconfig.yaml
- kustomizeconfig.yaml
127 changes: 54 additions & 73 deletions config/control-plane/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
# WARNING: This is a Kustomization that CANNOT run standalone
# It is meant to be used in conjunction with a control-plane deployment only and has prerequisites that
# need to be explicitly created externally in a centrally managed place (e.g. the kcp-system).
# In fact, in order to avoid conflicts, it even explicitly patches out certain configuration elements.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namePrefix: klm- #kyma-lifecycle-manager

# Labels to add to all resources and selectors.
namePrefix: klm-
commonLabels:
app.kubernetes.io/instance: kcp-lifecycle-manager
app.kubernetes.io/name: lifecycle-manager
app.kubernetes.io/created-by: argo-cd
app.kubernetes.io/part-of: kcp
app.kubernetes.io/managed-by: kustomize

images:
- name: europe-docker.pkg.dev/kyma-project/prod/lifecycle-manager

- name: europe-docker.pkg.dev/kyma-project/prod/lifecycle-manager
resources:
- ../manager
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
- ../certmanager

components:
- ../crd
- ../rbac/namespace_bindings
# [ISTIO] To enable istio, uncomment all sections with 'ISTIO'.
- ../rbac
- ../istio
# [WATCHER] To enable the watcher, uncomment all the sections with [WATCHER]
- ../watcher
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix
- ../webhook
# [GRAFANA] To enable grafana, uncomment all sections with 'GRAFANA'.
- ../grafana

patches:
- patch: |-
- path: patches/deployment_resources.yaml
- path: patches/unique_deployment_webhook_patch.yaml
- path: patches/unique_certificate_name.yaml # Override certificate name to ensure a unique CM Cert when run with other kubebuilder operators
- target:
kind: Deployment
patch: |-
- op: add
path: /spec/template/spec/containers/0/args/-
value: --in-kcp-mode
Expand Down Expand Up @@ -64,64 +53,56 @@ patches:
- op: add
path: /spec/template/spec/containers/0/args/-
value: --is-kyma-managed
target:
kind: Deployment
- patch: |-
- target:
kind: ConfigMap
name: dashboard-(overview|status|watcher|mandatory-modules)
version: v1
patch: |-
- op: add
path: /metadata/labels
value: {}
- op: add
path: /metadata/labels/grafana_dashboard
value: "1"
target:
kind: ConfigMap
name: dashboard-(overview|status|watcher|mandatory-modules)
version: v1
- path: patches/unique_manager_webhook_patch.yaml
- path: patches/adjust_resources_in_deployment.yaml
# We override the certificate name to ensure that Cert-Manager uses a unique cert in conjunction with other
# kubebuilder operators.
- path: patches/unique_certificate_name.yaml

# Note: Now as the 'patchesJson6902' is deprecated, the direct use of the 'PatchTransformer' is the only way to change a resource namespace to something different from the value configured by the global namespace transformer.
transformers:
- |-
apiVersion: builtin
kind: PrefixSuffixTransformer
metadata:
name: add-klm-prefix-to-resources
prefix: klm-
fieldSpecs:
- path: subjects/name
kind: RoleBinding
- path: subjects/name
kind: ClusterRoleBinding
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: add-resources-to-kcp-system
namespace: kcp-system
unsetOnly: true
setRoleBindingSubjects: allServiceAccounts
- |-
apiVersion: builtin
kind: AnnotationsTransformer
metadata:
name: add-ca-inject-annotation
annotations:
cert-manager.io/inject-ca-from: kcp-system/klm-controller-manager-webhook-serving
fieldSpecs:
- kind: CustomResourceDefinition
path: metadata/annotations
- |-
apiVersion: builtin
kind: PatchTransformer
metadata:
name: fix-cert-dns-names
patch: '[{"op": "replace", "path": "/spec/dnsNames/0", "value": "klm-webhook-service.kcp-system.svc"}, {"op": "replace", "path": "/spec/dnsNames/1", "value": "klm-webhook-service.kcp-system.svc.cluster.local"}]'
target:
kind: Certificate
name: klm-controller-manager-webhook-serving
version: v1
group: cert-manager.io
- |-
apiVersion: builtin
kind: PrefixSuffixTransformer
metadata:
name: add-klm-prefix-to-resources
prefix: klm-
fieldSpecs:
- path: subjects/name
kind: RoleBinding
- path: subjects/name
kind: ClusterRoleBinding
- |-
apiVersion: builtin
kind: NamespaceTransformer
metadata:
name: add-resources-to-kcp-system
namespace: kcp-system
unsetOnly: true
setRoleBindingSubjects: allServiceAccounts
- |-
apiVersion: builtin
kind: AnnotationsTransformer
metadata:
name: add-ca-inject-annotation
annotations:
cert-manager.io/inject-ca-from: kcp-system/klm-controller-manager-webhook-serving
fieldSpecs:
- kind: CustomResourceDefinition
path: metadata/annotations
- |-
apiVersion: builtin
kind: PatchTransformer
metadata:
name: fix-cert-dns-names
patch: '[{"op": "replace", "path": "/spec/dnsNames/0", "value": "klm-webhook-service.kcp-system.svc"}, {"op": "replace", "path": "/spec/dnsNames/1", "value": "klm-webhook-service.kcp-system.svc.cluster.local"}]'
target:
kind: Certificate
name: klm-controller-manager-webhook-serving
version: v1
group: cert-manager.io
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This patch inject a sidecar container which is a HTTP proxy for the
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -14,4 +12,4 @@ spec:
memory: 4000Mi
requests:
cpu: 1000m
memory: 1000Mi
memory: 1000Mi
36 changes: 0 additions & 36 deletions config/control-plane/patches/secured_manager_auth_proxy.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kind: Certificate
metadata:
name: controller-manager-webhook-serving # this name should match the one appeared in kustomizeconfig.yaml
spec:
secretName: klm-controller-manager-webhook # this secret will not be prefixed, since it's not managed by kustomize
secretName: klm-controller-manager-webhook # secretName will not be prefixed, since it's not managed by kustomize
26 changes: 12 additions & 14 deletions config/crd/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
# Configure name and namespace reference substitution in CRDs
nameReference:
- kind: Service
version: v1
fieldSpecs:
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/name
namespace:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/name

namespace:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/namespace
create: false

path: spec/conversion/webhook/clientConfig/service/namespace
create: false
varReference:
- path: metadata/annotations
- path: metadata/annotations
Loading
Loading