-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile.maker.yaml
More file actions
239 lines (192 loc) · 8.59 KB
/
Makefile.maker.yaml
File metadata and controls
239 lines (192 loc) · 8.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# Configuration file for <https://github.com/ironcore-dev/network-operator>
metadata:
url: https://github.com/ironcore-dev/network-operator
binaries:
- name: network-operator
fromPackage: ./cmd
installTo: bin/
controllerGen:
enabled: true
crdOutputPath: config/crd/bases
objectHeaderFile: hack/boilerplate.go.txt
applyconfigurationHeaderFile: hack/boilerplate.go.txt
rbacRoleName: manager-role
coverageTest:
only: "/internal"
dockerfile:
# Custom Dockerfile using Distroless base image
enabled: false
golang:
setGoModVersion: true
golangciLint:
createConfig: true
skipDirs:
- internal/provider/openconfig
timeout: 10m
goReleaser:
createConfig: true
license:
addHeaders: true
checkDependencies: true
copyright: 'SAP SE or an SAP affiliate company and IronCore contributors'
spdx: Apache-2.0
reuse:
# Custom REUSE.toml with minimal settings
enabled: false
renovate:
enabled: true
assignees:
- felix-kaestner
testPackages:
except: '/test'
githubWorkflow:
global:
defaultBranch: main
ci:
enabled: true
prepareMakeTarget: generate
license:
enabled: true
release:
enabled: true
securityChecks:
enabled: true
pushContainerToGhcr:
enabled: true
platforms: "linux/amd64,linux/arm64"
tagStrategy:
- edge
- latest
- semver
- sha
variables:
GO_BUILDENV: 'CGO_ENABLED=0'
verbatim: |
# Image to use all building/pushing image targets
IMG ?= controller:latest
# CONTAINER_TOOL defines the container tool to be used for building images.
# The default is docker, but it can be overridden to use other tools (i.e. podman or nerdctl).
CONTAINER_TOOL ?= docker
# KIND_CLUSTER defines the name of the Kind cluster to be used for the tilt setup.
KIND_CLUSTER ?= network
install-gofumpt: FORCE
@if ! hash gofumpt 2>/dev/null; then printf "\e[1;36m>> Installing gofumpt...\e[0m\n"; go install mvdan.cc/gofumpt@latest; fi
install-kubebuilder: FORCE
@if ! hash kubebuilder 2>/dev/null; then printf "\e[1;36m>> Installing kubebuilder...\e[0m\n"; go install sigs.k8s.io/kubebuilder/v4@v4.10.1; fi
install-kustomize: FORCE
@if ! hash kustomize 2>/dev/null; then printf "\e[1;36m>> Installing kustomize...\e[0m\n"; go install sigs.k8s.io/kustomize/kustomize/v5@latest; fi
install-crd-ref-docs: FORCE
@if ! hash crd-ref-docs 2>/dev/null; then printf "\e[1;36m>> Installing crd-ref-docs...\e[0m\n"; go install github.com/elastic/crd-ref-docs@latest; fi
fmt: FORCE install-gofumpt
@printf "\e[1;36m>> gofumpt -l -w .\e[0m\n"
@gofumpt -l -w $(shell git ls-files '*.go' | grep -v '^internal/provider/openconfig')
# Run the e2e tests against a k8s cluster.
test-e2e: FORCE
@command -v kind >/dev/null 2>&1 || { \
echo "Kind is not installed. Please install Kind manually."; \
exit 1; \
}
@kind get clusters | grep -q $(KIND_CLUSTER) || { \
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
exit 1; \
}
@printf "\e[1;36m>> go test ./test/e2e/ -v -ginkgo.v\e[0m\n"
@KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v
docker-build: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(IMG) .\e[0m\n"
@$(CONTAINER_TOOL) build --build-arg=BININFO_BUILD_DATE=$(BININFO_BUILD_DATE) --build-arg=BININFO_COMMIT_HASH=$(BININFO_COMMIT_HASH) --build-arg=BININFO_VERSION=$(BININFO_VERSION) --tag=$(IMG) .
docker-push: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) push $(IMG)\e[0m\n"
@$(CONTAINER_TOOL) push $(IMG)
# Generate a consolidated YAML with CRDs and deployment.
build-installer: FORCE generate install-kustomize
@printf "\e[1;36m>> kustomize build config/default > dist/install.yaml\e[0m\n"
@mkdir -p dist; kustomize build config/default > dist/install.yaml
# Deploy controller to the k8s cluster
deploy: FORCE generate install-kustomize
@printf "\e[1;36m>> kustomize build config/default | kubectl apply -f -\e[0m\n"
@kustomize build config/default | kubectl apply -f -
# Undeploy controller from the k8s cluster
undeploy: FORCE install-kustomize
@printf "\e[1;36m>> kustomize build config/default | kubectl delete -f -\e[0m\n"
@kustomize build config/default | kubectl delete --ignore-not-found=true -f -
# Install CRDs into the k8s cluster
deploy-crds: FORCE generate install-kustomize
@printf "\e[1;36m>> kustomize build config/crd | kubectl apply -f -\e[0m\n"
@kustomize build config/crd | kubectl apply -f -
# Uninstall CRDs from the k8s cluster
undeploy-crds: FORCE install-kustomize
@printf "\e[1;36m>> kustomize build config/crd | kubectl delete -f -\e[0m\n"
@kustomize build config/crd | kubectl delete --ignore-not-found=true -f -
# Create a Kind cluster for local development and testing.
kind-create: FORCE
@command -v kind >/dev/null 2>&1 || { \
echo "Kind is not installed. Please install Kind manually."; \
exit 1; \
}
@kind get clusters | grep -q $(KIND_CLUSTER) || { \
printf "\e[1;36m>> kind create cluster --name=$(KIND_CLUSTER)\e[0m\n"; \
kind create cluster --name=$(KIND_CLUSTER); \
}
# Delete the Kind cluster created for local development and testing.
kind-delete: FORCE
@command -v kind >/dev/null 2>&1 || { \
echo "Kind is not installed. Please install Kind manually."; \
exit 1; \
}
@printf "\e[1;36m>> kind delete cluster --name=$(KIND_CLUSTER)\e[0m\n"
@kind delete cluster --name=$(KIND_CLUSTER)
tilt-up: FORCE kind-create
@command -v tilt >/dev/null 2>&1 || { \
echo "Tilt is not installed. Please install Tilt manually."; \
exit 1; \
}
@printf "\e[1;36m>> tilt up --context kind-$(KIND_CLUSTER)\e[0m\n"
@tilt up --context kind-$(KIND_CLUSTER)
manifests: generate
# Generate manifests e.g. CRD, RBAC etc.
charts: FORCE install-kubebuilder generate
@printf "\e[1;36m>> kubebuilder edit --plugins=helm/v2-alpha\e[0m\n"
@mv charts/network-operator charts/chart
@kubebuilder edit --plugins=helm/v2-alpha --output-dir=charts
@mv charts/chart charts/network-operator && rm -rf dist
netop-provider:
@printf "\e[1;36m>> go build -o build/netop-provider ./hack/provider\e[0m\n"
@go build -o build/netop-provider ./hack/provider
@printf "\e[1;36m>> ./build/netop-provider --help\e[0m\n"
@./build/netop-provider --help
TEST_SERVER_IMG ?= ghcr.io/ironcore-dev/gnmi-test-server:latest
docker-build-test-gnmi-server: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --tag=$(TEST_SERVER_IMG) ./test/gnmi\e[0m\n"
@$(CONTAINER_TOOL) build --tag=$(TEST_SERVER_IMG) ./test/gnmi
docker-run-test-gnmi-server: FORCE docker-build-test-gnmi-server
@printf "\e[1;36m>> $(CONTAINER_TOOL) run -p 8000:8000 -p 9339:9339 $(TEST_SERVER_IMG)\e[0m\n"
@$(CONTAINER_TOOL) run --rm -p 8000:8000 -p 9339:9339 $(TEST_SERVER_IMG)
# TEST_LAB_IMG defines the image to used for packaging the lab tests.
TEST_LAB_IMG ?= ghcr.io/ironcore-dev/network-operator-lab-test:latest
test-lab: FORCE
@printf "\e[1;36m>> go test ./test/lab/ -v\e[0m\n"
@go test ./test/lab/ -v
docker-build-test-lab: FORCE
@printf "\e[1;36m>> $(CONTAINER_TOOL) build --file=test/lab/Dockerfile --tag=$(TEST_LAB_IMG) .\e[0m\n"
@$(CONTAINER_TOOL) build --file=test/lab/Dockerfile --tag=$(TEST_LAB_IMG) .
docker-push-test-lab: FORCE docker-push-test-lab
@printf "\e[1;36m>> $(CONTAINER_TOOL) push $(TEST_LAB_IMG)\e[0m\n"
@$(CONTAINER_TOOL) push $(TEST_LAB_IMG)
ROOT_DIR := $(shell pwd)
DOCS_IMG ?= ironcore-dev/network-operator-docs:latest
run-docs:
@docker build -t $(DOCS_IMG) -f docs/Dockerfile docs --load
@docker run --rm --init -p 5173:5173 -v $(ROOT_DIR)/docs:/workspace -v /workspace/node_modules $(DOCS_IMG)
docs: install-crd-ref-docs provider-matrix
crd-ref-docs --source-path=./api --config=./hack/api-reference/config.yaml --renderer=markdown --output-path=./docs/api-reference/index.md
@$(SED) -i \
-e 's/#networkingmetalironcoredevv1alpha1/#networking-metal-ironcore-dev-v1alpha1/g' \
-e 's/#nxcisconetworkingmetalironcoredevv1alpha1/#nx-cisco-networking-metal-ironcore-dev-v1alpha1/g' \
-e 's/#xecisconetworkingmetalironcoredevv1alpha1/#xe-cisco-networking-metal-ironcore-dev-v1alpha1/g' \
-e 's/#xrcisconetworkingmetalironcoredevv1alpha1/#xr-cisco-networking-metal-ironcore-dev-v1alpha1/g' \
docs/api-reference/index.md
# Generate provider implementation matrix
provider-matrix: FORCE
@printf "\e[1;36m>> go run ./hack/generate-provider-matrix.go > docs/provider-compatibility.md\e[0m\n"
@go run ./hack/generate-provider-matrix.go > docs/provider-compatibility.md