Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Rename security.knative.dev -> policy.run.google.cloud.com #732

Merged
merged 1 commit into from
Mar 30, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ limitations under the License.
package main

import (
"github.com/google/knative-gcp/pkg/reconciler/security/istio/eventpolicybinding"
"github.com/google/knative-gcp/pkg/reconciler/security/istio/httppolicybinding"
"github.com/google/knative-gcp/pkg/reconciler/policy/istio/eventpolicybinding"
"github.com/google/knative-gcp/pkg/reconciler/policy/istio/httppolicybinding"

// The following line to load the gcp plugin (only required to authenticate against GKE clusters).
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
Expand Down
18 changes: 9 additions & 9 deletions cmd/security-webhook/main.go → cmd/policy/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"

configvalidation "github.com/google/knative-gcp/pkg/apis/configs/validation"
securityv1alpha1 "github.com/google/knative-gcp/pkg/apis/security/v1alpha1"
policyv1alpha1 "github.com/google/knative-gcp/pkg/apis/policy/v1alpha1"
"k8s.io/apimachinery/pkg/runtime/schema"
"knative.dev/eventing/pkg/logconfig"
"knative.dev/pkg/configmap"
Expand All @@ -39,10 +39,10 @@ import (
)

var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{
securityv1alpha1.SchemeGroupVersion.WithKind("HTTPPolicy"): &securityv1alpha1.HTTPPolicy{},
securityv1alpha1.SchemeGroupVersion.WithKind("EventPolicy"): &securityv1alpha1.EventPolicy{},
securityv1alpha1.SchemeGroupVersion.WithKind("HTTPPolicyBinding"): &securityv1alpha1.HTTPPolicyBinding{},
securityv1alpha1.SchemeGroupVersion.WithKind("EventPolicyBinding"): &securityv1alpha1.EventPolicyBinding{},
policyv1alpha1.SchemeGroupVersion.WithKind("HTTPPolicy"): &policyv1alpha1.HTTPPolicy{},
policyv1alpha1.SchemeGroupVersion.WithKind("EventPolicy"): &policyv1alpha1.EventPolicy{},
policyv1alpha1.SchemeGroupVersion.WithKind("HTTPPolicyBinding"): &policyv1alpha1.HTTPPolicyBinding{},
policyv1alpha1.SchemeGroupVersion.WithKind("EventPolicyBinding"): &policyv1alpha1.EventPolicyBinding{},
}

func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher) *controller.Impl {
Expand All @@ -54,7 +54,7 @@ func NewDefaultingAdmissionController(ctx context.Context, cmw configmap.Watcher
return defaulting.NewAdmissionController(ctx,

// Name of the default webhook.
"webhook.security.knative.dev",
"webhook.policy.run.cloud.google.com",

// The path on which to serve the webhook.
"/defaulting",
Expand All @@ -74,7 +74,7 @@ func NewValidationAdmissionController(ctx context.Context, cmw configmap.Watcher
return validation.NewAdmissionController(ctx,

// Name of the validation webhook.
"validation.webhook.security.knative.dev",
"validation.webhook.policy.run.cloud.google.com",

// The path on which to serve the webhook.
"/validation",
Expand All @@ -97,7 +97,7 @@ func NewConfigValidationController(ctx context.Context, cmw configmap.Watcher) *
return configmaps.NewAdmissionController(ctx,

// Name of the configmap webhook.
"config.webhook.security.knative.dev",
"config.webhook.policy.run.cloud.google.com",

// The path on which to serve the webhook.
"/config-validation",
Expand All @@ -118,7 +118,7 @@ func main() {
ServiceName: logconfig.WebhookName(),
Port: 8443,
// SecretName must match the name of the Secret created in the configuration.
SecretName: "security-webhook-certs",
SecretName: "policy-webhook-certs",
})

sharedmain.WebhookMainWithContext(ctx, logconfig.WebhookName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: knative-security
name: cloud-run-policy
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: security-controller
namespace: knative-security
name: policy-controller
namespace: cloud-run-policy
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel

---

apiVersion: v1
kind: ServiceAccount
metadata:
name: security-webhook
namespace: knative-security
name: policy-webhook
namespace: cloud-run-policy
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: security-controller
name: policy-controller
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel
rules:

- apiGroups:
- security.knative.dev
- policy.run.cloud.google.com
resources:
- httppolicies
- eventpolicies
Expand All @@ -37,7 +37,7 @@ rules:
- delete

- apiGroups:
- security.knative.dev
- policy.run.cloud.google.com
resources:
- httppolicybindings/status
- eventpolicybindings/status
Expand All @@ -61,6 +61,13 @@ rules:
verbs:
- get

- apiGroups: [“”]
yolocs marked this conversation as resolved.
Show resolved Hide resolved
resources:
- events
verbs:
- create
- patch

# All supported subjects.
# TODO: is there a better way to grant get/list permission
# for all resources?
Expand Down
7 changes: 3 additions & 4 deletions config/security/201-role.yaml → config/policy/201-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@

apiVersion: rbac.authorization.k8s.io/v1
kind: Role

metadata:
name: security-controller
namespace: knative-security
name: policy-controller
namespace: cloud-run-policy
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel
rules:
- apiGroups:
- ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: security-webhook
name: policy-webhook
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel
rules:
# For watching logging configuration and getting certs.
- apiGroups:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: security-controller
name: policy-controller
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel
subjects:
- kind: ServiceAccount
name: security-controller
namespace: knative-security
name: policy-controller
namespace: cloud-run-policy
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: security-controller
name: policy-controller

---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: security-webhook
name: policy-webhook
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel
subjects:
- kind: ServiceAccount
name: security-webhook
namespace: knative-security
name: policy-webhook
namespace: cloud-run-policy
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: security-webhook
name: policy-webhook
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: security-controller
namespace: knative-security
name: policy-controller
namespace: cloud-run-policy
labels:
security.knative.dev/release: devel
policy.run.cloud.google.com/release: devel
subjects:
- kind: ServiceAccount
name: security-controller
namespace: knative-security
name: policy-controller
namespace: cloud-run-policy
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: security-controller
name: policy-controller
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: eventpolicies.security.knative.dev
name: eventpolicies.policy.run.cloud.google.com
labels:
security.knative.dev/release: devel
security.knative.dev/crd-install: "true"
policy.run.cloud.google.com/release: devel
policy.run.cloud.google.com/crd-install: "true"
spec:
group: security.knative.dev
group: policy.run.cloud.google.com
version: v1alpha1
names:
kind: EventPolicy
Expand All @@ -28,7 +28,7 @@ spec:
categories:
- all
- knative
- security
- policy
scope: Namespaced
additionalPrinterColumns:
- name: Age
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: eventpolicybindings.security.knative.dev
name: eventpolicybindings.policy.run.cloud.google.com
labels:
security.knative.dev/release: devel
security.knative.dev/crd-install: "true"
policy.run.cloud.google.com/release: devel
policy.run.cloud.google.com/crd-install: "true"
spec:
group: security.knative.dev
group: policy.run.cloud.google.com
version: v1alpha1
names:
kind: EventPolicyBinding
Expand All @@ -28,7 +28,7 @@ spec:
categories:
- all
- knative
- security
- policy
scope: Namespaced
subresources:
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: httppolicies.security.knative.dev
name: httppolicies.policy.run.cloud.google.com
labels:
security.knative.dev/release: devel
security.knative.dev/crd-install: "true"
policy.run.cloud.google.com/release: devel
policy.run.cloud.google.com/crd-install: "true"
spec:
group: security.knative.dev
group: policy.run.cloud.google.com
version: v1alpha1
names:
kind: HTTPPolicy
Expand All @@ -28,7 +28,7 @@ spec:
categories:
- all
- knative
- security
- policy
scope: Namespaced
additionalPrinterColumns:
- name: Age
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: httppolicybindings.security.knative.dev
name: httppolicybindings.policy.run.cloud.google.com
labels:
security.knative.dev/release: devel
security.knative.dev/crd-install: "true"
policy.run.cloud.google.com/release: devel
policy.run.cloud.google.com/crd-install: "true"
spec:
group: security.knative.dev
group: policy.run.cloud.google.com
version: v1alpha1
names:
kind: HTTPPolicyBinding
Expand All @@ -28,7 +28,7 @@ spec:
categories:
- all
- knative
- security
- policy
scope: Namespaced
subresources:
status: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ apiVersion: v1
kind: Service
metadata:
labels:
role: security-webhook
security.knative.dev/release: devel
name: security-webhook
namespace: knative-security
role: policy-webhook
policy.run.cloud.google.com/release: devel
name: policy-webhook
namespace: cloud-run-policy
spec:
ports:
- port: 443
targetPort: 8443
selector:
role: security-webhook
role: policy-webhook
Loading