apiconfig

package
v0.0.0-...-21cfbab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2023 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlphaFeatureSet

func IsAlphaFeatureSet(features, name string) bool

IsAlphaFeatureSet checks if the comma separated features have the name set in it.

Types

type CalicoAPIConfig

type CalicoAPIConfig struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object's metadata.
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Specification of the BGPConfiguration.
	Spec CalicoAPIConfigSpec `json:"spec,omitempty"`
}

CalicoAPIConfig contains the connection information for a Calico CalicoAPIConfig resource

func LoadClientConfig

func LoadClientConfig(filename string) (*CalicoAPIConfig, error)

LoadClientConfig loads the ClientConfig from the specified file (if specified) or from environment variables (if the file is not specified).

func LoadClientConfigFromBytes

func LoadClientConfigFromBytes(b []byte) (*CalicoAPIConfig, error)

LoadClientConfigFromBytes loads the ClientConfig from the supplied bytes containing YAML or JSON format data. The datastore type is defaulted if not specified.

func LoadClientConfigFromEnvironment

func LoadClientConfigFromEnvironment() (*CalicoAPIConfig, error)

LoadClientConfigFromEnvironment loads a client config from the environment. The datastore type is defaulted if not specified.

func LoadClientConfigFromFile

func LoadClientConfigFromFile(filename string) (*CalicoAPIConfig, error)

LoadClientConfigFromFile loads the ClientConfig from the specified file, which must exist. The datastore type is defaulted if not specified.

func NewCalicoAPIConfig

func NewCalicoAPIConfig() *CalicoAPIConfig

NewCalicoAPIConfig creates a new (zeroed) CalicoAPIConfig struct with the TypeMetadata initialised to the current version.

type CalicoAPIConfigSpec

type CalicoAPIConfigSpec struct {
	DatastoreType DatastoreType `json:"datastoreType" envconfig:"DATASTORE_TYPE"`
	// Inline the ectd config fields
	EtcdConfig
	// Inline the k8s config fields.
	KubeConfig
}

CalicoAPIConfigSpec contains the specification for a Calico CalicoAPIConfig resource.

type DatastoreType

type DatastoreType string
const (
	EtcdV3              DatastoreType = "etcdv3"
	Kubernetes          DatastoreType = "kubernetes"
	KindCalicoAPIConfig               = "CalicoAPIConfig"
)

type EtcdConfig

type EtcdConfig struct {
	EtcdEndpoints    string `json:"etcdEndpoints" envconfig:"ETCD_ENDPOINTS"`
	EtcdDiscoverySrv string `json:"etcdDiscoverySrv" envconfig:"ETCD_DISCOVERY_SRV"`
	EtcdUsername     string `json:"etcdUsername" envconfig:"ETCD_USERNAME"`
	EtcdPassword     string `json:"etcdPassword" envconfig:"ETCD_PASSWORD"`
	EtcdKeyFile      string `json:"etcdKeyFile" envconfig:"ETCD_KEY_FILE"`
	EtcdCertFile     string `json:"etcdCertFile" envconfig:"ETCD_CERT_FILE"`
	EtcdCACertFile   string `json:"etcdCACertFile" envconfig:"ETCD_CA_CERT_FILE"`

	// These config file parameters are to support inline certificates, keys and CA / Trusted certificate.
	// There are no corresponding environment variables to avoid accidental exposure.
	EtcdKey    string `json:"etcdKey" ignored:"true"`
	EtcdCert   string `json:"etcdCert" ignored:"true"`
	EtcdCACert string `json:"etcdCACert" ignored:"true"`

	// EtcdFIPSModeEnabled uses images and features only that are using FIPS 140-2 validated cryptographic modules and standards.
	EtcdFIPSModeEnabled bool `json:"etcdFIPSModeEnabled" envconfig:"ETCD_FIPS_MODE_ENABLED"`
}

type KubeConfig

type KubeConfig struct {
	Kubeconfig               string `json:"kubeconfig" envconfig:"KUBECONFIG" default:""`
	K8sAPIEndpoint           string `json:"k8sAPIEndpoint" envconfig:"K8S_API_ENDPOINT" default:""`
	K8sKeyFile               string `json:"k8sKeyFile" envconfig:"K8S_KEY_FILE" default:""`
	K8sCertFile              string `json:"k8sCertFile" envconfig:"K8S_CERT_FILE" default:""`
	K8sCAFile                string `json:"k8sCAFile" envconfig:"K8S_CA_FILE" default:""`
	K8sAPIToken              string `json:"k8sAPIToken" ignore:"true"`
	K8sInsecureSkipTLSVerify bool   `json:"k8sInsecureSkipTLSVerify" envconfig:"K8S_INSECURE_SKIP_TLS_VERIFY" default:""`
	K8sDisableNodePoll       bool   `json:"k8sDisableNodePoll" envconfig:"K8S_DISABLE_NODE_POLL" default:""`

	// K8sUsePodCIDR controls whether or not IPAM blocks are generated based on Node.Spec.PodCIDR. Set this
	// to true when using host-local IPAM, and set to false when using calico-ipam.
	K8sUsePodCIDR bool `json:"usePodCIDR" envconfig:"USE_POD_CIDR" default:""`
	// This is an alternative to Kubeconfig and if specified overrides Kubeconfig.
	// This contains the contents that would normally be in the file pointed at by Kubeconfig.
	KubeconfigInline string `json:"kubeconfigInline" ignored:"true"`
	// K8sClientQPS overrides the QPS for the Kube client.
	K8sClientQPS float32 `json:"k8sClientQPS"`
	// K8sCurrentContext provides a context override for kubeconfig.
	K8sCurrentContext string `json:"k8sCurrentContext" envconfig:"K8S_CURRENT_CONTEXT" default:""`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL