Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 30 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@
.PHONY: cover cover-html
.DEFAULT_GOAL := build

CONTROLLER_GEN := go tool -modfile=go.tool.mod controller-gen
YQ := go tool -modfile=go.tool.mod yq
YAMLFMT := go tool -modfile=go.tool.mod yamlfmt

cover:
@go test -cover -coverprofile=cover.out -v ./...

#? cover-html: Run tests with coverage and open coverage report in the browser
cover-html: cover
@go tool cover -html=cover.out

#? controller-gen: download controller-gen if necessary
controller-gen-install:
@scripts/install-tools.sh --generator
ifeq (, $(shell which controller-gen))
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif
#? go-tools: list installed go tools
go-tools:
@echo ">> go tools installed in go.mod"
@go tool -n
@echo ">> go tools installed in go.tool.mod"
@go tool -modfile=go.tool.mod

#? golangci-lint-install: Install golangci-lint tool
golangci-lint-install:
Expand All @@ -48,28 +50,32 @@ go-lint: golangci-lint-install
licensecheck:
@echo ">> checking license header"
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
awk 'NR<=5' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
done); \
if [ -n "$${licRes}" ]; then \
echo "license header checking failed:"; echo "$${licRes}"; \
exit 1; \
fi
awk 'NR<=5' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
done); \
if [ -n "$${licRes}" ]; then \
echo "license header checking failed:"; echo "$${licRes}"; \
exit 1; \
fi

#? oas-lint: Execute OpenAPI Specification (OAS) linting https://quobix.com/vacuum/
.PHONY: go-lint
oas-lint:
go tool vacuum lint -d --fail-severity warn api/*.yaml
go tool -modfile=go.tool.mod vacuum lint -d --fail-severity warn api/*.yaml

#? lint: Run all the linters
.PHONY: lint
lint: licensecheck go-lint oas-lint

#? crd: Generates CRD using controller-gen and copy it into chart
.PHONY: crd
crd: controller-gen-install
${CONTROLLER_GEN} object crd:crdVersions=v1 paths="./endpoint/..."
${CONTROLLER_GEN} object crd:crdVersions=v1 paths="./apis/..." output:crd:stdout | yamlfmt - | yq eval '.' --no-doc --split-exp '"./config/crd/standard/" + .metadata.name + ".yaml"'
yq eval '.metadata.annotations |= with_entries(select(.key | test("kubernetes\.io")))' --no-doc --split-exp '"./charts/external-dns/crds/" + .metadata.name + ".yaml"' ./config/crd/standard/*.yaml
crd:
$(CONTROLLER_GEN) object crd:crdVersions=v1 paths="./endpoint/..."
$(CONTROLLER_GEN) object crd:crdVersions=v1 paths="./apis/..." output:crd:stdout | \
$(YAMLFMT) - | \
$(YQ) eval '.' --no-doc --split-exp '"./config/crd/standard/" + .metadata.name + ".yaml"'
$(YQ) eval '.metadata.annotations |= with_entries(select(.key | test("kubernetes\.io")))' \
--no-doc --split-exp '"./charts/external-dns/crds/" + .metadata.name + ".yaml"' \
./config/crd/standard/*.yaml

#? test: The verify target runs tasks similar to the CI tasks, but without code coverage
.PHONY: test
Expand Down Expand Up @@ -109,11 +115,11 @@ build/$(BINARY): $(SOURCES)

build.push/multiarch: ko
KO_DOCKER_REPO=${IMAGE} \
VERSION=${VERSION} \
ko build --tags ${VERSION} --bare --sbom ${IMG_SBOM} \
--image-label org.opencontainers.image.source="https://github.com/kubernetes-sigs/external-dns" \
--image-label org.opencontainers.image.revision=$(shell git rev-parse HEAD) \
--platform=${IMG_PLATFORM} --push=${IMG_PUSH} .
VERSION=${VERSION} \
ko build --tags ${VERSION} --bare --sbom ${IMG_SBOM} \
--image-label org.opencontainers.image.source="https://github.com/kubernetes-sigs/external-dns" \
--image-label org.opencontainers.image.revision=$(shell git rev-parse HEAD) \
--platform=${IMG_PLATFORM} --push=${IMG_PUSH} .

build.image/multiarch:
$(MAKE) IMG_PUSH=false build.push/multiarch
Expand Down
4 changes: 3 additions & 1 deletion endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ type EndpointKey struct {
RecordTTL TTL
}

type ObjectRef = events.ObjectReference

// Endpoint is a high-level way of a connection between a service and an IP
// +kubebuilder:object:generate=true
type Endpoint struct {
Expand All @@ -244,7 +246,7 @@ type Endpoint struct {
ProviderSpecific ProviderSpecific `json:"providerSpecific,omitempty"`
// refObject stores reference object
// +optional
refObject *events.ObjectReference
refObject *ObjectRef `json:"-"`
}

// NewEndpoint initialization method to be used to create an endpoint
Expand Down
7 changes: 7 additions & 0 deletions endpoint/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

140 changes: 140 additions & 0 deletions go.tool.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
module sigs.k8s.io/external-dns/tools

go 1.25

tool (
github.com/google/yamlfmt/cmd/yamlfmt
github.com/mikefarah/yq/v4
sigs.k8s.io/controller-tools/cmd/controller-gen
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have a version set here ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the v0.17.2 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is just my understing

The selected lines in go.tool.mod list tools without versions because, in a Go toolchain file, the tool block specifies the import paths of command-line tools to be installed, not their versions. The actual versions are managed in the require block below, which ensures the correct versions are used when the tools are installed. This separation keeps the tool list clean and version management centralized.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example for vacuum

tool github.com/daveshanley/vacuum

and version is managed
Screenshot 2025-10-01 at 16 01 41

github.com/daveshanley/vacuum v0.17.8 // indirect

Copy link
Contributor Author

@ivankatliarchuk ivankatliarchuk Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another tool example
Screenshot 2025-10-01 at 16 07 02

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll pin similar question mattermost/mattermost-plugin-starter-template#217 (comment). There are multiple links to read trhough pros/cons if you have spare time.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me also it's not a blocker, just weird.

)

require (
github.com/a8m/envsubst v1.4.3 // indirect
github.com/alecthomas/chroma/v2 v2.20.0 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.7.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1 // indirect
github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.4 // indirect
github.com/charmbracelet/colorprofile v0.3.2 // indirect
github.com/charmbracelet/glamour v0.10.0 // indirect
github.com/charmbracelet/harmonica v0.2.0 // indirect
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 // indirect
github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.3 // indirect
github.com/charmbracelet/x/ansi v0.10.1 // indirect
github.com/charmbracelet/x/cellbuf v0.0.14-0.20250505150409-97991a1f17d1 // indirect
github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect
github.com/charmbracelet/x/input v0.3.7 // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/charmbracelet/x/windows v0.2.1 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/dop251/goja v0.0.0-20250630131328-58d95d85e994 // indirect
github.com/dop251/goja_nodejs v0.0.0-20250409162600-f7acab6894b0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elliotchance/orderedmap v1.8.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/gobuffalo/flect v1.0.3 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/goccy/go-yaml v1.18.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20250501235452-c0086092b71a // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/google/yamlfmt v0.17.2 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jinzhu/copier v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.10 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
github.com/mikefarah/yq/v4 v4.47.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/pb33f/doctor v0.0.39 // indirect
github.com/pb33f/jsonpath v0.1.2 // indirect
github.com/pb33f/libopenapi v0.28.0 // indirect
github.com/pb33f/libopenapi-validator v0.6.3 // indirect
github.com/pb33f/ordered-map/v2 v2.3.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/sasha-s/go-deadlock v0.3.5 // indirect
github.com/segmentio/ksuid v1.0.4 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/sourcegraph/jsonrpc2 v0.2.0 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/cobra v1.10.1 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spf13/viper v1.21.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tliron/commonlog v0.2.19 // indirect
github.com/tliron/glsp v0.2.2 // indirect
github.com/tliron/kutil v0.3.26 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yuin/goldmark v1.7.8 // indirect
github.com/yuin/goldmark-emoji v1.0.5 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
go.yaml.in/yaml/v4 v4.0.0-rc.2 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
golang.org/x/mod v0.28.0 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/term v0.35.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/tools v0.37.0 // indirect
google.golang.org/protobuf v1.36.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.34.0 // indirect
k8s.io/apiextensions-apiserver v0.34.0 // indirect
k8s.io/apimachinery v0.34.0 // indirect
k8s.io/code-generator v0.34.0 // indirect
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
sigs.k8s.io/controller-tools v0.17.2 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
Loading
Loading