Skip to content

Commit f3b166c

Browse files
Moving catalogd controllers and webhook
Moving catalogd/internal/controllers and catalogd/internal/webhooks to internal/catalogd along with the Makefile changes Signed-off-by: Lalatendu Mohanty <[email protected]>
1 parent b53c31c commit f3b166c

File tree

10 files changed

+58
-16
lines changed

10 files changed

+58
-16
lines changed

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,18 @@ tidy: #HELP Update dependencies.
115115
# Force tidy to use the version already in go.mod
116116
$(Q)go mod tidy -go=$(GOLANG_VERSION)
117117

118-
119118
.PHONY: manifests
120119
KUSTOMIZE_CRDS_DIR := config/base/crd/bases
121120
KUSTOMIZE_RBAC_DIR := config/base/rbac
121+
KUSTOMIZE_WEBHOOKS_DIR := config/base/manager/webhook
122122
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
123-
# To generate the manifests used and do not use catalogd directory
123+
# Generate the operator-controller manifests
124124
rm -rf $(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/... output:crd:artifacts:config=$(KUSTOMIZE_CRDS_DIR)
125125
rm -f $(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/operator-controller/... output:rbac:artifacts:config=$(KUSTOMIZE_RBAC_DIR)
126-
# To generate the manifests for catalogd
127-
$(MAKE) -C catalogd generate
126+
# Generate the catalogd manifests
127+
rm -rf catalogd/$(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths="./catalogd/api/..." output:crd:artifacts:config=catalogd/$(KUSTOMIZE_CRDS_DIR)
128+
rm -f catalogd/$(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/..." output:rbac:artifacts:config=catalogd/$(KUSTOMIZE_RBAC_DIR)
129+
rm -f catalogd/$(KUSTOMIZE_WEBHOOKS_DIR)/manifests.yaml && $(CONTROLLER_GEN) webhook paths="./internal/..." output:webhook:artifacts:config=catalogd/$(KUSTOMIZE_WEBHOOKS_DIR)
128130

129131
.PHONY: generate
130132
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.

catalogd/Makefile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ help: ## Display this help.
5858
clean: ## Remove binaries and test artifacts
5959
rm -rf bin
6060

61-
.PHONY: generate
62-
KUSTOMIZE_CRDS_DIR := config/base/crd/bases
63-
KUSTOMIZE_RBAC_DIR := config/base/rbac
64-
KUSTOMIZE_WEBHOOKS_DIR := config/base/manager/webhook
65-
generate: $(CONTROLLER_GEN) ## Generate code and manifests.
66-
$(CONTROLLER_GEN) object:headerFile="../hack/boilerplate.go.txt" paths="./..."
67-
rm -rf $(KUSTOMIZE_CRDS_DIR) && $(CONTROLLER_GEN) crd paths="./api/..." output:crd:artifacts:config=$(KUSTOMIZE_CRDS_DIR)
68-
rm -f $(KUSTOMIZE_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/..." output:rbac:artifacts:config=$(KUSTOMIZE_RBAC_DIR)
69-
rm -f $(KUSTOMIZE_WEBHOOKS_DIR)/manifests.yaml && $(CONTROLLER_GEN) webhook paths="./internal/..." output:webhook:artifacts:config=$(KUSTOMIZE_WEBHOOKS_DIR)
70-
7161
##@ Build
7262

7363
BINARIES=catalogd

catalogd/cmd/catalogd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ import (
5656
crwebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
5757

5858
catalogdv1 "github.com/operator-framework/operator-controller/catalogd/api/v1"
59-
corecontrollers "github.com/operator-framework/operator-controller/catalogd/internal/controllers/core"
60-
"github.com/operator-framework/operator-controller/catalogd/internal/webhook"
59+
corecontrollers "github.com/operator-framework/operator-controller/internal/catalogd/controllers/core"
6160
"github.com/operator-framework/operator-controller/internal/catalogd/features"
6261
"github.com/operator-framework/operator-controller/internal/catalogd/garbagecollection"
6362
catalogdmetrics "github.com/operator-framework/operator-controller/internal/catalogd/metrics"
6463
"github.com/operator-framework/operator-controller/internal/catalogd/serverutil"
6564
"github.com/operator-framework/operator-controller/internal/catalogd/source"
6665
"github.com/operator-framework/operator-controller/internal/catalogd/storage"
66+
"github.com/operator-framework/operator-controller/internal/catalogd/webhook"
6767
fsutil "github.com/operator-framework/operator-controller/internal/shared/util/fs"
6868
"github.com/operator-framework/operator-controller/internal/shared/version"
6969
)

catalogd/config/base/rbac/role.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ kind: ClusterRole
44
metadata:
55
name: manager-role
66
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- serviceaccounts/token
11+
verbs:
12+
- create
13+
- apiGroups:
14+
- apiextensions.k8s.io
15+
resources:
16+
- customresourcedefinitions
17+
verbs:
18+
- get
719
- apiGroups:
820
- olm.operatorframework.io
921
resources:
@@ -20,6 +32,7 @@ rules:
2032
- olm.operatorframework.io
2133
resources:
2234
- clustercatalogs/finalizers
35+
- clusterextensions/finalizers
2336
verbs:
2437
- update
2538
- apiGroups:
@@ -30,3 +43,40 @@ rules:
3043
- get
3144
- patch
3245
- update
46+
- apiGroups:
47+
- olm.operatorframework.io
48+
resources:
49+
- clusterextensions
50+
verbs:
51+
- get
52+
- list
53+
- patch
54+
- update
55+
- watch
56+
- apiGroups:
57+
- olm.operatorframework.io
58+
resources:
59+
- clusterextensions/status
60+
verbs:
61+
- patch
62+
- update
63+
---
64+
apiVersion: rbac.authorization.k8s.io/v1
65+
kind: Role
66+
metadata:
67+
name: manager-role
68+
namespace: system
69+
rules:
70+
- apiGroups:
71+
- ""
72+
resources:
73+
- secrets
74+
verbs:
75+
- create
76+
- delete
77+
- deletecollection
78+
- get
79+
- list
80+
- patch
81+
- update
82+
- watch

0 commit comments

Comments
 (0)