Documentation ¶
Index ¶
- Variables
- func InitConfig(ctx *cli.Context, exec kexec.Interface, defaults *Defaults) (string, error)
- func InitConfigWithPath(ctx *cli.Context, exec kexec.Interface, configFile string, defaults *Defaults) (string, error)
- func ReadCNIConfig(bytes []byte) (*types.NetConf, error)
- func RestoreDefaultConfig()
- func UpdateOvnNodeAuth(masterIP string) error
- func WriteCNIConfig(ConfDir string, fileName string) error
- type CNIConfig
- type DefaultConfig
- type Defaults
- type KubernetesConfig
- type LoggingConfig
- type OvnAuthConfig
- type OvnDBAuth
- type OvnDBScheme
Constants ¶
This section is empty.
Variables ¶
var ( // ovn-kubernetes version, to be changed with every release Version = "0.3.0" // ovn-kubernetes cni config file name CNIConfFileName = "10-ovn-kubernetes.conf" // Default holds parsed config file parameters and command-line overrides Default = DefaultConfig{ MTU: 1400, ConntrackZone: 64000, EncapType: "geneve", EncapIP: "", InactivityProbe: 100000, } // Logging holds logging-related parsed config file parameters and command-line overrides Logging = LoggingConfig{ File: "", Level: 4, } // CNI holds CNI-related parsed config file parameters and command-line overrides CNI = CNIConfig{ ConfDir: "/etc/cni/net.d", Plugin: "ovn-k8s-cni-overlay", WinHNSNetworkID: "", } // Kubernetes holds Kubernetes-related parsed config file parameters and command-line overrides Kubernetes = KubernetesConfig{ APIServer: "http://localhost:8080", } // OvnNorth holds northbound OVN database client and server authentication and location details OvnNorth OvnAuthConfig // OvnSouth holds southbound OVN database client and server authentication and location details OvnSouth OvnAuthConfig )
The following are global config parameters that other modules may access directly
var CommonFlags = []cli.Flag{ cli.BoolFlag{ Name: "net-controller", Usage: "Flag to start the central controller that watches pods/services/policies", }, cli.StringFlag{ Name: "init-master", Usage: "initialize master, requires the hostname as argument", }, cli.StringFlag{ Name: "init-node", Usage: "initialize node, requires the name that node is registered with in kubernetes cluster", }, cli.StringFlag{ Name: "pidfile", Usage: "Name of file that will hold the ovnkube pid (optional)", }, cli.BoolFlag{ Name: "ha", Usage: "HA option to reconstruct OVN database after failover", }, cli.StringFlag{ Name: "config-file", Usage: "configuration file path (default: /etc/openvswitch/ovn_k8s.conf)", }, cli.IntFlag{ Name: "mtu", Usage: "MTU value used for the overlay networks (default: 1400)", Destination: &cliConfig.Default.MTU, }, cli.IntFlag{ Name: "conntrack-zone", Usage: "For gateway nodes, the conntrack zone used for conntrack flow rules (default: 64000)", Destination: &cliConfig.Default.ConntrackZone, }, cli.StringFlag{ Name: "encap-type", Usage: "The encapsulation protocol to use to transmit packets between hypervisors (default: geneve)", Destination: &cliConfig.Default.EncapType, }, cli.StringFlag{ Name: "encap-ip", Usage: "The IP address of the encapsulation endpoint (default: Node IP address resolved from Node hostname)", Destination: &cliConfig.Default.EncapIP, }, cli.IntFlag{ Name: "inactivity-probe", Usage: "Maximum number of milliseconds of idle time on " + "connection for ovn-controller before it sends a inactivity probe", Destination: &cliConfig.Default.InactivityProbe, }, cli.IntFlag{ Name: "loglevel", Usage: "log verbosity and level: 5=debug, 4=info, 3=warn, 2=error, 1=fatal (default: 4)", Destination: &cliConfig.Logging.Level, }, cli.StringFlag{ Name: "logfile", Usage: "path of a file to direct log output to", Destination: &cliConfig.Logging.File, }, }
CommonFlags capture general options.
var Flags []cli.Flag
Flags are general command-line flags. Apps should add these flags to their own urfave/cli flags and call InitConfig() early in the application.
var K8sFlags = []cli.Flag{ cli.StringFlag{ Name: "cluster-subnet", Value: "11.11.0.0/16", Usage: "A comma separated set of IP subnets and the associated" + "hostsubnetlengths to use for the cluster (eg, \"10.128.0.0/14/23,10.0.0.0/14/23\"). " + "Each entry is given in the form IP address/subnet mask/hostsubnetlength, " + "the hostsubnetlength is optional and if unspecified defaults to 24. The " + "hostsubnetlength defines how many IP addresses are dedicated to each node.", }, cli.StringFlag{ Name: "cni-conf-dir", Usage: "the CNI config directory in which to write the overlay CNI config file (default: /etc/cni/net.d)", Destination: &cliConfig.CNI.ConfDir, }, cli.StringFlag{ Name: "cni-plugin", Usage: "the name of the CNI plugin (default: ovn-k8s-cni-overlay)", Destination: &cliConfig.CNI.Plugin, }, cli.StringFlag{ Name: "win-hnsnetwork-id", Usage: "the ID of the HNS network to which containers will be attached (default: not set)", Destination: &cliConfig.CNI.WinHNSNetworkID, }, cli.StringFlag{ Name: "service-cluster-ip-range", Usage: "A CIDR notation IP range from which k8s assigns " + "service cluster IPs. This should be the same as the one " + "provided for kube-apiserver \"-service-cluster-ip-range\" " + "option.", }, cli.StringFlag{ Name: "k8s-kubeconfig", Usage: "absolute path to the Kubernetes kubeconfig file (not required if the --k8s-apiserver, --k8s-ca-cert, and --k8s-token are given)", Destination: &cliConfig.Kubernetes.Kubeconfig, }, cli.StringFlag{ Name: "k8s-apiserver", Usage: "URL of the Kubernetes API server (not required if --k8s-kubeconfig is given) (default: http://localhost:8443)", Destination: &cliConfig.Kubernetes.APIServer, }, cli.StringFlag{ Name: "k8s-cacert", Usage: "the absolute path to the Kubernetes API CA certificate (not required if --k8s-kubeconfig is given)", Destination: &cliConfig.Kubernetes.CACert, }, cli.StringFlag{ Name: "k8s-token", Usage: "the Kubernetes API authentication token (not required if --k8s-kubeconfig is given)", Destination: &cliConfig.Kubernetes.Token, }, }
K8sFlags capture Kubernetes-related options
var OVNGatewayFlags = []cli.Flag{ cli.BoolFlag{ Name: "init-gateways", Usage: "initialize a gateway in the minion. Only useful with \"init-node\"", }, cli.StringFlag{ Name: "gateway-interface", Usage: "The interface in minions that will be the gateway interface. " + "If none specified, then the node's interface on which the " + "default gateway is configured will be used as the gateway " + "interface. Only useful with \"init-gateways\"", }, cli.StringFlag{ Name: "gateway-nexthop", Usage: "The external default gateway which is used as a next hop by " + "OVN gateway. This is many times just the default gateway " + "of the node in question. If not specified, the default gateway" + "configured in the node is used. Only useful with " + "\"init-gateways\"", }, cli.BoolFlag{ Name: "gateway-spare-interface", Usage: "If true, assumes that \"gateway-interface\" provided can be " + "exclusively used for the OVN gateway. When true, only OVN" + "related traffic can flow through this interface", }, cli.BoolFlag{ Name: "gateway-local", Usage: "If true, creates a local gateway (br-local) to let traffic reach " + "host network and also exit host with iptables NAT", }, cli.UintFlag{ Name: "gateway-vlanid", Usage: "The VLAN on which the external network is available. " + "Valid only for Shared or Spare Gateway interface mode.", }, cli.BoolFlag{ Name: "nodeport", Usage: "Setup nodeport based ingress on gateways.", }, }
OVNGatewayFlags capture L3 Gateway related flags
var OvnNBFlags = []cli.Flag{ cli.StringFlag{ Name: "nb-address", Usage: "IP address and port of the OVN northbound API " + "(eg, ssl://1.2.3.4:6641,ssl://1.2.3.5:6642). Leave empty to " + "use a local unix socket.", Destination: &cliConfig.OvnNorth.Address, }, cli.StringFlag{ Name: "nb-client-privkey", Usage: "Private key that the client should use for talking to the OVN database. Leave empty to use local unix socket. (default: /etc/openvswitch/ovnnb-privkey.pem)", Destination: &cliConfig.OvnNorth.ClientPrivKey, }, cli.StringFlag{ Name: "nb-client-cert", Usage: "Client certificate that the client should use for talking to the OVN database. Leave empty to use local unix socket. (default: /etc/openvswitch/ovnnb-cert.pem)", Destination: &cliConfig.OvnNorth.ClientCert, }, cli.StringFlag{ Name: "nb-client-cacert", Usage: "CA certificate that the client should use for talking to the OVN database. Leave empty to use local unix socket. (default: /etc/openvswitch/ovnnb-ca.cert)", Destination: &cliConfig.OvnNorth.ClientCACert, }, }
OvnNBFlags capture OVN northbound database options
var OvnSBFlags = []cli.Flag{ cli.StringFlag{ Name: "sb-address", Usage: "IP address and port of the OVN southbound API " + "(eg, ssl://1.2.3.4:6642,ssl://1.2.3.5:6642). " + "Leave empty to use a local unix socket.", Destination: &cliConfig.OvnSouth.Address, }, cli.StringFlag{ Name: "sb-client-privkey", Usage: "Private key that the client should use for talking to the OVN database. Leave empty to use local unix socket. (default: /etc/openvswitch/ovnsb-privkey.pem)", Destination: &cliConfig.OvnSouth.ClientPrivKey, }, cli.StringFlag{ Name: "sb-client-cert", Usage: "Client certificate that the client should use for talking to the OVN database. Leave empty to use local unix socket. (default: /etc/openvswitch/ovnsb-cert.pem)", Destination: &cliConfig.OvnSouth.ClientCert, }, cli.StringFlag{ Name: "sb-client-cacert", Usage: "CA certificate that the client should use for talking to the OVN database. Leave empty to use local unix socket. (default: /etc/openvswitch/ovnsb-ca.cert)", Destination: &cliConfig.OvnSouth.ClientCACert, }, }
OvnSBFlags capture OVN southbound database options
Functions ¶
func InitConfig ¶
InitConfig reads the config file and common command-line options and constructs the global config object from them. It returns the config file path (if explicitly specified) or an error
func InitConfigWithPath ¶
func InitConfigWithPath(ctx *cli.Context, exec kexec.Interface, configFile string, defaults *Defaults) (string, error)
InitConfigWithPath reads the given config file (or if empty, reads the config file specified by command-line arguments, or empty, the default config file) and common command-line options and constructs the global config object from them. It returns the config file path (if explicitly specified) or an error
func ReadCNIConfig ¶
ReadCNIConfig unmarshals a CNI JSON config into an NetConf structure
func RestoreDefaultConfig ¶
func RestoreDefaultConfig()
RestoreDefaultConfig restores default config values. Used by testcases to provide a pristine environment between tests.
func UpdateOvnNodeAuth ¶
UpdateOvnNodeAuth updates the host and URL in ClientAuth for both OvnNorth and OvnSouth. It updates them with the new masterIP.
func WriteCNIConfig ¶
WriteCNIConfig writes a CNI JSON config file to directory given by global config
Types ¶
type CNIConfig ¶
type CNIConfig struct { // ConfDir specifies the CNI config directory in which to write the overlay CNI config file ConfDir string `gcfg:"conf-dir"` // Plugin specifies the name of the CNI plugin Plugin string `gcfg:"plugin"` // Windows ONLY, specifies the ID of the HNS Network to which the containers will be attached WinHNSNetworkID string `gcfg:"win-hnsnetwork-id"` }
CNIConfig holds CNI-related parsed config file parameters and command-line overrides
type DefaultConfig ¶
type DefaultConfig struct { // MTU value used for the overlay networks. MTU int `gcfg:"mtu"` // ConntrackZone affects only the gateway nodes, This value is used to track connections // that are initiated from the pods so that the reverse connections go back to the pods. // This represents the conntrack zone used for the conntrack flow rules. ConntrackZone int `gcfg:"conntrack-zone"` // EncapType value defines the encapsulation protocol to use to transmit packets between // hypervisors. By default the value is 'geneve' EncapType string `gcfg:"encap-type"` // The IP address of the encapsulation endpoint. If not specified, the IP address the // NodeName resolves to will be used EncapIP string `gcfg:"encap-ip"` // Maximum number of milliseconds of idle time on connection that // ovn-controller waits before it will send a connection health probe. InactivityProbe int `gcfg:"inactivity-probe"` }
DefaultConfig holds parsed config file parameters and command-line overrides
type Defaults ¶
Defaults are a set of flags to indicate which options should be read from ovs-vsctl and used as default values if option is not found via the config file or command-line
type KubernetesConfig ¶
type KubernetesConfig struct { Kubeconfig string `gcfg:"kubeconfig"` CACert string `gcfg:"cacert"` APIServer string `gcfg:"apiserver"` Token string `gcfg:"token"` }
KubernetesConfig holds Kubernetes-related parsed config file parameters and command-line overrides
type LoggingConfig ¶
type LoggingConfig struct { // File is the path of the file to log to File string `gcfg:"logfile"` // Level is the logging verbosity level Level int `gcfg:"loglevel"` }
LoggingConfig holds logging-related parsed config file parameters and command-line overrides
type OvnAuthConfig ¶
type OvnAuthConfig struct {
ClientAuth *OvnDBAuth
}
OvnAuthConfig holds client authentication and location details for an OVN database (either northbound or southbound)
type OvnDBAuth ¶
type OvnDBAuth struct { OvnAddressForClient string // e.g: "ssl:192.168.1.2:6641,ssl:192.168.1.2:6642" PrivKey string Cert string CACert string Scheme OvnDBScheme // contains filtered or unexported fields }
OvnDBAuth describes an OVN database location and authentication method
type OvnDBScheme ¶
type OvnDBScheme string
OvnDBScheme describes the OVN database connection transport method
const ( // OvnDBSchemeSSL specifies SSL as the OVN database transport method OvnDBSchemeSSL OvnDBScheme = "ssl" // OvnDBSchemeTCP specifies TCP as the OVN database transport method OvnDBSchemeTCP OvnDBScheme = "tcp" // OvnDBSchemeUnix specifies Unix domains sockets as the OVN database transport method OvnDBSchemeUnix OvnDBScheme = "unix" )