Skip to content

Commit 171cb0a

Browse files
authored
Merge pull request #10 from Akrog/lcore-dev-improvements
Lcore dev improvements
2 parents 410da6f + 000a6ff commit 171cb0a

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ go.work
2626
*.swp
2727
*.swo
2828
*~
29+
30+
# Kuttl test files
31+
kubeconfig
32+
kuttl-report-openstack-lightspeed.xml

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
FROM golang:1.24 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
5+
ARG GOMAXPROCS
56

67
WORKDIR /workspace
78
# Copy the Go Modules manifests
@@ -21,7 +22,7 @@ COPY internal/controller/ internal/controller/
2122
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
2223
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
2324
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
24-
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
25+
RUN GOMAXPROCS=${GOMAXPROCS} CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
2526

2627
# Use distroless as minimal base image to package the manager binary
2728
# Refer to https://github.com/GoogleContainerTools/distroless for more details

Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
146146

147147
.PHONY: build
148148
build: manifests generate fmt vet ## Build manager binary.
149-
go build -o bin/manager cmd/main.go
149+
GOMAXPROCS=$(GOMAXPROCS) go build -o bin/manager cmd/main.go
150150

151151
.PHONY: run
152152
run: manifests generate fmt vet ## Run a controller from your host.
@@ -157,7 +157,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
157157
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
158158
.PHONY: docker-build
159159
docker-build: ## Build docker image with the manager.
160-
$(CONTAINER_TOOL) build -t ${IMG} .
160+
$(CONTAINER_TOOL) build --build-arg GOMAXPROCS=$(GOMAXPROCS) -t ${IMG} .
161161

162162
.PHONY: docker-push
163163
docker-push: ## Push docker image with the manager.
@@ -219,10 +219,12 @@ openstack-lightspeed-deploy: ## Deploy using a catalog image.
219219
oc apply -f $(OUTPUT_DIR)/rhosls
220220
bash scripts/confirm-rhosls-running.sh
221221

222-
# Deploy using the catalog image.
222+
# Undeploy using the catalog image.
223+
# Remove OpenStackLightspeds so the namespace deletion doesn't get stuck
223224
.PHONY: openstack-lightspeed-undeploy
224225
openstack-lightspeed-undeploy: export OUTPUT_DIR = out
225226
openstack-lightspeed-undeploy: ## Undeploy using a catalog image.
227+
oc delete openstacklightspeed --all -n openstack-lightspeed --ignore-not-found=true --timeout=120s
226228
find out/{catalog,rhosls} -name "*.yaml" -printf " -f %p" | xargs oc delete --ignore-not-found=true
227229

228230
CATALOG_NAME ?= openstack-lightspeed-catalog
@@ -299,6 +301,20 @@ kuttl-test-ocp: BUNDLE_IMG = $(OCP_INTERNAL_REGISTRY)/openshift-marketplace/oper
299301
kuttl-test-ocp: CATALOG_IMG = $(OCP_INTERNAL_REGISTRY)/openshift-marketplace/operator-catalog:$(TAG)
300302
kuttl-test-ocp: docker-build bundle bundle-build ocp-catalog-build ocp-registry-push kuttl-test-run
301303

304+
.PHONY: ocp-deploy
305+
ocp-deploy: IMG = $(OCP_INTERNAL_REGISTRY)/$(OCP_REGISTRY_NAMESPACE)/operator:latest
306+
ocp-deploy: BUNDLE_IMG = $(OCP_INTERNAL_REGISTRY)/openshift-marketplace/operator-bundle:$(TAG)
307+
ocp-deploy: CATALOG_IMG = $(OCP_INTERNAL_REGISTRY)/openshift-marketplace/operator-catalog:$(TAG)
308+
ocp-deploy: docker-build bundle bundle-build ocp-catalog-build ocp-registry-push openstack-lightspeed-deploy ## Build, push, and deploy the operator on an OCP cluster.
309+
310+
.PHONY: ocp-deploy-cleanup
311+
ocp-deploy-cleanup: IMG = $(OCP_INTERNAL_REGISTRY)/$(OCP_REGISTRY_NAMESPACE)/operator:latest
312+
ocp-deploy-cleanup: BUNDLE_IMG = $(OCP_INTERNAL_REGISTRY)/openshift-marketplace/operator-bundle:$(TAG)
313+
ocp-deploy-cleanup: CATALOG_IMG = $(OCP_INTERNAL_REGISTRY)/openshift-marketplace/operator-catalog:$(TAG)
314+
ocp-deploy-cleanup: openstack-lightspeed-undeploy ## Clean up everything created by ocp-deploy.
315+
oc delete imagestreamtag operator-catalog:$(TAG) -n openshift-marketplace --ignore-not-found=true
316+
oc delete namespace $(OCP_REGISTRY_NAMESPACE) --ignore-not-found=true --wait
317+
302318
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
303319
# $1 - target path with name of binary
304320
# $2 - package url which can be installed

0 commit comments

Comments
 (0)