Skip to content

Commit 4ecef20

Browse files
authored
Consolidate APIs into the same directory (#1803)
This required renaming op-con's CatalogSource to CatalogFilter to avoid a name conflict with catd's CatalogSource Update source files to refer to the proper API directory, and name the import reference consistently. The docs/api-reference is now combined as well. Signed-off-by: Todd Short <[email protected]>
1 parent 8fd4464 commit 4ecef20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1061
-1150
lines changed

Diff for: Makefile

+14-15
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,20 @@ KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
118118
KUSTOMIZE_CATD_WEBHOOKS_DIR := config/base/catalogd/manager/webhook
119119
KUSTOMIZE_OPCON_CRDS_DIR := config/base/operator-controller/crd/bases
120120
KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
121+
CRD_WORKING_DIR := crd_work_dir
122+
# Due to https://github.com/kubernetes-sigs/controller-tools/issues/837 we can't specify individual files
123+
# So we have to generate them together and then move them into place
121124
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
122-
# Generate the operator-controller manifests
123-
rm -rf $(KUSTOMIZE_OPCON_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/operator-controller/... output:crd:artifacts:config=$(KUSTOMIZE_OPCON_CRDS_DIR)
124-
rm -f $(KUSTOMIZE_OPCON_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths=./internal/operator-controller/... output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)
125-
# Generate the catalogd manifests
126-
rm -rf $(KUSTOMIZE_CATD_CRDS_DIR) && $(CONTROLLER_GEN) crd paths=./api/catalogd/... output:crd:artifacts:config=$(KUSTOMIZE_CATD_CRDS_DIR)
127-
rm -f $(KUSTOMIZE_CATD_RBAC_DIR)/role.yaml && $(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)
128-
rm -f $(KUSTOMIZE_CATD_WEBHOOKS_DIR)/manifests.yaml && $(CONTROLLER_GEN) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)
125+
mkdir $(CRD_WORKING_DIR)
126+
$(CONTROLLER_GEN) crd paths="./api/v1/..." output:crd:artifacts:config=$(CRD_WORKING_DIR)
127+
mv $(CRD_WORKING_DIR)/olm.operatorframework.io_clusterextensions.yaml $(KUSTOMIZE_OPCON_CRDS_DIR)
128+
mv $(CRD_WORKING_DIR)/olm.operatorframework.io_clustercatalogs.yaml $(KUSTOMIZE_CATD_CRDS_DIR)
129+
rmdir $(CRD_WORKING_DIR)
130+
# Generate the remaining operator-controller manifests
131+
$(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)
132+
# Generate the remaining catalogd manifests
133+
$(CONTROLLER_GEN) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)
134+
$(CONTROLLER_GEN) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)
129135

130136
.PHONY: generate
131137
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
@@ -353,20 +359,13 @@ quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the unified installation rel
353359

354360
.PHONY: crd-ref-docs
355361
OPERATOR_CONTROLLER_API_REFERENCE_FILENAME := operator-controller-api-reference.md
356-
CATALOGD_API_REFERENCE_FILENAME := catalogd-api-reference.md
357362
API_REFERENCE_DIR := $(ROOT_DIR)/docs/api-reference
358-
359363
crd-ref-docs: $(CRD_REF_DOCS) #EXHELP Generate the API Reference Documents.
360364
rm -f $(API_REFERENCE_DIR)/$(OPERATOR_CONTROLLER_API_REFERENCE_FILENAME)
361-
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api/operator-controller \
365+
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api/ \
362366
--config=$(API_REFERENCE_DIR)/crd-ref-docs-gen-config.yaml \
363367
--renderer=markdown --output-path=$(API_REFERENCE_DIR)/$(OPERATOR_CONTROLLER_API_REFERENCE_FILENAME);
364368

365-
rm -f $(API_REFERENCE_DIR)/$(CATALOGD_API_REFERENCE_FILENAME)
366-
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api/catalogd \
367-
--config=$(API_REFERENCE_DIR)/crd-ref-docs-gen-config.yaml \
368-
--renderer=markdown --output-path=$(API_REFERENCE_DIR)/$(CATALOGD_API_REFERENCE_FILENAME);
369-
370369
VENVDIR := $(abspath docs/.venv)
371370

372371
.PHONY: build-docs

Diff for: Tiltfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ operator_controller = {
66
'binaries': {
77
'./cmd/operator-controller': 'operator-controller-controller-manager',
88
},
9-
'deps': ['api/operator-controller', 'cmd/operator-controller', 'internal/operator-controller', 'internal/shared', 'go.mod', 'go.sum'],
9+
'deps': ['api', 'cmd/operator-controller', 'internal/operator-controller', 'internal/shared', 'go.mod', 'go.sum'],
1010
'starting_debug_port': 30000,
1111
}
1212
deploy_repo('operator-controller', operator_controller, '-tags containers_image_openpgp')
@@ -17,7 +17,7 @@ catalogd = {
1717
'binaries': {
1818
'./catalogd/cmd/catalogd': 'catalogd-controller-manager',
1919
},
20-
'deps': ['api/catalogd', 'catalogd/cmd/catalogd', 'internal/catalogd', 'internal/shared', 'go.mod', 'go.sum'],
20+
'deps': ['api', 'catalogd/cmd/catalogd', 'internal/catalogd', 'internal/shared', 'go.mod', 'go.sum'],
2121
'starting_debug_port': 20000,
2222
}
2323

Diff for: api/catalogd/v1/groupversion_info.go

-36
This file was deleted.

Diff for: api/catalogd/v1/zz_generated.deepcopy.go

-227
This file was deleted.

Diff for: api/catalogd/v1/clustercatalog_types.go renamed to api/v1/clustercatalog_types.go

-13
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,6 @@ type AvailabilityMode string
3030
const (
3131
SourceTypeImage SourceType = "Image"
3232

33-
TypeProgressing = "Progressing"
34-
TypeServing = "Serving"
35-
36-
// Serving reasons
37-
ReasonAvailable = "Available"
38-
ReasonUnavailable = "Unavailable"
39-
ReasonUserSpecifiedUnavailable = "UserSpecifiedUnavailable"
40-
41-
// Progressing reasons
42-
ReasonSucceeded = "Succeeded"
43-
ReasonRetrying = "Retrying"
44-
ReasonBlocked = "Blocked"
45-
4633
MetadataNameLabel = "olm.operatorframework.io/metadata.name"
4734

4835
AvailabilityModeAvailable AvailabilityMode = "Available"

Diff for: api/catalogd/v1/clustercatalog_types_test.go renamed to api/v1/clustercatalog_types_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"sigs.k8s.io/yaml"
2121
)
2222

23-
const crdFilePath = "../../../config/base/catalogd/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
23+
const crdFilePath = "../../config/base/catalogd/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
2424

2525
func TestImageSourceCELValidationRules(t *testing.T) {
2626
validators := fieldValidatorsFromFile(t, crdFilePath)

0 commit comments

Comments
 (0)