config

package
v0.0.0-...-b485392 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 30 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ConfigFile      = "/etc/microshift/config.yaml"
	DataDir         = "/var/lib/microshift"
	BackupsDir      = "/var/lib/microshift-backups"
	ConfigDropInDir = "/etc/microshift/config.d"
)
View Source
const (
	NamespaceOwnershipStrict  NamespaceOwnershipEnum   = "Strict"
	NamespaceOwnershipAllowed NamespaceOwnershipEnum   = "InterNamespaceAllowed"
	StatusManaged             IngressStatusEnum        = "Managed"
	StatusRemoved             IngressStatusEnum        = "Removed"
	DefaultHttpVersionV1      DefaultHttpVersionPolicy = 1
	DefaultHttpVersionV2      DefaultHttpVersionPolicy = 2
)
View Source
const (
	// default DNS resolve file when systemd-resolved is used
	DefaultSystemdResolvedFile = "/run/systemd/resolve/resolv.conf"
)
View Source
const (
	// Etcd performance degrades significantly if the memory available
	// is less than 128MB, enforce this minimum.
	EtcdMinimumMemoryLimit = 128
)

Variables

This section is empty.

Functions

func AllowedListeningIPAddresses

func AllowedListeningIPAddresses(ipv4, ipv6 bool) ([]string, error)

func AllowedNICNames

func AllowedNICNames() ([]string, error)

func HideUnsupportedFlags

func HideUnsupportedFlags(flags *pflag.FlagSet)

func StringInList

func StringInList(s string, list []string) bool

Types

type ApiServer

type ApiServer struct {
	// SubjectAltNames added to API server certs
	SubjectAltNames []string `json:"subjectAltNames"`
	// Kube apiserver advertise address to work around the certificates issue
	// when requiring external access using the node IP. This will turn into
	// the IP configured in the endpoint slice for kubernetes service. Must be
	// a reachable IP from pods. Defaults to service network CIDR first
	// address.
	AdvertiseAddress string `json:"advertiseAddress,omitempty"`
	// List of custom certificates used to secure requests to specific host names
	NamedCertificates []NamedCertificateEntry `json:"namedCertificates"`
	// Determines if kube-apiserver controller should configure the
	// AdvertiseAddress in the loopback interface. Automatically computed.
	SkipInterface bool `json:"-"`

	AuditLog AuditLog `json:"auditLog"`

	// The URL and Port of the API server cannot be changed by the user.
	URL  string `json:"-"`
	Port int    `json:"-"`

	// In dual stack mode, ovnk requires ovn.OVNGatewayInterface to have one IP
	// per family or else it wont start. When configuring advertiseAddress,
	// whether that is manual or automatic, this IP is configured in that
	// bridge afterwards in node package. Since there is only one IP, ovnk will
	// return an error complaining about the other IP family for the secondary
	// cluster/service network gateway. This variable holds all the different
	// IP addresses that ovn.OVNGatewayInterface needs. Note that this IP is
	// not configurable by users and it will not be used for apiserver
	// advertising because of dual stack limitations there. This is only to
	// make ovnk work properly.
	AdvertiseAddresses []string `json:"-"`
}

type AuditLog

type AuditLog struct {
	// maxFileAge is the maximum number of days to retain old audit log files
	// +kubebuilder:default=0
	MaxFileAge int `json:"maxFileAge"`
	// maxFiles is the maximum number of rotated audit log files to retain
	// +kubebuilder:default=10
	MaxFiles int `json:"maxFiles"`
	// maxFileSize is the maximum size in megabytes of the audit log file before it gets rotated
	// +kubebuilder:default=200
	MaxFileSize int `json:"maxFileSize"`
	// profile is the OpenShift profile specifying a specific logging policy
	// +kubebuilder:default=Default
	Profile string `json:"profile"`
}

type CNIPlugin

type CNIPlugin string

CNIPlugin is an enum value that determines whether MicroShift deploys OVNK. +kubebuilder:validation:Enum:="";none;ovnk

const (
	// CniPluginUnset exists to support backwards compatibility with existing MicroShift clusters. When .network.cniPlugin is
	// "", MicroShift will default to deploying OVNK. This preserves the current deployment behavior of existing
	// clusters.
	CniPluginUnset CNIPlugin = ""
	//  CniPluginNone signals MicroShift to not deploy the LVMS components. Setting the value for a cluster that has already
	//  deployed LVMS will not cause LVMS to be deleted. Otherwise, volumes already deployed on the cluster would be
	//  orphaned once their workloads stop or restart.
	CniPluginNone CNIPlugin = "none"
	// CniPluginOVNK is equivalent to CniPluginUnset, and explicitly tells MicroShift to deploy OVNK. This option exists to
	// provide a differentiation between OVNK and potential future CNI options.
	CniPluginOVNK CNIPlugin = "ovnk"
)

type CSIStorageDriver

type CSIStorageDriver string

CSIStorageDriver is an enum value that determines whether MicroShift deploys LVMS. +kubebuilder:validation:Enum:="";none;lvms

const (
	// CsiDriverUnset exists to support backwards compatibility with existing MicroShift clusters. When .storage.driver is
	// "", MicroShift will default to deploying LVMS. This preserves the current deployment behavior of existing
	// clusters.
	CsiDriverUnset CSIStorageDriver = ""
	//  CsiDriverNone signals MicroShift to not deploy the LVMS components. Setting the value for a cluster that has already
	//  deployed LVMS will not cause LVMS to be deleted. Otherwise, volumes already deployed on the cluster would be
	//  orphaned once their workloads stop or restart.
	CsiDriverNone CSIStorageDriver = "none"
	// CsiDriverLVMS is equivalent to CsiDriverUnset, and explicitly tells MicroShift to deploy LVMS. This option exists to
	// provide a differentiation between LVMS and potential future driver options.
	CsiDriverLVMS CSIStorageDriver = "lvms"
)

type Config

type Config struct {
	DNS       DNS           `json:"dns"`
	Network   Network       `json:"network"`
	Node      Node          `json:"node"`
	ApiServer ApiServer     `json:"apiServer"`
	Etcd      EtcdConfig    `json:"etcd"`
	Debugging Debugging     `json:"debugging"`
	Manifests Manifests     `json:"manifests"`
	Ingress   IngressConfig `json:"ingress"`
	Storage   Storage       `json:"storage"`

	// Settings specified in this section are transferred as-is into the Kubelet config.
	// +kubebuilder:validation:Schemaless
	Kubelet map[string]any `json:"kubelet"`

	MultiNode MultiNodeConfig `json:"-"` // the value read from commond line

	Warnings []string `json:"-"` // Warnings that should not prevent the service from starting.
	// contains filtered or unexported fields
}

func ActiveConfig

func ActiveConfig() (*Config, error)

ActiveConfig returns the active configuration which is default config with overrides from user provided config files.

func ConfigMultiNode

func ConfigMultiNode(c *Config, enabled bool) *Config

ConfigMultiNode populates multinode configurations to Config.MultiNode

func NewDefault

func NewDefault() *Config

NewDefault creates a new Config struct populated with the default values and with any computed values updated based on those defaults.

func (*Config) AddWarning

func (c *Config) AddWarning(message string)

AddWarning saves a warning message to be reported later.

func (*Config) CanonicalNodeName

func (c *Config) CanonicalNodeName() string

CanonicalNodeName returns the name to use for the node. The value is taken from either the HostnameOverride provided by the user in the config file, or the host name.

func (*Config) EnsureNodeNameHasNotChanged

func (c *Config) EnsureNodeNameHasNotChanged() error

func (*Config) GetVerbosity

func (c *Config) GetVerbosity() int

GetVerbosity returns the numerical value for LogLevel which is an enum.

func (Config) IsIPv4

func (c Config) IsIPv4() bool

func (Config) IsIPv6

func (c Config) IsIPv6() bool

func (*Config) KubeConfigAdminPath

func (cfg *Config) KubeConfigAdminPath(id string) string

func (*Config) KubeConfigPath

func (cfg *Config) KubeConfigPath(id KubeConfigID) string

KubeConfigPath returns the path to the specified kubeconfig file.

func (*Config) KubeConfigRootAdminPath

func (cfg *Config) KubeConfigRootAdminPath() string

func (Config) UserNodeIP

func (c Config) UserNodeIP() string

UserNodeIP return the user configured NodeIP, or "" if it's unset.

func (Config) UserNodeIPv6

func (c Config) UserNodeIPv6() string

UserNodeIPv6 return the user configured NodeIPv6, or "" if it's unset.

type DNS

type DNS struct {
	// baseDomain is the base domain of the cluster. All managed DNS records will
	// be sub-domains of this base.
	//
	// For example, given the base domain `example.com`, router exposed
	// domains will be formed as `*.apps.example.com` by default,
	// and API service will have a DNS entry for `api.example.com`,
	// as well as "api-int.example.com" for internal k8s API access.
	//
	// Once set, this field cannot be changed.
	// +kubebuilder:default=example.com
	// +kubebuilder:example=microshift.example.com
	BaseDomain string `json:"baseDomain"`
}

type Debugging

type Debugging struct {
	// Valid values are: "Normal", "Debug", "Trace", "TraceAll".
	// Defaults to "Normal".
	// +kubebuilder:default="Normal"
	LogLevel string `json:"logLevel"`
}

type DefaultHttpVersionPolicy

type DefaultHttpVersionPolicy int32

type EtcdConfig

type EtcdConfig struct {
	// Set a memory limit on the etcd process; etcd will begin paging
	// memory when it gets to this value. 0 means no limit.
	MemoryLimitMB uint64 `json:"memoryLimitMB"`

	// The limit on the size of the etcd database; etcd will start
	// failing writes if its size on disk reaches this value
	QuotaBackendBytes int64 `json:"-"`

	// If the backend is fragmented more than
	// `maxFragmentedPercentage` and the database size is greater than
	// `minDefragBytes`, do a defrag.
	MinDefragBytes          int64   `json:"-"`
	MaxFragmentedPercentage float64 `json:"-"`

	// How often to check the conditions for defragging (0 means no
	// defrags, except for a single on startup).
	DefragCheckFreq time.Duration `json:"-"`
}

type IngressConfig

type IngressConfig struct {
	// Default router status, can be Managed or Removed.
	// +kubebuilder:default=Managed
	Status          IngressStatusEnum              `json:"status"`
	AdmissionPolicy RouteAdmissionPolicy           `json:"routeAdmissionPolicy"`
	Ports           IngressPortsConfig             `json:"ports"`
	TuningOptions   IngressControllerTuningOptions `json:"tuningOptions"`
	// List of IP addresses and NIC names where the router will be listening. The NIC
	// names get translated to all their configured IPs dynamically. Defaults to the
	// configured IPs in the host at MicroShift start.
	ListenAddress      []string `json:"listenAddress"`
	ServingCertificate []byte   `json:"-"`
	ServingKey         []byte   `json:"-"`
	// logEmptyRequests specifies how connections on which no request is
	// received should be logged.  Typically, these empty requests come from
	// load balancers' health probes or Web browsers' speculative
	// connections ("preconnect"), in which case logging these requests may
	// be undesirable.  However, these requests may also be caused by
	// network errors, in which case logging empty requests may be useful
	// for diagnosing the errors.  In addition, these requests may be caused
	// by port scans, in which case logging empty requests may aid in
	// detecting intrusion attempts.  Allowed values for this field are
	// "Log" and "Ignore".  The default value is "Log".
	//
	// +optional
	// +kubebuilder:default:="Log"
	LogEmptyRequests operatorv1.LoggingPolicy `json:"logEmptyRequests,omitempty"`

	// forwardedHeaderPolicy specifies when and how ingress router
	// sets the Forwarded, X-Forwarded-For, X-Forwarded-Host,
	// X-Forwarded-Port, X-Forwarded-Proto, and X-Forwarded-Proto-Version
	// HTTP headers.  The value may be one of the following:
	//
	// * "Append", which specifies that ingress router appends the
	//   headers, preserving existing headers.
	//
	// * "Replace", which specifies that ingress router sets the
	//   headers, replacing any existing Forwarded or X-Forwarded-* headers.
	//
	// * "IfNone", which specifies that ingress router sets the
	//   headers if they are not already set.
	//
	// * "Never", which specifies that ingress router never sets the
	//   headers, preserving any existing headers.
	//
	// By default, the policy is "Append".
	//
	// +optional
	ForwardedHeaderPolicy operatorv1.IngressControllerHTTPHeaderPolicy `json:"forwardedHeaderPolicy,omitempty"`

	// httpEmptyRequestsPolicy describes how HTTP connections should be
	// handled if the connection times out before a request is received.
	// Allowed values for this field are "Respond" and "Ignore".  If the
	// field is set to "Respond", the ingress controller sends an HTTP 400
	// or 408 response, logs the connection (if access logging is enabled),
	// and counts the connection in the appropriate metrics.  If the field
	// is set to "Ignore", the ingress controller closes the connection
	// without sending a response, logging the connection, or incrementing
	// metrics.  The default value is "Respond".
	//
	// Typically, these connections come from load balancers' health probes
	// or Web browsers' speculative connections ("preconnect") and can be
	// safely ignored.  However, these requests may also be caused by
	// network errors, and so setting this field to "Ignore" may impede
	// detection and diagnosis of problems.  In addition, these requests may
	// be caused by port scans, in which case logging empty requests may aid
	// in detecting intrusion attempts.
	//
	// +optional
	// +kubebuilder:default:="Respond"
	HTTPEmptyRequestsPolicy operatorv1.HTTPEmptyRequestsPolicy `json:"httpEmptyRequestsPolicy,omitempty"`

	// httpCompression defines a policy for HTTP traffic compression.
	// By default, there is no HTTP compression.
	//
	// +optional
	HTTPCompressionPolicy operatorv1.HTTPCompressionPolicy `json:"httpCompression,omitempty"`

	// Determines default http version should be used for the ingress backends
	// By default,  using version 1.
	//
	// +optional
	// +kubebuilder:default:="1"
	DefaultHttpVersionPolicy DefaultHttpVersionPolicy `json:"defaultHTTPVersion,omitempty"`
}

type IngressControllerTuningOptions

type IngressControllerTuningOptions struct {
	// headerBufferBytes describes how much memory should be reserved
	// (in bytes) for IngressController connection sessions.
	// Note that this value must be at least 16384 if HTTP/2 is
	// enabled for the IngressController (https://tools.ietf.org/html/rfc7540).
	// If this field is empty, the IngressController will use a default value
	// of 32768 bytes.
	//
	// Setting this field is generally not recommended as headerBufferBytes
	// values that are too small may break the IngressController and
	// headerBufferBytes values that are too large could cause the
	// IngressController to use significantly more memory than necessary.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Minimum=16384
	// +optional
	HeaderBufferBytes int32 `json:"headerBufferBytes,omitempty"`

	// headerBufferMaxRewriteBytes describes how much memory should be reserved
	// (in bytes) from headerBufferBytes for HTTP header rewriting
	// and appending for IngressController connection sessions.
	// Note that incoming HTTP requests will be limited to
	// (headerBufferBytes - headerBufferMaxRewriteBytes) bytes, meaning
	// headerBufferBytes must be greater than headerBufferMaxRewriteBytes.
	// If this field is empty, the IngressController will use a default value
	// of 8192 bytes.
	//
	// Setting this field is generally not recommended as
	// headerBufferMaxRewriteBytes values that are too small may break the
	// IngressController and headerBufferMaxRewriteBytes values that are too
	// large could cause the IngressController to use significantly more memory
	// than necessary.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Minimum=4096
	// +optional
	HeaderBufferMaxRewriteBytes int32 `json:"headerBufferMaxRewriteBytes,omitempty"`

	// threadCount defines the number of threads created per HAProxy process.
	// Creating more threads allows each ingress controller pod to handle more
	// connections, at the cost of more system resources being used. HAProxy
	// currently supports up to 64 threads. If this field is empty, the
	// IngressController will use the default value.  The current default is 4
	// threads, but this may change in future releases.
	//
	// Setting this field is generally not recommended. Increasing the number
	// of HAProxy threads allows ingress controller pods to utilize more CPU
	// time under load, potentially starving other pods if set too high.
	// Reducing the number of threads may cause the ingress controller to
	// perform poorly.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=64
	// +optional
	ThreadCount int32 `json:"threadCount,omitempty"`

	// clientTimeout defines how long a connection will be held open while
	// waiting for a client response.
	//
	// If unset, the default timeout is 30s
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Format=duration
	// +optional
	ClientTimeout *metav1.Duration `json:"clientTimeout,omitempty"`

	// clientFinTimeout defines how long a connection will be held open while
	// waiting for the client response to the server/backend closing the
	// connection.
	//
	// If unset, the default timeout is 1s
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Format=duration
	// +optional
	ClientFinTimeout *metav1.Duration `json:"clientFinTimeout,omitempty"`

	// serverTimeout defines how long a connection will be held open while
	// waiting for a server/backend response.
	//
	// If unset, the default timeout is 30s
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Format=duration
	// +optional
	ServerTimeout *metav1.Duration `json:"serverTimeout,omitempty"`

	// serverFinTimeout defines how long a connection will be held open while
	// waiting for the server/backend response to the client closing the
	// connection.
	//
	// If unset, the default timeout is 1s
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Format=duration
	// +optional
	ServerFinTimeout *metav1.Duration `json:"serverFinTimeout,omitempty"`

	// tunnelTimeout defines how long a tunnel connection (including
	// websockets) will be held open while the tunnel is idle.
	//
	// If unset, the default timeout is 1h
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Format=duration
	// +optional
	TunnelTimeout *metav1.Duration `json:"tunnelTimeout,omitempty"`

	// tlsInspectDelay defines how long the router can hold data to find a
	// matching route.
	//
	// Setting this too short can cause the router to fall back to the default
	// certificate for edge-terminated or reencrypt routes even when a better
	// matching certificate could be used.
	//
	// If unset, the default inspect delay is 5s
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Format=duration
	// +optional
	TLSInspectDelay *metav1.Duration `json:"tlsInspectDelay,omitempty"`

	// healthCheckInterval defines how long the router waits between two consecutive
	// health checks on its configured backends.  This value is applied globally as
	// a default for all routes, but may be overridden per-route by the route annotation
	// "router.openshift.io/haproxy.health.check.interval".
	//
	// Expects an unsigned duration string of decimal numbers, each with optional
	// fraction and a unit suffix, eg "300ms", "1.5h" or "2h45m".
	// Valid time units are "ns", "us" (or "µs" U+00B5 or "μs" U+03BC), "ms", "s", "m", "h".
	//
	// Setting this to less than 5s can cause excess traffic due to too frequent
	// TCP health checks and accompanying SYN packet storms.  Alternatively, setting
	// this too high can result in increased latency, due to backend servers that are no
	// longer available, but haven't yet been detected as such.
	//
	// An empty or zero healthCheckInterval means no opinion and IngressController chooses
	// a default, which is subject to change over time.
	// Currently the default healthCheckInterval value is 5s.
	//
	// Currently the minimum allowed value is 1s and the maximum allowed value is
	// 2147483647ms (24.85 days).  Both are subject to change over time.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Pattern=^(0|([0-9]+(\.[0-9]+)?(ns|us|µs|μs|ms|s|m|h))+)$
	// +kubebuilder:validation:Type:=string
	// +optional
	HealthCheckInterval *metav1.Duration `json:"healthCheckInterval,omitempty"`

	// maxConnections defines the maximum number of simultaneous
	// connections that can be established per HAProxy process.
	// Increasing this value allows each ingress controller pod to
	// handle more connections but at the cost of additional
	// system resources being consumed.
	//
	// Permitted values are: empty, 0, -1, and the range
	// 2000-2000000.
	//
	// If this field is empty or 0, the IngressController will use
	// the default value of 50000, but the default is subject to
	// change in future releases.
	//
	// If the value is -1 then HAProxy will dynamically compute a
	// maximum value based on the available ulimits in the running
	// container. Selecting -1 (i.e., auto) will result in a large
	// value being computed (~520000 on OpenShift >=4.10 clusters)
	// and therefore each HAProxy process will incur significant
	// memory usage compared to the current default of 50000.
	//
	// Setting a value that is greater than the current operating
	// system limit will prevent the HAProxy process from
	// starting.
	//
	// If you choose a discrete value (e.g., 750000) and the
	// router pod is migrated to a new node, there's no guarantee
	// that that new node has identical ulimits configured. In
	// such a scenario the pod would fail to start. If you have
	// nodes with different ulimits configured (e.g., different
	// tuned profiles) and you choose a discrete value then the
	// guidance is to use -1 and let the value be computed
	// dynamically at runtime.
	//
	// You can monitor memory usage for router containers with the
	// following metric:
	// 'container_memory_working_set_bytes{container="router",namespace="openshift-ingress"}'.
	//
	// You can monitor memory usage of individual HAProxy
	// processes in router containers with the following metric:
	// 'container_memory_working_set_bytes{container="router",namespace="openshift-ingress"}/container_processes{container="router",namespace="openshift-ingress"}'.
	//
	// +kubebuilder:validation:Optional
	// +optional
	MaxConnections int32 `json:"maxConnections,omitempty"`
}

IngressControllerTuningOptions specifies options for tuning the performance of ingress controller pods

type IngressPortsConfig

type IngressPortsConfig struct {
	// Default router http port. Must be in range 1-65535.
	// +kubebuilder:default=80
	Http *int `json:"http"`
	// Default router https port. Must be in range 1-65535.
	// +kubebuilder:default=443
	Https *int `json:"https"`
}

type IngressStatusEnum

type IngressStatusEnum string

type KubeConfigID

type KubeConfigID string

KubeConfigID identifies the different kubeconfigs managed in the DataDir

const (
	KubeAdmin               KubeConfigID = "kubeadmin"
	KubeControllerManager   KubeConfigID = "kube-controller-manager"
	KubeScheduler           KubeConfigID = "kube-scheduler"
	Kubelet                 KubeConfigID = "kubelet"
	ClusterPolicyController KubeConfigID = "cluster-policy-controller"
	RouteControllerManager  KubeConfigID = "route-controller-manager"
)

type Manifests

type Manifests struct {
	// The locations on the filesystem to scan for kustomization
	// files to use to load manifests. Set to a list of paths to scan
	// only those paths. Set to an empty list to disable loading
	// manifests. The entries in the list can be glob patterns to
	// match multiple subdirectories.
	//
	// +kubebuilder:default={"/usr/lib/microshift/manifests","/usr/lib/microshift/manifests.d/*","/etc/microshift/manifests","/etc/microshift/manifests.d/*"}
	KustomizePaths []string `json:"kustomizePaths"`
}

func (*Manifests) GetKustomizationDeletePaths

func (m *Manifests) GetKustomizationDeletePaths() ([]string, error)

func (*Manifests) GetKustomizationPaths

func (m *Manifests) GetKustomizationPaths() ([]string, error)

GetKustomizationPaths returns the list of configured paths for which there are actual kustomization files to be loaded. The paths are returned in the order given in the configuration file. The results of any glob patterns are sorted lexicographically.

type MultiNodeConfig

type MultiNodeConfig struct {
	Enabled bool `json:"enabled"`
	// only one controlplane node is supported
	// IP address of control plane node
	Controlplane string `json:"controlplane"`
}

type NamedCertificateEntry

type NamedCertificateEntry struct {
	Names    []string `json:"names"`
	CertPath string   `json:"certPath"`
	KeyPath  string   `json:"keyPath"`
}

NamedCertificateEntry provides certificate details

type NamespaceOwnershipEnum

type NamespaceOwnershipEnum string

type Network

type Network struct {
	// CNIPlugin is a user defined string value matching one of the above CNI values. MicroShift uses this
	// value to decide whether to deploy the OVN-K as default CNI. An unset field defaults to "" during yaml parsing, and thus
	// could mean that the cluster has been upgraded. In order to support the existing out-of-box behavior, MicroShift
	// assumes an empty string to mean the OVN-K should be deployed.
	// Allowed values are: unset or one of ["", "ovnk", "none"]
	// +kubebuilder:validation:Optional
	CNIPlugin CNIPlugin `json:"cniPlugin,omitempty"`

	// IP address pool to use for pod IPs.
	// This field is immutable after installation.
	// +kubebuilder:default={"10.42.0.0/16"}
	ClusterNetwork []string `json:"clusterNetwork"`

	// IP address pool for services.
	// Currently, we only support a single entry here.
	// This field is immutable after installation.
	// +kubebuilder:default={"10.43.0.0/16"}
	ServiceNetwork []string `json:"serviceNetwork"`

	// The port range allowed for Services of type NodePort.
	// If not specified, the default of 30000-32767 will be used.
	// Such Services without a NodePort specified will have one
	// automatically allocated from this range.
	// This parameter can be updated after the cluster is
	// installed.
	// +kubebuilder:validation:Pattern=`^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])-([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$`
	// +kubebuilder:default="30000-32767"
	ServiceNodePortRange string `json:"serviceNodePortRange"`

	// The DNS server to use
	DNS string `json:"-"`
}

func (Network) IsEnabled

func (n Network) IsEnabled() bool

IsEnabled returns false only when .network.cniPlugin: "none". An empty value is considered "enabled" for backwards compatibility. Otherwise, the meaning of the config would silently change after an upgrade from enabled-by-default to disabled-by-default.

type Node

type Node struct {
	// If non-empty, will use this string to identify the node instead of the hostname
	HostnameOverride string `json:"hostnameOverride"`

	// IP address of the node, passed to the kubelet.
	// If not specified, kubelet will use the node's default IP address.
	NodeIP string `json:"nodeIP"`

	// IPv6 address of the node, passed to the kubelet. This parameter
	// is only allowed when dual stack deployment is configured.
	NodeIPV6 string `json:"nodeIPv6"`
}

type OptionalCsiComponent

type OptionalCsiComponent string

OptionalCsiComponent values determine which CSI components MicroShift should deploy. Currently only csi snapshot components are supported. +kubebuilder:validation:Enum:=none;snapshot-controller;snapshot-webhook;""

const (
	// CsiComponentNone exists to support backwards compatibility with existing MicroShift clusters. By default,
	// MicroShift will deploy snapshot controller and webhook when no components are specified. This preserves the
	// current deployment behavior of existing clusters. Users must set .storage.with-csi-components: [ "none" ] to
	// explicitly tell MicroShift not to deploy any CSI components. The CSI Driver is excluded as it is typically
	// deployed via the same manifest as the accompanying storage driver. Like DriverOpt, uninstallation is not
	// supported as this can lead to orphaned storage volumes. Mutually exclusive with all other ComponentOpt values.
	CsiComponentNone OptionalCsiComponent = "none"
	// CsiComponentSnapshot causes MicroShift to deploy the CSI Snapshot controller.
	CsiComponentSnapshot OptionalCsiComponent = "snapshot-controller"
	// CsiComponentSnapshotWebhook causes MicroShift to deploy the CSI Snapshot Validation Webhook.
	CsiComponentSnapshotWebhook OptionalCsiComponent = "snapshot-webhook"
	// CsiComponentNullAlias is equivalent to not specifying a value. It exists because controller-gen generates
	// default empty-array values as [""], instead of []. Failing to include this odd value would mean the generated
	// /etc/microshift/config.default.yaml would break if passed to MicroShift.
	CsiComponentNullAlias OptionalCsiComponent = ""
)

type RouteAdmissionPolicy

type RouteAdmissionPolicy struct {
	// Describes how host name claims across namespaces should be handled.
	//
	// Value must be one of:
	//
	// - Strict: Do not allow routes in different namespaces to claim the same host.
	//
	// - InterNamespaceAllowed: Allow routes to claim different paths of the same
	//   host name across namespaces.
	//
	// If empty, the default is InterNamespaceAllowed.
	// +kubebuilder:default="InterNamespaceAllowed"
	NamespaceOwnership NamespaceOwnershipEnum `json:"namespaceOwnership"`
}

type Storage

type Storage struct {
	// Driver is a user defined string value matching one of the above CSIStorageDriver values. MicroShift uses this
	// value to decide whether to deploy the LVMS operator. An unset field defaults to "" during yaml parsing, and thus
	// could mean that the cluster has been upgraded. In order to support the existing out-of-box behavior, MicroShift
	// assumes an empty string to mean the storage driver should be deployed.
	// Allowed values are: unset or one of ["", "lvms", "none"]
	// +kubebuilder:validation:Optional
	Driver CSIStorageDriver `json:"driver,omitempty"`
	// OptionalCSIComponents is a user defined slice of CSIComponent values. These value tell MicroShift which
	// additional, non-driver, CSI controllers to deploy on start. MicroShift will deploy snapshot controller
	// and webhook when no components are specified. This preserves the current deployment behavior of existing
	// clusters. Users must set `.storage.optionalCsiComponents: []` to explicitly tell MicroShift not to deploy any CSI
	// components. The CSI Driver is excluded as it is typically deployed via the same manifest as the accompanying
	// storage driver. Like CSIStorageDriver, uninstallation is not supported as this can lead to orphaned storage
	// objects.
	// Allowed values are: unset, [], or one or more of ["snapshot-controller", "snapshot-webhook"]
	// +kubebuilder:validation:Optional
	// +kubebuilder:example={"snapshot-controller", "snapshot-webhook"}
	OptionalCSIComponents []OptionalCsiComponent `json:"optionalCsiComponents,omitempty"`
}

Storage represents a subfield of the MicroShift config data structure. Its purpose to provide a user facing interface to control whether MicroShift should deploy LVMS on startup.

func (Storage) IsEnabled

func (s Storage) IsEnabled() bool

IsEnabled returns false only when .storage.driver: "none". An empty value is considered "enabled" for backwards compatibility. Otherwise, the meaning of the config would silently change after an upgrade from enabled-by-default to disabled-by-default.

func (Storage) IsValid

func (s Storage) IsValid() []error

IsValid checks all sub-fields of a Storage object. The data is considered valid when both .driver and .csi-components are either empty strings or legitimate values. For .csi-components, the string "none" is mutually exclusive with all other values, valid or not.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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