Skip to content

Commit 3921e24

Browse files
authored
Move catalogd entrypoint to cmd/catalogd (#1802)
Move catalogd entrypoint and merge catalogd and operator-controller make files Signed-off-by: Edmund Ochieng <[email protected]>
1 parent dd4f780 commit 3921e24

File tree

7 files changed

+32
-138
lines changed

7 files changed

+32
-138
lines changed

.goreleaser.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ builds:
2020
- ppc64le
2121
- s390x
2222
- id: catalogd
23-
main: ./catalogd/cmd/catalogd/
23+
main: ./cmd/catalogd/
2424
binary: catalogd
2525
asmflags: "{{ .Env.GO_BUILD_ASMFLAGS }}"
2626
gcflags: "{{ .Env.GO_BUILD_GCFLAGS }}"
@@ -38,63 +38,63 @@ builds:
3838
dockers:
3939
- image_templates:
4040
- "{{ .Env.OPERATOR_CONTROLLER_IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-amd64"
41-
dockerfile: Dockerfile
41+
dockerfile: Dockerfile.operator-controller
4242
goos: linux
4343
goarch: amd64
4444
use: buildx
4545
build_flag_templates:
4646
- "--platform=linux/amd64"
4747
- image_templates:
4848
- "{{ .Env.OPERATOR_CONTROLLER_IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-arm64"
49-
dockerfile: Dockerfile
49+
dockerfile: Dockerfile.operator-controller
5050
goos: linux
5151
goarch: arm64
5252
use: buildx
5353
build_flag_templates:
5454
- "--platform=linux/arm64"
5555
- image_templates:
5656
- "{{ .Env.OPERATOR_CONTROLLER_IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-ppc64le"
57-
dockerfile: Dockerfile
57+
dockerfile: Dockerfile.operator-controller
5858
goos: linux
5959
goarch: ppc64le
6060
use: buildx
6161
build_flag_templates:
6262
- "--platform=linux/ppc64le"
6363
- image_templates:
6464
- "{{ .Env.OPERATOR_CONTROLLER_IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-s390x"
65-
dockerfile: Dockerfile
65+
dockerfile: Dockerfile.operator-controller
6666
goos: linux
6767
goarch: s390x
6868
use: buildx
6969
build_flag_templates:
7070
- "--platform=linux/s390x"
7171
- image_templates:
7272
- "{{ .Env.CATALOGD_IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-amd64"
73-
dockerfile: catalogd/Dockerfile
73+
dockerfile: Dockerfile.catalogd
7474
goos: linux
7575
goarch: amd64
7676
use: buildx
7777
build_flag_templates:
7878
- "--platform=linux/amd64"
7979
- image_templates:
8080
- "{{ .Env.CATALOGD_IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-arm64"
81-
dockerfile: catalogd/Dockerfile
81+
dockerfile: Dockerfile.catalogd
8282
goos: linux
8383
goarch: arm64
8484
use: buildx
8585
build_flag_templates:
8686
- "--platform=linux/arm64"
8787
- image_templates:
8888
- "{{ .Env.CATALOGD_IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-ppc64le"
89-
dockerfile: catalogd/Dockerfile
89+
dockerfile: Dockerfile.catalogd
9090
goos: linux
9191
goarch: ppc64le
9292
use: buildx
9393
build_flag_templates:
9494
- "--platform=linux/ppc64le"
9595
- image_templates:
9696
- "{{ .Env.CATALOGD_IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-s390x"
97-
dockerfile: catalogd/Dockerfile
97+
dockerfile: Dockerfile.catalogd
9898
goos: linux
9999
goarch: s390x
100100
use: buildx
File renamed without changes.
File renamed without changes.

Makefile

+21-15
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,28 @@ export ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
99

1010
GOLANG_VERSION := $(shell sed -En 's/^go (.*)$$/\1/p' "go.mod")
1111
# Image URL to use all building/pushing image targets
12-
ifeq ($(origin IMAGE_REPO), undefined)
13-
IMAGE_REPO := quay.io/operator-framework/operator-controller
12+
ifeq ($(origin IMG_NAMESPACE), undefined)
13+
IMG_NAMESPACE := quay.io/operator-framework
1414
endif
15-
export IMAGE_REPO
15+
export IMG_NAMESPACE
1616

17-
ifeq ($(origin CATALOG_IMAGE_REPO), undefined)
18-
CATALOG_IMAGE_REPO := quay.io/operator-framework/catalogd
17+
ifeq ($(origin OPERATOR_CONTROLLER_IMAGE_REPO), undefined)
18+
OPERATOR_CONTROLLER_IMAGE_REPO := $(IMG_NAMESPACE)/operator-controller
1919
endif
20-
export CATALOG_IMAGE_REPO
20+
export OPERATOR_CONTROLLER_IMAGE_REPO
21+
22+
ifeq ($(origin CATALOGD_IMAGE_REPO), undefined)
23+
CATALOGD_IMAGE_REPO := $(IMG_NAMESPACE)/catalogd
24+
endif
25+
export CATALOGD_IMAGE_REPO
2126

2227
ifeq ($(origin IMAGE_TAG), undefined)
2328
IMAGE_TAG := devel
2429
endif
2530
export IMAGE_TAG
2631

27-
IMG := $(IMAGE_REPO):$(IMAGE_TAG)
28-
CATALOGD_IMG := $(CATALOG_IMAGE_REPO):$(IMAGE_TAG)
32+
OPERATOR_CONTROLLER_IMG := $(OPERATOR_CONTROLLER_IMAGE_REPO):$(IMAGE_TAG)
33+
CATALOGD_IMG := $(CATALOGD_IMAGE_REPO):$(IMAGE_TAG)
2934

3035
# Define dependency versions (use go.mod if we also use Go code from dependency)
3136
export CERT_MGR_VERSION := v1.15.3
@@ -263,8 +268,8 @@ e2e-coverage:
263268

264269
.PHONY: kind-load
265270
kind-load: $(KIND) #EXHELP Loads the currently constructed images into the KIND cluster.
266-
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
267-
IMAGE_REPO=$(CATALOG_IMAGE_REPO) KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) $(MAKE) -C catalogd kind-load
271+
$(CONTAINER_RUNTIME) save $(OPERATOR_CONTROLLER_IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
272+
$(CONTAINER_RUNTIME) save $(CATALOGD_IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
268273

269274
.PHONY: kind-deploy
270275
kind-deploy: export MANIFEST := ./operator-controller.yaml
@@ -304,8 +309,9 @@ export GO_BUILD_FLAGS :=
304309
export GO_BUILD_LDFLAGS := -s -w \
305310
-X '$(VERSION_PATH).version=$(VERSION)' \
306311

307-
BINARIES=operator-controller
312+
BINARIES=operator-controller catalogd
308313

314+
.PHONY: $(BINARIES)
309315
$(BINARIES):
310316
go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
311317

@@ -333,9 +339,9 @@ wait:
333339
kubectl wait --for=condition=Ready --namespace=$(CATALOGD_NAMESPACE) certificate/catalogd-service-cert # Avoid upgrade test flakes when reissuing cert
334340

335341
.PHONY: docker-build
336-
docker-build: build-linux #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
337-
$(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux
338-
IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(MAKE) -C catalogd build-container
342+
docker-build: build-linux #EXHELP Build docker image for operator-controller and catalog with GOOS=linux and local GOARCH.
343+
$(CONTAINER_RUNTIME) build -t $(OPERATOR_CONTROLLER_IMG) -f Dockerfile.operator-controller ./bin/linux
344+
$(CONTAINER_RUNTIME) build -t $(CATALOGD_IMG) -f Dockerfile.catalogd ./bin/linux
339345

340346
#SECTION Release
341347
ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined)
@@ -350,7 +356,7 @@ export GORELEASER_ARGS
350356

351357
.PHONY: release
352358
release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By default, this will run only as a snapshot and will not publish any artifacts unless it is run with different arguments. To override the arguments, run with "GORELEASER_ARGS=...". When run as a github action from a tag, this target will publish a full release.
353-
OPERATOR_CONTROLLER_IMAGE_REPO=$(IMAGE_REPO) CATALOGD_IMAGE_REPO=$(CATALOG_IMAGE_REPO) $(GORELEASER) $(GORELEASER_ARGS)
359+
OPERATOR_CONTROLLER_IMAGE_REPO=$(OPERATOR_CONTROLLER_IMAGE_REPO) CATALOGD_IMAGE_REPO=$(CATALOGD_IMAGE_REPO) $(GORELEASER) $(GORELEASER_ARGS)
354360

355361
.PHONY: quickstart
356362
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml

Tiltfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ catalogd = {
1515
'image': 'quay.io/operator-framework/catalogd',
1616
'yaml': 'config/overlays/tilt-local-dev/catalogd',
1717
'binaries': {
18-
'./catalogd/cmd/catalogd': 'catalogd-controller-manager',
18+
'./cmd/catalogd': 'catalogd-controller-manager',
1919
},
20-
'deps': ['api', 'catalogd/cmd/catalogd', 'internal/catalogd', 'internal/shared', 'go.mod', 'go.sum'],
20+
'deps': ['api', 'cmd/catalogd', 'internal/catalogd', 'internal/shared', 'go.mod', 'go.sum'],
2121
'starting_debug_port': 20000,
2222
}
2323

catalogd/Makefile

-112
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)