-
Notifications
You must be signed in to change notification settings - Fork 592
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
Explicit cluster roles for controller/webhook, not cluster-admin #872
Changes from 6 commits
b470ea5
2bcf1c6
8e1359f
1777c95
03e150d
0f22d99
64f838f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2019 The Knative Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: knative-eventing-controller | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["namespaces", "secrets", "configmaps", "services", "events", "serviceaccounts"] | ||
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] | ||
- apiGroups: ["serving.knative.dev"] | ||
resources: ["routes", "routes/status", "services", "services/status"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["networking.istio.io"] | ||
resources: ["virtualservices"] | ||
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] | ||
- apiGroups: ["apps"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's strange to have this Maybe put in a comment There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my bad :) moved... |
||
resources: ["deployments"] | ||
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] | ||
- apiGroups: ["rbac.authorization.k8s.io"] | ||
resources: ["rolebindings"] | ||
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need these permissions on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are needed for triggers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah -- this is actually needed for the namespace Broker auto-provisioner. https://github.com/knative/eventing/blob/master/pkg/reconciler/v1alpha1/namespace/namespace.go#L264 I wonder if we want to extract the Broker auto-provisioner at some point in the future. |
||
# Our own resources and statuses we care about | ||
- apiGroups: ["eventing.knative.dev"] | ||
resources: ["brokers", "brokers/status", "channels", "channels/status", "clusterchannelprovisioners", "clusterchannelprovisioners/status", "subscriptions", "subscriptions/status", "triggers", "triggers/status",] | ||
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2019 The Knative Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: knative-eventing-webhook | ||
rules: | ||
# For watching logging configuration and getting certs | ||
- apiGroups: [""] | ||
resources: ["configmaps"] | ||
verbs: ["get", "list", "watch"] | ||
# For manipulating certs into secrets | ||
- apiGroups: [""] | ||
resources: ["secrets"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this is a candidate for a (namespaced) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok to make this into a separate issue and tackle that in a followup? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 to a followup issue. |
||
verbs: ["get", "create"] | ||
# For getting our Deployment so we can decorate with ownerref | ||
- apiGroups: ["apps"] | ||
resources: ["deployments"] | ||
verbs: ["get"] | ||
# For actually registering our webhook | ||
- apiGroups: ["admissionregistration.k8s.io"] | ||
resources: ["mutatingwebhookconfigurations"] | ||
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"] | ||
# Our own resources and statuses we care about | ||
- apiGroups: ["eventing.knative.dev"] | ||
resources: ["brokers", "brokers/status", "channels", "channels/status", "clusterchannelprovisioners", "clusterchannelprovisioners/status", "subscriptions", "subscriptions/status", "triggers", "triggers/status",] | ||
verbs: ["get", "list", "create", "watch"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use create in the webhook? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,18 @@ subjects: | |
namespace: knative-eventing | ||
roleRef: | ||
kind: ClusterRole | ||
name: cluster-admin | ||
name: knative-eventing-controller | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: eventing-webhook-admin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to Do a similar rename to |
||
subjects: | ||
- kind: ServiceAccount | ||
name: eventing-webhook | ||
namespace: knative-eventing | ||
roleRef: | ||
kind: ClusterRole | ||
name: knative-eventing-webhook | ||
apiGroup: rbac.authorization.k8s.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need list/delete/watch on events? (Or create/update/patch for namespaces, secrets or serviceaccounts?)
May not be worth pulling out separately.