File tree Expand file tree Collapse file tree 8 files changed +8210
-3309
lines changed
Expand file tree Collapse file tree 8 files changed +8210
-3309
lines changed Original file line number Diff line number Diff line change @@ -124,5 +124,9 @@ lint:
124124# shell linter
125125shellcheck :
126126 hack/make-rules/shellcheck.sh
127+
128+ # Run all the code generators
129+ codegen :
130+ hack/make-rules/codegen.sh
127131# ################################################################################
128132.PHONY : all archeio geranos build unit integration test e2e-test clean update gofmt verify verify-generated lint shellcheck
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- # Copyright 2022 The Kubernetes Authors.
3+ # Copyright 2025 The Kubernetes Authors.
44#
55# Licensed under the Apache License, Version 2.0 (the "License");
66# you may not use this file except in compliance with the License.
1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- # wrapper script so we can go:generate with this tool
18-
17+ # script to run all codegen
1918set -o errexit -o nounset -o pipefail
2019
21- SELF_DIR=" $( dirname " ${BASH_SOURCE[0]} " ) "
22- REPO_ROOT=" $( cd " ${SELF_DIR} /../../../../../.." && pwd -P) "
23- BIN_PATH=" ${REPO_ROOT} /bin/ranges2go"
20+ # cd to the repo root
21+ REPO_ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /../.." & > /dev/null && pwd -P) "
22+ cd " ${REPO_ROOT} "
23+
24+ source hack/tools/setup-go.sh
25+
26+ echo " Downloading AWS & GCP IP ranges data..."
27+ curl -fLo ' pkg/net/cloudcidrs/internal/ranges2go/data/aws-ip-ranges.json' ' https://ip-ranges.amazonaws.com/ip-ranges.json'
28+ curl -fLo ' pkg/net/cloudcidrs/internal/ranges2go/data/gcp-cloud.json' ' https://www.gstatic.com/ipranges/cloud.json'
2429
25- go build -o " ${BIN_PATH} " " ${SELF_DIR} "
26- " ${BIN_PATH} " " $@ "
30+ go generate ./...
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ OUT_FILE="${tmpdir}"/zz_generated_range_data.go
3030export OUT_FILE
3131DATA_DIR=" ${REPO_ROOT} " /pkg/net/cloudcidrs/internal/ranges2go/data
3232export DATA_DIR
33- ./pkg/net/cloudcidrs/internal/ranges2go/run.sh
33+ go run ./pkg/net/cloudcidrs/internal/ranges2go
3434
3535if ! diff " ${OUT_FILE} " ./pkg/net/cloudcidrs/zz_generated_range_data.go; then
3636 >&2 echo " "
37- >&2 echo " generated file is out of date, please run 'go generate ./... ' to regenerate"
37+ >&2 echo " generated file is out of date, please run 'make codegen ' to regenerate"
3838 exit 1
3939fi
Original file line number Diff line number Diff line change @@ -17,4 +17,4 @@ limitations under the License.
1717// cloudcidrs contains Cloud CIDR matching
1818package cloudcidrs
1919
20- //go:generate ./internal/ranges2go/run.sh
20+ //go:generate go run ./internal/ranges2go
You can’t perform that action at this time.
0 commit comments