Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 512257c

Browse files
committed
set image
1 parent d8780b0 commit 512257c

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

+137
-83
lines changed

Makefile

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,30 @@
22

33
GIT_VERSION ?= $(shell git log -1 --format="%h")
44
RELEASE_TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
5+
RELEASE_VERSION ?= $(shell cat VERSION)
6+
IS_NEW_RELEASE ?= true
57

8+
# are there uncommitted files?
69
ifneq ($(shell git status --porcelain),)
710
# next is used by GoReleaser as well when --spanshot is set
811
RELEASE_TAG := $(RELEASE_TAG)-next
12+
RELEASE_VERSION := $(RELEASE_VERSION)-dirty
13+
IS_NEW_RELEASE := false
914
endif
1015

16+
# do we consider this to be a valid new release? Or are we working going forward?
17+
ifneq ($(shell git branch --show-current),master)
18+
RELEASE_VERSION := $(RELEASE_VERSION)-next
19+
IS_NEW_RELEASE := false
20+
else
21+
ifeq ($(shell git diff HEAD~1 VERSION),)
22+
RELEASE_VERSION := $(RELEASE_VERSION)-next
23+
IS_NEW_RELEASE := false
24+
endif
25+
endif
26+
27+
VERSION ?= $(RELEASE_VERSION)
28+
1129
# which arches can we support
1230
ARCHES=arm64 amd64
1331

@@ -37,7 +55,8 @@ E2E_FOCUS := "functional tests"
3755
TOOLS_DIR := hack/tools
3856
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
3957
BIN_DIR := bin
40-
TEST_E2E_DIR := test/e2e
58+
TEST_DIR := test
59+
TEST_E2E_DIR := $(TEST_DIR)/e2e
4160

4261
# Binaries.
4362
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
@@ -115,13 +134,13 @@ CORE_URL ?= https://github.com/kubernetes-sigs/cluster-api/releases/download/$(C
115134
# useful function
116135
word-dot = $(word $2,$(subst ., ,$1))
117136

118-
VERSION ?= $(RELEASE_TAG)
119-
VERSION_CONTRACT ?= v1alpha3
120137
VERSION_MAJOR ?= $(call word-dot,$(VERSION),1)
121138
VERSION_MINOR ?= $(call word-dot,$(VERSION),2)
122139

140+
# metadata file to be included in releases
141+
METADATA_YAML ?= metadata.yaml
142+
123143
# actual releases
124-
RELEASE_VERSION ?= $(VERSION)
125144
RELEASE_BASE := out/release/infrastructure-packet
126145
RELEASE_DIR := $(RELEASE_BASE)/$(RELEASE_VERSION)
127146
FULL_RELEASE_DIR := $(realpath .)/$(RELEASE_DIR)
@@ -145,7 +164,6 @@ FULL_MANAGERLESS_MANIFEST := $(FULL_MANAGERLESS_DIR)/infrastructure-components.y
145164
MANAGERLESS_CLUSTERCTLYAML := $(MANAGERLESS_BASE)/clusterctl-$(MANAGERLESS_VERSION).yaml
146165

147166
# templates
148-
METADATA_TEMPLATE ?= templates/metadata-template.yaml
149167
CLUSTERCTL_TEMPLATE ?= templates/clusterctl-template.yaml
150168
CLUSTER_TEMPLATE ?= templates/cluster-template.yaml
151169

@@ -197,10 +215,11 @@ test: generate fmt vet crds
197215
go test ./... -coverprofile cover.out
198216

199217
# Run e2e tests
218+
.PHONY: e2e
200219
e2e:
201220
# This is the name used inside the component.yaml for the container that runs the manager
202221
# The image gets loaded inside kind from ./test/e2e/config/packet-dev.yaml
203-
$(E2E_FLAGS) $(MAKE) -C test/e2e run
222+
$(E2E_FLAGS) $(MAKE) -C $(TEST_E2E_DIR) run
204223

205224
# Build manager binary
206225
manager: $(MANAGER)
@@ -222,11 +241,11 @@ uninstall: crds
222241
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
223242
deploy: crds
224243
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
225-
$(KUSTOMIZE) build config/default | kubectl apply -f -
244+
$(KUSTOMIZE) build config/release | kubectl apply -f -
226245

227246
# Generate manifests e.g. CRD, RBAC etc.
228247
crds: controller-gen
229-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
248+
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/resources/crd/bases
230249

231250
# Run go fmt against code
232251
fmt:
@@ -297,26 +316,27 @@ $(MANAGERLESS_DIR) $(MANAGERLESS_BASE):
297316

298317
.PHONY: semver release-clusterctl release-manifests release $(RELEASE_CLUSTERCTLYAML) $(RELEASE_MANIFEST) $(RELEASE_METADATA) $(RELEASE_CLUSTER_TEMPLATE) $(FULL_RELEASE_CLUSTERCTLYAML)
299318

319+
check-release:
320+
@echo $(IS_NEW_RELEASE)
321+
300322
semver:
301323
ifeq (,$(VERSION))
302-
$(error could not determine version to use from git tag, will not create artifacts)
324+
$(error could not determine version to use from file, will not create artifacts)
303325
endif
326+
@echo "release version $(VERSION)"
304327

305328

306329
manifest: kustomize semver release-manifests release-clusterctl release-cluster-template
307330

308-
release:
309-
goreleaser release --rm-dist --snapshot --skip-publish --debug
310-
311-
release/publish:
312-
goreleaser release --rm-dist
313-
314331
release-manifests: semver $(RELEASE_MANIFEST) $(RELEASE_METADATA) $(RELEASE_CLUSTER_TEMPLATE)
315-
$(RELEASE_MANIFEST): $(RELEASE_DIR) ## Builds the manifests to publish with a release
316-
$(KUSTOMIZE) build config/default > $@
332+
release-version:
333+
KUSTOMIZE_ENABLE_ALPHA_COMMANDS=true $(KUSTOMIZE) config set config/release image-tag $(VERSION)
334+
335+
$(RELEASE_MANIFEST): $(RELEASE_DIR) release-version ## Builds the manifests to publish with a release
336+
$(KUSTOMIZE) build config/release > $@
317337

318-
$(RELEASE_METADATA): semver $(RELEASE_DIR) $(METADATA_TEMPLATE)
319-
cat $(METADATA_TEMPLATE) | sed 's/MAJOR/$(VERSION_MAJOR)/g' | sed 's/MINOR/$(VERSION_MINOR)/g' | sed 's/CONTRACT/$(VERSION_CONTRACT)/g' > $@
338+
$(RELEASE_METADATA): semver $(RELEASE_DIR)
339+
cp $(METADATA_YAML) $@
320340

321341
release-cluster-template: semver $(RELEASE_CLUSTER_TEMPLATE)
322342
$(RELEASE_CLUSTER_TEMPLATE): $(RELEASE_DIR)
@@ -335,8 +355,8 @@ managerless-manifests: semver $(MANAGERLESS_MANIFEST) $(MANAGERLESS_METADATA)
335355
$(MANAGERLESS_MANIFEST): $(MANAGERLESS_DIR)
336356
$(KUSTOMIZE) build config/managerless > $@
337357

338-
$(MANAGERLESS_METADATA): semver $(MANAGERLESS_DIR) $(METADATA_TEMPLATE)
339-
cat $(METADATA_TEMPLATE) | sed 's/MAJOR/$(VERSION_MAJOR)/g' | sed 's/MINOR/$(VERSION_MINOR)/g' | sed 's/CONTRACT/$(VERSION_CONTRACT)/g' > $@
358+
$(MANAGERLESS_METADATA): semver $(MANAGERLESS_DIR)
359+
cp $(METADATA_YAML) $@
340360

341361
managerless-cluster-template: semver $(MANAGERLESS_CLUSTER_TEMPLATE)
342362
$(MANAGERLESS_CLUSTER_TEMPLATE): $(MANAGERLESS_DIR)

README.md

Lines changed: 2 additions & 1 deletion

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.3.0

config/default/manager_image_patch.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

config/kustomization.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

config/managerless/kustomization.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ namespace: cluster-api-provider-packet-system
99
namePrefix: cluster-api-provider-packet-
1010

1111
# Labels to add to all resources and selectors.
12-
#commonLabels:
13-
# someName: someValue
12+
commonLabels:
13+
cluster.x-k8s.io/provider: infrastructure-packet
1414

15-
bases:
16-
- ../crd
17-
- ../rbac
18-
- ../namespace
15+
resources:
16+
- ../resources/crd
17+
- ../resources/rbac
18+
- ../resources/namespace
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
# Adds namespace to all resources.
22
namespace: cluster-api-provider-packet-system
3-
43
# Value of this field is prepended to the
54
# names of all resources, e.g. a deployment named
65
# "wordpress" becomes "alices-wordpress".
76
# Note that it should also match with the prefix (text before '-') of the namespace
87
# field above.
98
namePrefix: cluster-api-provider-packet-
10-
119
# Labels to add to all resources and selectors.
1210
commonLabels:
1311
cluster.x-k8s.io/provider: infrastructure-packet
14-
15-
bases:
16-
- ../crd
17-
- ../rbac
18-
- ../namespace
19-
- ../manager
12+
resources:
13+
- ../resources/crd
14+
- ../resources/rbac
15+
- ../resources/namespace
16+
- ../resources/manager
2017
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2118
# crd/kustomization.yaml
2219
#- ../webhook
2320
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
2421
#- ../certmanager
2522
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2623
#- ../prometheus
27-
24+
images:
25+
- name: packet-controller # images with this name
26+
newTag: v0.3.0 # {"type":"string","x-kustomize":{"setter":{"name":"image-tag","value":"v0.3.0"}}}
27+
newName: packethost/cluster-api-provider-packet # and this name
2828
patchesStrategicMerge:
29-
# Protect the /metrics endpoint by putting it behind auth.
30-
# If you want your controller-manager to expose the /metrics
31-
# endpoint w/o any authn/z, please comment the following line.
29+
# Protect the /metrics endpoint by putting it behind auth.
30+
# If you want your controller-manager to expose the /metrics
31+
# endpoint w/o any authn/z, please comment the following line.
3232
- manager_auth_proxy_patch.yaml
33-
- manager_image_patch.yaml

0 commit comments

Comments
 (0)