config

package
v0.0.0-...-b15b4ae Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 24 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ConfigFile = "/etc/microshift/config.yaml"
	DataDir    = "/var/lib/microshift"
	BackupsDir = "/var/lib/microshift-backups"
)
View Source
const (
	NamespaceOwnershipStrict  NamespaceOwnershipEnum = "Strict"
	NamespaceOwnershipAllowed NamespaceOwnershipEnum = "InterNamespaceAllowed"
	StatusManaged             IngressStatusEnum      = "Managed"
	StatusRemoved             IngressStatusEnum      = "Removed"
)
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() ([]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:"-"`
}

type AuditLog

type AuditLog struct {
	// maxFileAge is the maximum number of days to retain old audit log files
	// +kubebuilder:default=10
	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 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"`

	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. If the configuration file exists, read it and require it to be valid. Otherwise return the default settings.

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) 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.

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 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"`
	// 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:"-"`
}

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) 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 {
	// 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:"-"`
}

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"`
}

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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