Skip to content
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
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,23 @@ tidy:

.PHONY: manifests
KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/manager/webhook
KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/webhook
KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
# Due to https://github.com/kubernetes-sigs/controller-tools/issues/837 we can't specify individual files
# So we have to generate them together and then move them into place
manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
# Generate CRDs via our own generator
hack/tools/update-crds.sh
# Generate the remaining operator-controller manifests
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)
# Generate the remaining catalogd manifests
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)
# Generate the remaining operator-controller standard manifests
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS),standard rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)/standard
# Generate the remaining operator-controller experimental manifests
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)/experimental
# Generate the remaining catalogd standard manifests
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS),standard rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)/standard
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS),standard webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)/standard
# Generate the remaining catalogd experimental manifests
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)/experimental
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)/experimental
# Generate manifests stored in source-control
mkdir -p $(MANIFEST_HOME)
$(KUSTOMIZE) build $(KUSTOMIZE_STANDARD_OVERLAY) > $(STANDARD_MANIFEST)
Expand Down
1 change: 0 additions & 1 deletion config/base/catalogd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namePrefix: catalogd-
resources:
- rbac
- manager
8 changes: 0 additions & 8 deletions config/base/catalogd/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@ resources:
- manager.yaml
- service.yaml
- network_policy.yaml
- webhook/manifests.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/operator-framework/catalogd
newTag: devel
patches:
- path: webhook/patch.yaml
target:
group: admissionregistration.k8s.io
kind: MutatingWebhookConfiguration
name: mutating-webhook-configuration
version: v1
19 changes: 19 additions & 0 deletions config/base/catalogd/rbac/common/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resources:
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
- service_account.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# The following RBAC configurations are used to protect
# the metrics endpoint with authn/authz. These configurations
# ensure that only authorized users and service accounts
# can access the metrics endpoint. Comment the following
# permissions if you want to disable this protection.
# More info: https://book.kubebuilder.io/reference/metrics.html
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
7 changes: 7 additions & 0 deletions config/base/catalogd/rbac/experimental/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: olmv1-system
namePrefix: catalogd-
resources:
- ../common
- role.yaml
22 changes: 3 additions & 19 deletions config/base/catalogd/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
# This kustomization picks the standard rbac by default
# If the experimental rbac is desired, select that directory explicitly
resources:
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
- service_account.yaml
- role.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# The following RBAC configurations are used to protect
# the metrics endpoint with authn/authz. These configurations
# ensure that only authorized users and service accounts
# can access the metrics endpoint. Comment the following
# permissions if you want to disable this protection.
# More info: https://book.kubebuilder.io/reference/metrics.html
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
- standard
7 changes: 7 additions & 0 deletions config/base/catalogd/rbac/standard/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: olmv1-system
namePrefix: catalogd-
resources:
- ../common
- role.yaml
48 changes: 48 additions & 0 deletions config/base/catalogd/rbac/standard/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: manager-role
rules:
- apiGroups:
- olm.operatorframework.io
resources:
- clustercatalogs
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- olm.operatorframework.io
resources:
- clustercatalogs/finalizers
verbs:
- update
- apiGroups:
- olm.operatorframework.io
resources:
- clustercatalogs/status
verbs:
- get
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: manager-role
namespace: olmv1-system
rules:
- apiGroups:
- ""
resources:
- secrets
- serviceaccounts
verbs:
- get
- list
- watch
13 changes: 13 additions & 0 deletions config/base/catalogd/webhook/experimental/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resources:
- manifests.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: olmv1-system
namePrefix: catalogd-
patches:
- path: patch.yaml
target:
group: admissionregistration.k8s.io
kind: MutatingWebhookConfiguration
name: mutating-webhook-configuration
version: v1
4 changes: 4 additions & 0 deletions config/base/catalogd/webhook/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This kustomization picks the standard webhook by default
# If the experimental webhook is desired, select that directory explicitly
resources:
- standard
13 changes: 13 additions & 0 deletions config/base/catalogd/webhook/standard/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resources:
- manifests.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: olmv1-system
namePrefix: catalogd-
patches:
- path: patch.yaml
target:
group: admissionregistration.k8s.io
kind: MutatingWebhookConfiguration
name: mutating-webhook-configuration
version: v1
27 changes: 27 additions & 0 deletions config/base/catalogd/webhook/standard/manifests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: mutating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-olm-operatorframework-io-v1-clustercatalog
failurePolicy: Fail
name: inject-metadata-name.olm.operatorframework.io
rules:
- apiGroups:
- olm.operatorframework.io
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- clustercatalogs
sideEffects: None
timeoutSeconds: 10
20 changes: 20 additions & 0 deletions config/base/catalogd/webhook/standard/patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# None of these values can be set via the kubebuilder directive, hence this patch
- op: replace
path: /webhooks/0/clientConfig/service/namespace
value: olmv1-system
- op: replace
path: /webhooks/0/clientConfig/service/name
value: catalogd-service
- op: add
path: /webhooks/0/clientConfig/service/port
value: 9443
# Make sure there's a name defined, otherwise, we can't create a label. This could happen when generateName is set
# Then, if any of the conditions are true, create the label:
# 1. No labels exist
# 2. The olm.operatorframework.io/metadata.name label doesn't exist
# 3. The olm.operatorframework.io/metadata.name label doesn't match the name
- op: add
path: /webhooks/0/matchConditions
value:
- name: MissingOrIncorrectMetadataNameLabel
expression: "'name' in object.metadata && (!has(object.metadata.labels) || !('olm.operatorframework.io/metadata.name' in object.metadata.labels) || object.metadata.labels['olm.operatorframework.io/metadata.name'] != object.metadata.name)"
1 change: 0 additions & 1 deletion config/base/operator-controller/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namePrefix: operator-controller-
resources:
- rbac
- manager
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- manager.yaml
- service.yaml
Expand Down
26 changes: 26 additions & 0 deletions config/base/operator-controller/rbac/common/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resources:
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
- service_account.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml

# The following resources are pre-defined roles for editors and viewers
# of APIs provided by this project.
- clusterextension_editor_role.yaml
- clusterextension_viewer_role.yaml

# The following RBAC configurations are used to protect
# the metrics endpoint with authn/authz. These configurations
# ensure that only authorized users and service accounts
# can access the metrics endpoint. Comment the following
# permissions if you want to disable this protection.
# More info: https://book.kubebuilder.io/reference/metrics.html
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: olmv1-system
namePrefix: operator-controller-
resources:
- ../common
- role.yaml
29 changes: 3 additions & 26 deletions config/base/operator-controller/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
# This kustomization picks the standard rbac by default
# If the experimental rbac is desired, select that directory explicitly
resources:
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
- service_account.yaml
- role.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml

# The following resources are pre-defined roles for editors and viewers
# of APIs provided by this project.
- clusterextension_editor_role.yaml
- clusterextension_viewer_role.yaml

# The following RBAC configurations are used to protect
# the metrics endpoint with authn/authz. These configurations
# ensure that only authorized users and service accounts
# can access the metrics endpoint. Comment the following
# permissions if you want to disable this protection.
# More info: https://book.kubebuilder.io/reference/metrics.html
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml

- standard
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: olmv1-system
namePrefix: operator-controller-
resources:
- ../common
- role.yaml
Loading
Loading