@ -2,6 +2,7 @@ package agent
import (
import (
"context"
"context"
"fmt"
"net"
"net"
"os"
"os"
"path/filepath"
"path/filepath"
@ -64,11 +65,19 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
}
}
serviceIPv4 := utilsnet . IsIPv4CIDR ( nodeConfig . AgentConfig . ServiceCIDR )
serviceIPv4 := utilsnet . IsIPv4CIDR ( nodeConfig . AgentConfig . ServiceCIDR )
clusterIPv4 := utilsnet . IsIPv4CIDR ( nodeConfig . AgentConfig . ClusterCIDR )
clusterIPv4 := utilsnet . IsIPv4CIDR ( nodeConfig . AgentConfig . ClusterCIDR )
nodeIPv4 := utilsnet . IsIPv4String ( nodeConfig . AgentConfig . NodeIP )
serviceIPv6 := utilsnet . IsIPv6CIDR ( nodeConfig . AgentConfig . ServiceCIDR )
serviceIPv6 := utilsnet . IsIPv6CIDR ( nodeConfig . AgentConfig . ServiceCIDR )
clusterIPv6 := utilsnet . IsIPv6CIDR ( nodeConfig . AgentConfig . ClusterCIDR )
clusterIPv6 := utilsnet . IsIPv6CIDR ( nodeConfig . AgentConfig . ClusterCIDR )
nodeIPv6 := utilsnet . IsIPv6String ( nodeConfig . AgentConfig . NodeIP )
if ( serviceIPv6 != clusterIPv6 ) || ( dualCluster != dualService ) || ( serviceIPv4 != clusterIPv4 ) {
return fmt . Errorf ( "cluster-cidr: %v and service-cidr: %v, must share the same IP version (IPv4, IPv6 or dual-stack)" , nodeConfig . AgentConfig . ClusterCIDRs , nodeConfig . AgentConfig . ServiceCIDRs )
}
if ( clusterIPv6 != nodeIPv6 ) || ( dualCluster != dualNode ) || ( clusterIPv4 != nodeIPv4 ) {
return fmt . Errorf ( "cluster-cidr: %v and node-ip: %v, must share the same IP version (IPv4, IPv6 or dual-stack)" , nodeConfig . AgentConfig . ClusterCIDRs , nodeConfig . AgentConfig . NodeIPs )
}
enableIPv6 := dualCluster || clusterIPv6
enableIPv4 := dualCluster || clusterIPv4
enableIPv4 := dualCluster || dualService || dualNode || serviceIPv4 || clusterIPv4
enableIPv6 := dualCluster || dualService || dualNode || serviceIPv6 || clusterIPv6
conntrackConfig , err := getConntrackConfig ( nodeConfig )
conntrackConfig , err := getConntrackConfig ( nodeConfig )
if err != nil {
if err != nil {
return errors . Wrap ( err , "failed to validate kube-proxy conntrack configuration" )
return errors . Wrap ( err , "failed to validate kube-proxy conntrack configuration" )