Skip to content

Commit 90e5d0d

Browse files
authored
build: Add files for clusterctl compatibility (#284)
Following clusterctl provider docs.
1 parent cd4aed1 commit 90e5d0d

File tree

5 files changed

+48
-12
lines changed

5 files changed

+48
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ node_modules/
3838
.hugo_build.lock
3939

4040
/cluster.yaml
41+
/runtime-extension-components.yaml

.goreleaser.yml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ release:
2424
**Full Changelog**: https://github.com/d2iq-labs/{{.ProjectName}}/compare/{{ .PreviousTag }}...{{ .Tag }}
2525
extra_files:
2626
- glob: ./examples/capi-quick-start/*.yaml
27+
- glob: metadata.yaml
28+
- glob: runtime-extension-components.yaml
29+
30+
before:
31+
hooks:
32+
- |
33+
sh -ec 'if [ {{ .IsSnapshot }} != true ]; then
34+
cat <<EOF > runtime-extension-components.yaml
35+
apiVersion: v1
36+
kind: Namespace
37+
metadata:
38+
name: capi-runtime-extensions-system
39+
$(helm template capi-runtime-extensions ./charts/capi-runtime-extensions \
40+
--namespace capi-runtime-extensions-system \
41+
--set-string image.tag={{ .Version }} \
42+
)
43+
EOF
44+
fi'
2745
2846
builds:
2947
- id: capi-runtime-extensions
@@ -49,21 +67,24 @@ builds:
4967
- arm64
5068
mod_timestamp: '{{ .CommitTimestamp }}'
5169
hooks:
52-
post: |
53-
sh -ec 'if [ {{ .IsSnapshot }} == true ] && [ {{ .Runtime.Goarch }} == {{ .Arch }} ]; then
54-
env GOOS=linux GOARCH={{ .Arch }} \
55-
SOURCE_DATE_EPOCH=$(date +%s) \
56-
KO_DOCKER_REPO=ko.local/capi-runtime-extensions \
57-
ko build \
58-
--bare \
59-
-t {{ .Version }} \
60-
./cmd
61-
fi'
70+
post:
71+
- |
72+
sh -ec 'if [ {{ .IsSnapshot }} == true ] && [ {{ .Runtime.Goarch }} == {{ .Arch }} ]; then
73+
env GOOS=linux GOARCH={{ .Arch }} \
74+
SOURCE_DATE_EPOCH=$(date +%s) \
75+
KO_DOCKER_REPO=ko.local/capi-runtime-extensions \
76+
ko build \
77+
--bare \
78+
-t {{ .Version }} \
79+
./cmd
80+
fi'
81+
6282
archives:
6383
- name_template: '{{ .ProjectName }}_v{{trimprefix .Version "v"}}_{{ .Os }}_{{ .Arch }}'
6484
rlcp: true
6585
builds:
6686
- capi-runtime-extensions
87+
6788
kos:
6889
- id: capi-runtime-extensions
6990
build: capi-runtime-extensions
@@ -90,7 +111,9 @@ kos:
90111
bare: true
91112
tags:
92113
- v{{trimprefix .Version "v"}}
114+
93115
checksum:
94116
name_template: 'checksums.txt'
117+
95118
snapshot:
96119
name_template: "{{ incminor .Tag }}-dev"

charts/capi-runtime-extensions/templates/_helpers.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Common labels
2020
app.kubernetes.io/name: {{ include "chart.name" . }}
2121
helm.sh/chart: {{ include "chart.fullname" . }}
2222
app.kubernetes.io/instance: {{ .Release.Name }}
23+
cluster.x-k8s.io/provider: runtime-extensions-d2iq-labs
2324
{{- if .Chart.AppVersion }}
2425
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
2526
{{- end }}

make/goreleaser.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ build-snapshot: dockerauth go-generate ; $(info $(M) building snapshot $*)
1616
--snapshot \
1717
--clean \
1818
--parallelism=$(GORELEASER_PARALLELISM) \
19-
$(if $(BUILD_ALL),,--single-target) \
20-
--skip-post-hooks
19+
$(if $(BUILD_ALL),,--single-target)
2120

2221
.PHONY: release
2322
release: ## Builds a release with goreleaser

metadata.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2024 D2iQ, Inc. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
5+
kind: Metadata
6+
releaseSeries:
7+
- major: 0
8+
minor: 2
9+
contract: v1beta1
10+
- major: 0
11+
minor: 3
12+
contract: v1beta1

0 commit comments

Comments
 (0)