Skip to content

Commit 0435e5b

Browse files
Merge branch 'master' into update-release-docs
* master: update test certs used for pdns (kubernetes-sigs#5902) chore(controller-gen): move tools under go tools (kubernetes-sigs#5878) refactor(source/wrappers): move wrappers logic away from execute file (kubernetes-sigs#5888) chore(deps): bump the dev-dependencies group with 2 updates (kubernetes-sigs#5895) chore(deps): bump renovatebot/github-action (kubernetes-sigs#5890)
2 parents 8756408 + 51c0d90 commit 0435e5b

File tree

17 files changed

+859
-187
lines changed

17 files changed

+859
-187
lines changed

.github/workflows/codeql-analysis.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
# Initializes the CodeQL tools for scanning.
3636
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@v3
37+
uses: github/codeql-action/init@v4
3838
with:
3939
languages: ${{ matrix.language }}
4040
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -46,4 +46,4 @@ jobs:
4646
make build
4747
4848
- name: Perform CodeQL Analysis
49-
uses: github/codeql-action/analyze@v3
49+
uses: github/codeql-action/analyze@v4

.github/workflows/dependency-update.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/[email protected]
1818
# https://github.com/renovatebot/github-action
1919
- name: self-hosted renovate
20-
uses: renovatebot/[email protected].14
20+
uses: renovatebot/[email protected].16
2121
with:
2222
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication
2323
token: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,23 @@
1616
.PHONY: cover cover-html
1717
.DEFAULT_GOAL := build
1818

19+
CONTROLLER_GEN := go tool -modfile=go.tool.mod controller-gen
20+
YQ := go tool -modfile=go.tool.mod yq
21+
YAMLFMT := go tool -modfile=go.tool.mod yamlfmt
22+
1923
cover:
2024
@go test -cover -coverprofile=cover.out -v ./...
2125

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

26-
#? controller-gen: download controller-gen if necessary
27-
controller-gen-install:
28-
@scripts/install-tools.sh --generator
29-
ifeq (, $(shell which controller-gen))
30-
CONTROLLER_GEN=$(GOBIN)/controller-gen
31-
else
32-
CONTROLLER_GEN=$(shell which controller-gen)
33-
endif
30+
#? go-tools: list installed go tools
31+
go-tools:
32+
@echo ">> go tools installed in go.mod"
33+
@go tool -n
34+
@echo ">> go tools installed in go.tool.mod"
35+
@go tool -modfile=go.tool.mod
3436

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

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

6365
#? lint: Run all the linters
6466
.PHONY: lint
6567
lint: licensecheck go-lint oas-lint
6668

6769
#? crd: Generates CRD using controller-gen and copy it into chart
6870
.PHONY: crd
69-
crd: controller-gen-install
70-
${CONTROLLER_GEN} object crd:crdVersions=v1 paths="./endpoint/..."
71-
${CONTROLLER_GEN} object crd:crdVersions=v1 paths="./apis/..." output:crd:stdout | yamlfmt - | yq eval '.' --no-doc --split-exp '"./config/crd/standard/" + .metadata.name + ".yaml"'
72-
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
71+
crd:
72+
$(CONTROLLER_GEN) object crd:crdVersions=v1 paths="./endpoint/..."
73+
$(CONTROLLER_GEN) object crd:crdVersions=v1 paths="./apis/..." output:crd:stdout | \
74+
$(YAMLFMT) - | \
75+
$(YQ) eval '.' --no-doc --split-exp '"./config/crd/standard/" + .metadata.name + ".yaml"'
76+
$(YQ) eval '.metadata.annotations |= with_entries(select(.key | test("kubernetes\.io")))' \
77+
--no-doc --split-exp '"./charts/external-dns/crds/" + .metadata.name + ".yaml"' \
78+
./config/crd/standard/*.yaml
7379

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

110116
build.push/multiarch: ko
111117
KO_DOCKER_REPO=${IMAGE} \
112-
VERSION=${VERSION} \
113-
ko build --tags ${VERSION} --bare --sbom ${IMG_SBOM} \
114-
--image-label org.opencontainers.image.source="https://github.com/kubernetes-sigs/external-dns" \
115-
--image-label org.opencontainers.image.revision=$(shell git rev-parse HEAD) \
116-
--platform=${IMG_PLATFORM} --push=${IMG_PUSH} .
118+
VERSION=${VERSION} \
119+
ko build --tags ${VERSION} --bare --sbom ${IMG_SBOM} \
120+
--image-label org.opencontainers.image.source="https://github.com/kubernetes-sigs/external-dns" \
121+
--image-label org.opencontainers.image.revision=$(shell git rev-parse HEAD) \
122+
--platform=${IMG_PLATFORM} --push=${IMG_PUSH} .
117123

118124
build.image/multiarch:
119125
$(MAKE) IMG_PUSH=false build.push/multiarch

controller/execute.go

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -446,24 +446,14 @@ func buildSource(ctx context.Context, cfg *externaldns.Config) (source.Source, e
446446
if err != nil {
447447
return nil, err
448448
}
449-
// Combine multiple sources into a single, deduplicated source.
450-
combinedSource := wrappers.NewDedupSource(wrappers.NewMultiSource(sources, sourceCfg.DefaultTargets, sourceCfg.ForceDefaultTargets))
451-
cfg.AddSourceWrapper("dedup")
452-
if len(cfg.NAT64Networks) > 0 {
453-
combinedSource, err = wrappers.NewNAT64Source(combinedSource, cfg.NAT64Networks)
454-
if err != nil {
455-
return nil, fmt.Errorf("failed to create NAT64 source wrapper: %w", err)
456-
}
457-
cfg.AddSourceWrapper("nat64")
458-
}
459-
// Filter targets
460-
targetFilter := endpoint.NewTargetNetFilterWithExclusions(cfg.TargetNetFilter, cfg.ExcludeTargetNets)
461-
if targetFilter.IsEnabled() {
462-
combinedSource = wrappers.NewTargetFilterSource(combinedSource, targetFilter)
463-
cfg.AddSourceWrapper("target-filter")
464-
}
465-
combinedSource = wrappers.NewPostProcessor(combinedSource, wrappers.WithTTL(cfg.MinTTL))
466-
return combinedSource, nil
449+
opts := wrappers.NewConfig(
450+
wrappers.WithDefaultTargets(cfg.DefaultTargets),
451+
wrappers.WithForceDefaultTargets(cfg.ForceDefaultTargets),
452+
wrappers.WithNAT64Networks(cfg.NAT64Networks),
453+
wrappers.WithTargetNetFilter(cfg.TargetNetFilter),
454+
wrappers.WithExcludeTargetNets(cfg.ExcludeTargetNets),
455+
wrappers.WithMinTTL(cfg.MinTTL))
456+
return wrappers.WrapSources(sources, opts)
467457
}
468458

469459
// RegexDomainFilter overrides DomainFilter

controller/execute_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,6 @@ func TestBuildSourceWithWrappers(t *testing.T) {
449449
Sources: []string{"fake"},
450450
TargetNetFilter: []string{"10.0.0.0/8"},
451451
},
452-
asserts: func(t *testing.T, cfg *externaldns.Config) {
453-
assert.True(t, cfg.IsSourceWrapperInstrumented("target-filter"))
454-
},
455452
},
456453
{
457454
name: "configuration with nat64 networks",
@@ -460,29 +457,20 @@ func TestBuildSourceWithWrappers(t *testing.T) {
460457
Sources: []string{"fake"},
461458
NAT64Networks: []string{"2001:db8::/96"},
462459
},
463-
asserts: func(t *testing.T, cfg *externaldns.Config) {
464-
assert.True(t, cfg.IsSourceWrapperInstrumented("nat64"))
465-
},
466460
},
467461
{
468462
name: "default configuration",
469463
cfg: &externaldns.Config{
470464
APIServerURL: svr.URL,
471465
Sources: []string{"fake"},
472466
},
473-
asserts: func(t *testing.T, cfg *externaldns.Config) {
474-
assert.True(t, cfg.IsSourceWrapperInstrumented("dedup"))
475-
assert.False(t, cfg.IsSourceWrapperInstrumented("nat64"))
476-
assert.False(t, cfg.IsSourceWrapperInstrumented("target-filter"))
477-
},
478467
},
479468
}
480469

481470
for _, tt := range tests {
482471
t.Run(tt.name, func(t *testing.T) {
483472
_, err := buildSource(t.Context(), tt.cfg)
484473
require.NoError(t, err)
485-
tt.asserts(t, tt.cfg)
486474
})
487475
}
488476
}

endpoint/endpoint.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ type EndpointKey struct {
223223
RecordTTL TTL
224224
}
225225

226+
type ObjectRef = events.ObjectReference
227+
226228
// Endpoint is a high-level way of a connection between a service and an IP
227229
// +kubebuilder:object:generate=true
228230
type Endpoint struct {
@@ -244,7 +246,7 @@ type Endpoint struct {
244246
ProviderSpecific ProviderSpecific `json:"providerSpecific,omitempty"`
245247
// refObject stores reference object
246248
// +optional
247-
refObject *events.ObjectReference
249+
refObject *ObjectRef `json:"-"`
248250
}
249251

250252
// NewEndpoint initialization method to be used to create an endpoint

endpoint/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.tool.mod

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
module sigs.k8s.io/external-dns/tools
2+
3+
go 1.25
4+
5+
tool (
6+
github.com/google/yamlfmt/cmd/yamlfmt
7+
github.com/mikefarah/yq/v4
8+
sigs.k8s.io/controller-tools/cmd/controller-gen
9+
)
10+
11+
require (
12+
github.com/a8m/envsubst v1.4.3 // indirect
13+
github.com/alecthomas/chroma/v2 v2.20.0 // indirect
14+
github.com/alecthomas/participle/v2 v2.1.4 // indirect
15+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
16+
github.com/aymerick/douceur v0.2.0 // indirect
17+
github.com/bahlo/generic-list-go v0.2.0 // indirect
18+
github.com/bmatcuk/doublestar/v4 v4.7.1 // indirect
19+
github.com/buger/jsonparser v1.1.1 // indirect
20+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
21+
github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1 // indirect
22+
github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.4 // indirect
23+
github.com/charmbracelet/colorprofile v0.3.2 // indirect
24+
github.com/charmbracelet/glamour v0.10.0 // indirect
25+
github.com/charmbracelet/harmonica v0.2.0 // indirect
26+
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 // indirect
27+
github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.3 // indirect
28+
github.com/charmbracelet/x/ansi v0.10.1 // indirect
29+
github.com/charmbracelet/x/cellbuf v0.0.14-0.20250505150409-97991a1f17d1 // indirect
30+
github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect
31+
github.com/charmbracelet/x/input v0.3.7 // indirect
32+
github.com/charmbracelet/x/term v0.2.1 // indirect
33+
github.com/charmbracelet/x/windows v0.2.1 // indirect
34+
github.com/dimchansky/utfbom v1.1.1 // indirect
35+
github.com/dlclark/regexp2 v1.11.5 // indirect
36+
github.com/dop251/goja v0.0.0-20250630131328-58d95d85e994 // indirect
37+
github.com/dop251/goja_nodejs v0.0.0-20250409162600-f7acab6894b0 // indirect
38+
github.com/dustin/go-humanize v1.0.1 // indirect
39+
github.com/elliotchance/orderedmap v1.8.0 // indirect
40+
github.com/fatih/color v1.18.0 // indirect
41+
github.com/fsnotify/fsnotify v1.9.0 // indirect
42+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
43+
github.com/go-ini/ini v1.67.0 // indirect
44+
github.com/go-logr/logr v1.4.3 // indirect
45+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
46+
github.com/go-openapi/jsonreference v0.20.2 // indirect
47+
github.com/go-openapi/swag v0.23.0 // indirect
48+
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
49+
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
50+
github.com/gobuffalo/flect v1.0.3 // indirect
51+
github.com/goccy/go-json v0.10.5 // indirect
52+
github.com/goccy/go-yaml v1.18.0 // indirect
53+
github.com/gogo/protobuf v1.3.2 // indirect
54+
github.com/google/gnostic-models v0.7.0 // indirect
55+
github.com/google/go-cmp v0.7.0 // indirect
56+
github.com/google/pprof v0.0.0-20250501235452-c0086092b71a // indirect
57+
github.com/google/uuid v1.6.0 // indirect
58+
github.com/google/yamlfmt v0.17.2 // indirect
59+
github.com/gorilla/css v1.0.1 // indirect
60+
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
61+
github.com/iancoleman/strcase v0.3.0 // indirect
62+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
63+
github.com/jinzhu/copier v0.4.0 // indirect
64+
github.com/josharian/intern v1.0.0 // indirect
65+
github.com/json-iterator/go v1.1.12 // indirect
66+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
67+
github.com/magiconair/properties v1.8.10 // indirect
68+
github.com/mailru/easyjson v0.7.7 // indirect
69+
github.com/mattn/go-colorable v0.1.14 // indirect
70+
github.com/mattn/go-isatty v0.0.20 // indirect
71+
github.com/mattn/go-runewidth v0.0.16 // indirect
72+
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
73+
github.com/mikefarah/yq/v4 v4.47.2 // indirect
74+
github.com/mitchellh/mapstructure v1.5.0 // indirect
75+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
76+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
77+
github.com/muesli/cancelreader v0.2.2 // indirect
78+
github.com/muesli/reflow v0.3.0 // indirect
79+
github.com/muesli/termenv v0.16.0 // indirect
80+
github.com/pb33f/doctor v0.0.39 // indirect
81+
github.com/pb33f/jsonpath v0.1.2 // indirect
82+
github.com/pb33f/libopenapi v0.28.0 // indirect
83+
github.com/pb33f/libopenapi-validator v0.6.3 // indirect
84+
github.com/pb33f/ordered-map/v2 v2.3.0 // indirect
85+
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
86+
github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb // indirect
87+
github.com/pkg/errors v0.9.1 // indirect
88+
github.com/rivo/uniseg v0.4.7 // indirect
89+
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
90+
github.com/sagikazarmark/locafero v0.11.0 // indirect
91+
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
92+
github.com/sasha-s/go-deadlock v0.3.5 // indirect
93+
github.com/segmentio/ksuid v1.0.4 // indirect
94+
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
95+
github.com/sourcegraph/jsonrpc2 v0.2.0 // indirect
96+
github.com/spf13/afero v1.15.0 // indirect
97+
github.com/spf13/cast v1.10.0 // indirect
98+
github.com/spf13/cobra v1.10.1 // indirect
99+
github.com/spf13/pflag v1.0.10 // indirect
100+
github.com/spf13/viper v1.21.0 // indirect
101+
github.com/subosito/gotenv v1.6.0 // indirect
102+
github.com/tliron/commonlog v0.2.19 // indirect
103+
github.com/tliron/glsp v0.2.2 // indirect
104+
github.com/tliron/kutil v0.3.26 // indirect
105+
github.com/x448/float16 v0.8.4 // indirect
106+
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
107+
github.com/yuin/goldmark v1.7.8 // indirect
108+
github.com/yuin/goldmark-emoji v1.0.5 // indirect
109+
github.com/yuin/gopher-lua v1.1.1 // indirect
110+
go.yaml.in/yaml/v2 v2.4.2 // indirect
111+
go.yaml.in/yaml/v3 v3.0.4 // indirect
112+
go.yaml.in/yaml/v4 v4.0.0-rc.2 // indirect
113+
golang.org/x/crypto v0.42.0 // indirect
114+
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
115+
golang.org/x/mod v0.28.0 // indirect
116+
golang.org/x/net v0.44.0 // indirect
117+
golang.org/x/sync v0.17.0 // indirect
118+
golang.org/x/sys v0.36.0 // indirect
119+
golang.org/x/term v0.35.0 // indirect
120+
golang.org/x/text v0.29.0 // indirect
121+
golang.org/x/tools v0.37.0 // indirect
122+
google.golang.org/protobuf v1.36.7 // indirect
123+
gopkg.in/inf.v0 v0.9.1 // indirect
124+
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 // indirect
125+
gopkg.in/yaml.v2 v2.4.0 // indirect
126+
gopkg.in/yaml.v3 v3.0.1 // indirect
127+
k8s.io/api v0.34.0 // indirect
128+
k8s.io/apiextensions-apiserver v0.34.0 // indirect
129+
k8s.io/apimachinery v0.34.0 // indirect
130+
k8s.io/code-generator v0.34.0 // indirect
131+
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
132+
k8s.io/klog/v2 v2.130.1 // indirect
133+
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
134+
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
135+
sigs.k8s.io/controller-tools v0.17.2 // indirect
136+
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
137+
sigs.k8s.io/randfill v1.0.0 // indirect
138+
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
139+
sigs.k8s.io/yaml v1.6.0 // indirect
140+
)

0 commit comments

Comments
 (0)