istio.io/istio@v0.0.0-20240520182934-d79c90f27776/cni/pkg/nodeagent/options.go (about)

     1  // Copyright Istio Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package nodeagent
    16  
    17  import (
    18  	"net/netip"
    19  
    20  	"istio.io/istio/pkg/config/constants"
    21  	"istio.io/istio/pkg/env"
    22  )
    23  
    24  var (
    25  	PodNamespace      = env.RegisterStringVar("POD_NAMESPACE", "", "pod's namespace").Get()
    26  	SystemNamespace   = env.RegisterStringVar("SYSTEM_NAMESPACE", constants.IstioSystemNamespace, "istio system namespace").Get()
    27  	PodName           = env.RegisterStringVar("POD_NAME", "", "").Get()
    28  	NodeName          = env.RegisterStringVar("NODE_NAME", "", "").Get()
    29  	Revision          = env.RegisterStringVar("REVISION", "", "").Get()
    30  	HostProbeSNATIP   = netip.MustParseAddr(env.RegisterStringVar("HOST_PROBE_SNAT_IP", DefaultHostProbeSNATIP, "").Get())
    31  	HostProbeSNATIPV6 = netip.MustParseAddr(env.RegisterStringVar("HOST_PROBE_SNAT_IPV6", DefaultHostProbeSNATIPV6, "").Get())
    32  )
    33  
    34  const (
    35  	// to reliably identify kubelet healthprobes from inside the pod (versus standard kube-proxy traffic,
    36  	// since the IP is normally the same), we SNAT identified host probes in the host netns to a fixed
    37  	// APIPA/"link-local" IP.
    38  	//
    39  	// It doesn't matter what this IP is, so long as it's not routable and doesn't collide with anything else.
    40  	//
    41  	// IPv6 link local ranges are designed to be collision-resistant by default, and so probably never need to be overridden
    42  	DefaultHostProbeSNATIP   = "169.254.7.127"
    43  	DefaultHostProbeSNATIPV6 = "fd16:9254:7127:1337:ffff:ffff:ffff:ffff"
    44  )
    45  
    46  type AmbientArgs struct {
    47  	SystemNamespace string
    48  	Revision        string
    49  	KubeConfig      string
    50  	ServerSocket    string
    51  	DNSCapture      bool
    52  	EnableIPv6      bool
    53  }