3
3
# To re-generate a bundle for another specific version without changing the standard setup, you can:
4
4
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
5
5
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
6
- VERSION ?= 0.0.1
6
+ VERSION ?= $(shell git describe --tags --always)
7
+ # Strip off leading `v`: v0.12.0 -> 0.12.0
8
+ # Seems to be idiomatic for chart versions: https://helm.sh/docs/topics/charts/#the-chart-file
9
+ CHART_VERSION := $(shell echo $(VERSION ) | sed 's/^v//')
10
+ CHART_REGISTRY ?= ghcr.io/weaveworks/charts
7
11
8
12
# CHANNELS define the bundle channels used in the bundle.
9
13
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
@@ -29,15 +33,16 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
29
33
#
30
34
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
31
35
# weave.works/cluster-bootstrap-controller-bundle:$VERSION and weave.works/cluster-bootstrap-controller-catalog:$VERSION.
32
- IMAGE_TAG_BASE ?= weaveworks/cluster-bootstrap-controller
36
+ IMAGE_TAG_BASE ?= ghcr.io/ weaveworks/cluster-bootstrap-controller
33
37
34
38
# BUNDLE_IMG defines the image:tag used for the bundle.
35
39
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
36
40
BUNDLE_IMG ?= $(IMAGE_TAG_BASE ) -bundle:v$(VERSION )
37
41
38
42
IMAGE_TAG := $(shell tools/image-tag)
43
+
39
44
# Image URL to use all building/pushing image targets
40
- IMG ?= $(IMAGE_TAG_BASE ) :$(IMAGE_TAG )
45
+ IMG ?= $(IMAGE_TAG_BASE ) :$(VERSION )
41
46
CRD_OPTIONS ?= "crd"
42
47
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
43
48
ENVTEST_K8S_VERSION = 1.25
@@ -99,11 +104,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
99
104
go run ./main.go
100
105
101
106
docker-build : test # # Build docker image with the manager.
102
- docker build \
103
- --build-arg=GITHUB_BUILD_TOKEN=$(GITHUB_BUILD_TOKEN ) \
104
- --build-arg=GITHUB_BUILD_USERNAME=$(GITHUB_BUILD_USERNAME ) \
105
- -t ${IMG} . \
106
-
107
+ docker build -t ${IMG} .
107
108
108
109
docker-push : # # Push docker image with the manager.
109
110
docker push ${IMG}
@@ -130,7 +131,7 @@ controller-gen: ## Download controller-gen locally if necessary.
130
131
131
132
KUSTOMIZE = $(shell pwd) /bin/kustomize
132
133
kustomize : # # Download kustomize locally if necessary.
133
- $(call go-get-tool,$(KUSTOMIZE ) ,sigs.k8s.io/kustomize/kustomize/v3 @v4.5.7)
134
+ $(call go-get-tool,$(KUSTOMIZE ) ,sigs.k8s.io/kustomize/kustomize/v4 @v4.5.7)
134
135
135
136
ENVTEST = $(shell pwd) /bin/setup-envtest
136
137
envtest : # # Download envtest-setup locally if necessary.
@@ -218,3 +219,25 @@ controllers/testdata/crds/cluster.x-k8s.io_clusters.yaml: controllers/testdata/c
218
219
curl https://raw.githubusercontent.com/kubernetes-sigs/cluster-api/v1.0.0/config/crd/bases/cluster.x-k8s.io_clusters.yaml -o controllers/testdata/crds/cluster.x-k8s.io_clusters.yaml
219
220
220
221
download-crds : controllers/testdata/crds/cluster.x-k8s.io_clusters.yaml
222
+
223
+ HELMIFY = $(shell pwd) /bin/helmify
224
+ .PHONY : helmify
225
+ helmify :
226
+ $(call go-get-tool,$(HELMIFY ) ,github.com/arttor/helmify/cmd/[email protected] )
227
+
228
+ .PHONY : helm
229
+ helm : manifests kustomize helmify
230
+ $(KUSTOMIZE ) build config/default | $(HELMIFY ) -crd-dir ../weave-gitops-enterprise/charts/cluster-bootstrap-controller
231
+
232
+ .PHONY : helm-chart
233
+ helm-chart : manifests kustomize helmify
234
+ cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
235
+ $(KUSTOMIZE ) build config/default | $(HELMIFY ) -crd-dir charts/cluster-bootstrap-controller
236
+ echo " fullnameOverride: cluster-bootstrap" >> charts/cluster-bootstrap-controller/values.yaml
237
+ cp LICENSE charts/cluster-bootstrap-controller/LICENSE
238
+ helm lint charts/cluster-bootstrap-controller
239
+ helm package charts/cluster-bootstrap-controller --app-version $(VERSION ) --version $(CHART_VERSION ) --destination /tmp/helm-repo
240
+
241
+ .PHONY : publish-helm-chart
242
+ publish-helm-chart : helm-chart
243
+ helm push /tmp/helm-repo/cluster-bootstrap-controller-${CHART_VERSION} .tgz oci://${CHART_REGISTRY}
0 commit comments