Skip to content

Commit

Permalink
s/prefer-ipv6/enable-ipv6
Browse files Browse the repository at this point in the history
  • Loading branch information
alpeb committed Apr 23, 2024
1 parent 6735950 commit 81e1b4e
Show file tree
Hide file tree
Showing 22 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion charts/linkerd-control-plane/templates/destination.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ spec:
- -identity-trust-domain={{.Values.identityTrustDomain | default .Values.clusterDomain}}
- -default-opaque-ports={{.Values.proxy.opaquePorts}}
- -enable-pprof={{.Values.enablePprof | default false}}
- -prefer-ipv6={{not .Values.disableIPv6}}
- -enable-ipv6={{not .Values.disableIPv6}}
{{- range (.Values.destinationController).additionalArgs }}
- {{ . }}
{{- end }}
Expand Down

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_custom_domain.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_custom_registry.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_default.golden

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

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_default_token.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_ha_output.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_ha_with_overrides_output.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_heartbeat_disabled_output.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_helm_control_plane_output.golden

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

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_helm_output_ha_labels.golden

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

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_no_init_container.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_output.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_proxy_ignores.golden

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

2 changes: 1 addition & 1 deletion cli/cmd/testdata/install_values_file.golden

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

18 changes: 9 additions & 9 deletions controller/api/destination/endpoint_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type (

enableH2Upgrade,
enableEndpointFiltering,
preferIPv6,
enableIPv6,

extEndpointZoneWeights bool

Expand Down Expand Up @@ -84,7 +84,7 @@ func newEndpointTranslator(
identityTrustDomain string,
enableH2Upgrade,
enableEndpointFiltering,
preferIPv6,
enableIPv6,
extEndpointZoneWeights bool,
service string,
srcNodeName string,
Expand Down Expand Up @@ -115,7 +115,7 @@ func newEndpointTranslator(
defaultOpaquePorts,
enableH2Upgrade,
enableEndpointFiltering,
preferIPv6,
enableIPv6,
extEndpointZoneWeights,
availableEndpoints,
filteredSnapshot,
Expand Down Expand Up @@ -352,11 +352,11 @@ func (et *endpointTranslator) diffEndpoints(filtered watcher.AddressSet) (watche
continue
}

if id.IPFamily == corev1.IPv6Protocol && !et.preferIPv6 {
if id.IPFamily == corev1.IPv6Protocol && !et.enableIPv6 {
continue
}

if id.IPFamily == corev1.IPv4Protocol && et.preferIPv6 {
if id.IPFamily == corev1.IPv4Protocol && et.enableIPv6 {
// Only consider IPv4 address for which there's not already an IPv6 alternative
if altID, _ := et.altFamily(id, corev1.IPv6Protocol); altID != nil {
skipped[id] = new
Expand All @@ -368,7 +368,7 @@ func (et *endpointTranslator) diffEndpoints(filtered watcher.AddressSet) (watche
}

// Remove IPv4 alternatives when an IPv6 one appears
if et.preferIPv6 {
if et.enableIPv6 {
for id := range add {
if id.IPFamily != corev1.IPv6Protocol {
continue
Expand All @@ -388,11 +388,11 @@ func (et *endpointTranslator) diffEndpoints(filtered watcher.AddressSet) (watche
continue
}

if id.IPFamily == corev1.IPv6Protocol && !et.preferIPv6 {
if id.IPFamily == corev1.IPv6Protocol && !et.enableIPv6 {
continue
}

if id.IPFamily == corev1.IPv4Protocol && et.preferIPv6 {
if id.IPFamily == corev1.IPv4Protocol && et.enableIPv6 {
// Only consider IPv4 address for which there's not already an IPv6 alternative
if altID, _ := et.altFamily(id, corev1.IPv6Protocol); altID != nil {
continue
Expand All @@ -401,7 +401,7 @@ func (et *endpointTranslator) diffEndpoints(filtered watcher.AddressSet) (watche

remove[id] = address

if id.IPFamily == corev1.IPv6Protocol && et.preferIPv6 {
if id.IPFamily == corev1.IPv6Protocol && et.enableIPv6 {
// Add IPv4 alternative, if any
if altID, addr := et.altFamily(id, corev1.IPv4Protocol); altID != nil {
add[*altID] = *addr
Expand Down
6 changes: 3 additions & 3 deletions controller/api/destination/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type (

EnableH2Upgrade,
EnableEndpointSlices,
PreferIPv6,
EnableIPv6,
ExtEndpointZoneWeights bool

DefaultOpaquePorts map[uint32]struct{}
Expand Down Expand Up @@ -187,7 +187,7 @@ func (s *server) Get(dest *pb.GetDestination, stream pb.Destination_GetServer) e
remoteConfig.TrustDomain,
s.config.EnableH2Upgrade,
false, // Disable endpoint filtering for remote discovery.
s.config.PreferIPv6,
s.config.EnableIPv6,
s.config.ExtEndpointZoneWeights,
fmt.Sprintf("%s.%s.svc.%s:%d", remoteSvc, service.Namespace, remoteConfig.ClusterDomain, port),
token.NodeName,
Expand Down Expand Up @@ -219,7 +219,7 @@ func (s *server) Get(dest *pb.GetDestination, stream pb.Destination_GetServer) e
s.config.IdentityTrustDomain,
s.config.EnableH2Upgrade,
true,
s.config.PreferIPv6,
s.config.EnableIPv6,
s.config.ExtEndpointZoneWeights,
dest.GetPath(),
token.NodeName,
Expand Down
2 changes: 1 addition & 1 deletion controller/api/destination/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ spec:
pb.UnimplementedDestinationServer{},
Config{
EnableH2Upgrade: true,
PreferIPv6: true,
EnableIPv6: true,
ControllerNS: "linkerd",
ClusterDomain: "mycluster.local",
IdentityTrustDomain: "trust.domain",
Expand Down
8 changes: 4 additions & 4 deletions controller/cmd/destination/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func Main(args []string) {
"Enable transparently upgraded HTTP2 connections among pods in the service mesh")
enableEndpointSlices := cmd.Bool("enable-endpoint-slices", true,
"Enable the usage of EndpointSlice informers and resources")
preferIPv6 := cmd.Bool("prefer-ipv6", true,
"Set to true to prefer exposing IPv6 endpoints over IPv4 ones; requires enable-endpoint-slices=true")
enableIPv6 := cmd.Bool("enable-ipv6", true,
"Set to true to allow discovering IPv6 endpoints and preferring IPv6 when both IPv4 and IPv6 are available")
trustDomain := cmd.String("identity-trust-domain", "", "configures the name suffix used for identities")
clusterDomain := cmd.String("cluster-domain", "", "kubernetes cluster domain")
defaultOpaquePorts := cmd.String("default-opaque-ports", "", "configures the default opaque ports")
Expand All @@ -54,7 +54,7 @@ func Main(args []string) {

flags.ConfigureAndParse(cmd, args)

if *preferIPv6 && !*enableEndpointSlices {
if *enableIPv6 && !*enableEndpointSlices {
log.Fatal("If --prefer-ipv6=true then --enable-endpoint-slices needs to be true")
}

Expand Down Expand Up @@ -155,7 +155,7 @@ func Main(args []string) {
DefaultOpaquePorts: opaquePorts,
EnableH2Upgrade: *enableH2Upgrade,
EnableEndpointSlices: *enableEndpointSlices,
PreferIPv6: *preferIPv6,
EnableIPv6: *enableIPv6,
ExtEndpointZoneWeights: *extEndpointZoneWeights,
}
server, err := destination.NewServer(
Expand Down

0 comments on commit 81e1b4e

Please sign in to comment.