-
Notifications
You must be signed in to change notification settings - Fork 15
feat(discovery): implement All Namespaces discovery #213
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
Merged
andrewazores
merged 15 commits into
cryostatio:main
from
andrewazores:k8s-all-namespaces
Jun 12, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a35b3f5
feat(discovery): implement All Namespaces discovery
andrewazores eb9e7f0
tests
andrewazores 8cf28c7
warning
andrewazores 748362e
trim trailing periods from descriptions for consistency
andrewazores 9bd4d35
rephrase
andrewazores 50c7d0b
allNamespaces -> allowAllNamespaces
andrewazores b343a57
refactor
andrewazores 3021766
Update charts/cryostat/templates/discovery_clusterrole.yaml
andrewazores 32dbaac
Update charts/cryostat/templates/discovery_clusterrolebinding.yaml
andrewazores 24f9406
Update charts/cryostat/tests/discovery_clusterrole_test.yaml
andrewazores 3304f91
allNamespaces -> allowAllNamespaces fixup
andrewazores 5b4b462
skip namespaced role/binding if cluster-wide role/binding for All Nam…
andrewazores 7a89d6e
add namespaces get/list/watch permission for all namespaces discovery…
andrewazores 48c4f50
reduce namespaces roles to only list
andrewazores 24dd16e
endpointslices adjustment
andrewazores File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| {{- if and .Values.rbac.create .Values.core.discovery.kubernetes.enabled .Values.core.discovery.kubernetes.allowAllNamespaces -}} | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: {{ include "cryostat.fullname" . }}-discovery | ||
| labels: | ||
| {{- include "cryostat.labels" . | nindent 4 }} | ||
| rules: | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - namespaces | ||
| verbs: | ||
| - list | ||
| - apiGroups: | ||
| - discovery.k8s.io | ||
| resources: | ||
| - endpointslices | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - pods | ||
| - replicationcontrollers | ||
| verbs: | ||
| - get | ||
| - apiGroups: | ||
| - apps | ||
| resources: | ||
| - replicasets | ||
| - deployments | ||
| - daemonsets | ||
| - statefulsets | ||
| verbs: | ||
| - get | ||
| - apiGroups: | ||
| - apps.openshift.io | ||
| resources: | ||
| - deploymentconfigs | ||
| verbs: | ||
| - get | ||
| - apiGroups: | ||
| - route.openshift.io | ||
| resources: | ||
| - routes | ||
| verbs: | ||
| - get | ||
| - list | ||
| {{- end -}} | ||
16 changes: 16 additions & 0 deletions
16
charts/cryostat/templates/discovery_clusterrolebinding.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| {{- if and .Values.rbac.create .Values.core.discovery.kubernetes.enabled .Values.core.discovery.kubernetes.allowAllNamespaces -}} | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: {{ include "cryostat.fullname" . }}-discovery | ||
| labels: | ||
| {{- include "cryostat.labels" . | nindent 4 }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: {{ include "cryostat.fullname" . }}-discovery | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ include "cryostat.serviceAccountName" . }} | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| suite: test discovery_clusterrole.yaml | ||
| templates: | ||
| - discovery_clusterrole.yaml | ||
|
|
||
| tests: | ||
| - it: should do nothing if Kubernetes All Namespaces discovery is not enabled | ||
| set: | ||
| rbac.create: true | ||
| core.discovery.kubernetes.enabled: true | ||
| core.discovery.kubernetes.allowAllNamespaces: false | ||
| asserts: | ||
| - hasDocuments: | ||
| count: 0 | ||
|
|
||
| - it: should do nothing if Kubernetes discovery is not enabled | ||
| set: | ||
| rbac.create: true | ||
| core.discovery.kubernetes.enabled: false | ||
| core.discovery.kubernetes.allowAllNamespaces: true | ||
| asserts: | ||
| - hasDocuments: | ||
| count: 0 | ||
|
|
||
| - it: should do nothing if RBAC creation is not enabled | ||
| set: | ||
| rbac.create: false | ||
| core.discovery.kubernetes.enabled: true | ||
| core.discovery.kubernetes.allowAllNamespaces: true | ||
| asserts: | ||
| - hasDocuments: | ||
| count: 0 | ||
|
|
||
| - it: should create ClusterRole | ||
| set: | ||
| rbac.create: true | ||
| core.discovery.kubernetes.enabled: true | ||
| core.discovery.kubernetes.allowAllNamespaces: true | ||
| asserts: | ||
| - hasDocuments: | ||
| count: 1 | ||
| - equal: | ||
| path: kind | ||
| value: ClusterRole | ||
| - equal: | ||
| path: metadata.name | ||
| value: RELEASE-NAME-cryostat-discovery | ||
| - equal: | ||
| path: metadata.labels | ||
| value: | ||
| app.kubernetes.io/instance: RELEASE-NAME | ||
| app.kubernetes.io/part-of: cryostat | ||
| app.kubernetes.io/managed-by: Helm | ||
| app.kubernetes.io/name: cryostat | ||
| app.kubernetes.io/version: "4.1.0-dev" | ||
| helm.sh/chart: cryostat-2.0.0-dev | ||
| - equal: | ||
| path: rules | ||
| value: | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - namespaces | ||
| verbs: | ||
| - list | ||
| - apiGroups: | ||
| - discovery.k8s.io | ||
| resources: | ||
| - endpointslices | ||
| verbs: | ||
| - get | ||
| - list | ||
| - watch | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - pods | ||
| - replicationcontrollers | ||
| verbs: | ||
| - get | ||
| - apiGroups: | ||
| - apps | ||
| resources: | ||
| - replicasets | ||
| - deployments | ||
| - daemonsets | ||
| - statefulsets | ||
| verbs: | ||
| - get | ||
| - apiGroups: | ||
| - apps.openshift.io | ||
| resources: | ||
| - deploymentconfigs | ||
| verbs: | ||
| - get | ||
| - apiGroups: | ||
| - route.openshift.io | ||
| resources: | ||
| - routes | ||
| verbs: | ||
| - get | ||
| - list |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.