Documentation ¶
Index ¶
- Constants
- func AddFile(ign *igntypes.Config, f *File) error
- func AddGroup(ign *igntypes.Config, g *Group) error
- func AddUnit(ign *igntypes.Config, unit *igntypes.Unit) *igntypes.Config
- func AddUser(ign *igntypes.Config, u *User) error
- func ContainerConfiguration(registry string) (*igntypes.Config, error)
- func FromBytes(in []byte) (*igntypes.Config, error)
- func FromPath(path string) (*igntypes.Config, error)
- func FromString(in string) (*igntypes.Config, error)
- func GenerateClusterConfigurationYaml(ci *ClusterInit) (string, error)
- func GenerateKubeProxyConfigurationYaml(proxyMode string) (string, error)
- func GenerateKubeadmInitYaml(ci *ClusterInit) (string, error)
- func GenerateKubeadmJoinYaml(cj *ClusterJoin) (string, error)
- func InitializeCluster(ci *ClusterInit) (*igntypes.Config, error)
- func JoinCluster(cj *ClusterJoin) (*igntypes.Config, error)
- func MarshalIgnition(ign *igntypes.Config) ([]byte, error)
- func Merge(a *igntypes.Config, b *igntypes.Config) *igntypes.Config
- func NewIgnition() *igntypes.Config
- func OcneUser(sshKey string, sshKeyPath string, password string) (*igntypes.Config, error)
- func Proxy(inProxy *types.Proxy, noProxies ...string) (*igntypes.Config, error)
- type ApiServer
- type ApiServerExtraArgs
- type BootstrapTokenDiscovery
- type ClusterConfig
- type ClusterInit
- type ClusterJoin
- type ControlPlane
- type ControllerManager
- type ControllerManagerExtraArgs
- type CustomImage
- type DNS
- type Discovery
- type Etcd
- type EtcdExtraArgs
- type EtcdLocal
- type File
- type FileContents
- type Group
- type IgnitionData
- type InitConfig
- type JoinConfig
- type KubeProxy
- type KubeletExtraArgs
- type LocalAPIEndpoint
- type NetworkScript
- type Networking
- type NodeRegistration
- type Scheduler
- type SchedulerExtraArgs
- type User
Constants ¶
const ( Country = "US" Org = "OCNE" OrgUnit = "OCNE" State = "TX" InitConfigAPIVersion = "kubeadm.k8s.io/v1beta3" InitConfigKind = "InitConfiguration" JoinConfigAPIVersion = "kubeadm.k8s.io/v1beta3" JoinConfigKind = "JoinConfiguration" KubeadmFilePath = "/etc/kubernetes/kubeadm.conf" CaCrtFilePath = "/etc/kubernetes/pki/ca.crt" CaKeyFilePath = "/etc/kubernetes/pki/ca.key" VolumePluginDir = "/var/lib/kubelet/volumeplugins" KubeProxyMode = "iptables" ActionInit = "init" ActionJoin = "join" KubeletServiceName = "kubelet.service" CrioServiceName = "crio.service" IscsidServiceName = "iscsid.service" // Note that OcneServiceCommonBootstrapPatthen has and seemingly // pointless endline. That endline is actually very important. // There is a bug in the coreos/go-systemd library used by ignition // that is not capable of handling unit files that do not with with // and endline. It counts all such lines as "too long". // // Please refer to this: https://github.com/coreos/go-systemd/blob/v22.5.0/unit/deserialize.go#L153 OcneServiceName = "ocne.service" OcneServiceCommonBootstrapPattern = `[Service] Environment=ACTION={{.Action}} Environment=NET_INTERFACE={{.NetInterface}} ` OcneUpdateServiceName = "ocne-update.service" OcneUpdateConfigPath = "/etc/ocne/update.yaml" OcneUpdateYamlPattern = `registry: %s tag: %s transport: %s ` // Populating core configuration files, such as crio.conf and the // kubeadm init/join files have been moved to the "files" section // of ignition. The script baked in to the OS image are not aware // of this and continue to assume that it needs to generate them. // Until the OS image is updated, overwrite that script with this // simper one. OcneSh = `` /* 1498-byte string literal not displayed */ ContainerRegistryPath = "/etc/containers/registries.conf" ContainerRegistryPattern = `unqualified-search-registries = ["{{.}}"] ` NetworkScriptPattern = `` /* 437-byte string literal not displayed */ ProxyDropinPattern = `` /* 289-byte string literal not displayed */ )
const (
IgnitionVersion = "3.4.0"
)
const (
KeepAlivedConfigTemplatePath = "/etc/ocne/keepalived.conf.tmpl"
)
Variables ¶
This section is empty.
Functions ¶
func AddFile ¶
AddFile adds a file with the correct variables set, and also checks for any conflicts that may have occurred.
func AddGroup ¶
AddGroup adds a group with the correct variables set, and also checks for any conflicts that may have occurred.
func AddUser ¶
AddUser adds a user with the correct variables set, and also checks for any conflicts that may have occurred.
func ContainerConfiguration ¶
func FromBytes ¶
FromBytes generates an ignition structure from a string. Both ignition and butane formats are accepted.
func FromPath ¶
FromPath generates an ignition structure from a path. If the path is a directory, it merges together all valid ignition files in the directory. If it is a file, it uses just the file.
func FromString ¶
FromString generates an ignition structure from a string. Both ignition and butane formats are accepted.
func GenerateClusterConfigurationYaml ¶
func GenerateClusterConfigurationYaml(ci *ClusterInit) (string, error)
func GenerateKubeadmInitYaml ¶
func GenerateKubeadmInitYaml(ci *ClusterInit) (string, error)
func GenerateKubeadmJoinYaml ¶
func GenerateKubeadmJoinYaml(cj *ClusterJoin) (string, error)
func InitializeCluster ¶
func InitializeCluster(ci *ClusterInit) (*igntypes.Config, error)
func JoinCluster ¶
func JoinCluster(cj *ClusterJoin) (*igntypes.Config, error)
func MarshalIgnition ¶
Marshal converts and ignition configuration to a byte array containing the json encoding of the configuration.
func NewIgnition ¶
NewIgnition initializes an Ingition with no settings.
Types ¶
type ApiServer ¶
type ApiServer struct { CertSans []string `yaml:"certSANs,omitempty"` ExtraArgs ApiServerExtraArgs `yaml:"extraArgs,omitempty"` }
type ApiServerExtraArgs ¶
type BootstrapTokenDiscovery ¶
type ClusterConfig ¶
type ClusterConfig struct { ApiVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` ApiServer ApiServer `yaml:"apiServer,omitempty"` ControllerManager ControllerManager `yaml:"controllerManager,omitempty"` Scheduler Scheduler `yaml:"scheduler,omitempty"` Networking Networking `yaml:"networking"` ImageRepository string `yaml:"imageRepository"` KubernetesVersion string `yaml:"kubernetesVersion"` ControlPlaneEndpoint string `yaml:"controlPlaneEndpoint,omitempty"` Etcd Etcd `yaml:"etcd"` DNS DNS `yaml:"dns"` }
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/ https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/ https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta3/#kubeadm-k8s-io-v1beta3-ControlPlaneComponent
func GenerateClusterConfiguration ¶
func GenerateClusterConfiguration(ci *ClusterInit, kubeVersions versions.KubernetesVersions) *ClusterConfig
type ClusterInit ¶
type ClusterInit struct { OsTag string OsRegistry string ImageRegistry string KubeAPIServerIP string KubeAPIBindPort uint16 KubeAPIBindPortAlt uint16 InternalLB bool Proxy types.Proxy KubeAPIExtraSans []string KubePKICert string KubePKIKey string ServiceSubnet string PodSubnet string ExpectingWorkerNodes bool ProxyMode string NetInterface string UploadCertificateKey string KubeVersion string TLSCipherSuites string }
type ClusterJoin ¶
type ClusterJoin struct { Role clustertypes.NodeRole OsTag string OsRegistry string ImageRegistry string KubeAPIServerIP string JoinToken string KubePKICertHashes []string KubeAPIBindPort uint16 KubeAPIBindPortAlt uint16 InternalLB bool Proxy types.Proxy ProxyMode string NetInterface string UploadCertificateKey string TLSCipherSuites string }
type ControlPlane ¶
type ControlPlane struct { LocalAPIEndPoint LocalAPIEndpoint `yaml:"localAPIEndpoint"` CertificateKey string `yaml:"certificateKey,omitempty"` }
type ControllerManager ¶
type ControllerManager struct {
ExtraArgs ControllerManagerExtraArgs `yaml:"extraArgs,omitempty"`
}
type CustomImage ¶
type CustomImage struct { ImageRepository string `yaml:"imageRepository"` ImageTag string `yaml:"imageTag"` }
CustomImage defines the custom image and tag
type Discovery ¶
type Discovery struct {
BootstrapToken BootstrapTokenDiscovery `yaml:"bootstrapToken,omitempty"`
}
type Etcd ¶
type Etcd struct {
Local EtcdLocal `yaml:"local"`
}
Etcd represents the etcd object in the cluster config. This is used to modify the etcd image registy and tag
type EtcdExtraArgs ¶
type EtcdExtraArgs struct { TLSCipherSuites string `yaml:"cipher-suites,omitempty"` ListenClientURLs string `yaml:"listen-client-urls,omitempty"` ListenPeerURLs string `yaml:"listen-peer-urls,omitempty"` ListenMetricsURLs string `yaml:"listen-metrics-urls,omitempty"` AdvertiseClientURLs string `yaml:"advertise-client-urls,omitempty"` InitialAdvertisePeersURLs string `yaml:"initial-advertise-peer-urls,omitempty"` }
type EtcdLocal ¶
type EtcdLocal struct { CustomImage `yaml:",inline"` ExtraArgs EtcdExtraArgs `yaml:"extraArgs"` PeerCertSans []string `yaml:"peerCertSANs"` }
EtcdLocal defines configuration options for etcd to be used in a kubeadm config definition
type File ¶
type File struct { Path string `json:"path"` Filesystem string `json:"filesystem"` Mode int `json:"mode"` Contents FileContents `json:"contents"` Overwrite bool ` json:"overwrite"` // contains filtered or unexported fields }
type FileContents ¶
type FileContents struct {
Source string `json:"source"`
}
type IgnitionData ¶
func GenerateAssetsForVirtualIp ¶
func GenerateAssetsForVirtualIp(bindPort uint16, altPort uint16, virtualIP string, proxy *types.Proxy, netInterface string) (*IgnitionData, error)
GenerateAssetsForVirtualIp generates file and systemd unit contents for configuring control plane HA using a virtual IP
type InitConfig ¶
type InitConfig struct { ApiVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` LocalAPIEndpoint LocalAPIEndpoint `yaml:"localAPIEndpoint,omitempty"` NodeRegistration NodeRegistration `yaml:"nodeRegistration,omitempty"` CertificateKey string `yaml:"certificateKey,omitempty"` }
func GenerateKubeadmInit ¶
func GenerateKubeadmInit(ci *ClusterInit) *InitConfig
type JoinConfig ¶
type JoinConfig struct { ApiVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` ControlPlane ControlPlane `yaml:"controlPlane,omitempty"` NodeRegistration NodeRegistration `yaml:"nodeRegistration,omitempty"` Discovery Discovery `yaml:"discovery,omitempty"` }
func GenerateKubeadmJoin ¶
func GenerateKubeadmJoin(cj *ClusterJoin) *JoinConfig
type KubeProxy ¶
type KubeProxy struct { ApiVersion string `yaml:"apiVersion"` Kind string `yaml:"kind"` Mode string `yaml:"mode"` MetricsBindAddress string `yaml:"metricsBindAddress"` }
https://kubernetes.io/docs/reference/config-api/kube-proxy-config.v1alpha1/
type KubeletExtraArgs ¶
type KubeletExtraArgs struct { NodeIP string `yaml:"node-ip,omitempty"` TLSMinVersion string `yaml:"tls-min-version,omitempty"` TLSCipherSuites string `yaml:"tls-cipher-suites,omitempty"` Address string `yaml:"address,omitempty"` AuthorizationMode string `yaml:"authorization-mode,omitempty"` VolumePluginDir string `yaml:"volume-plugin-dir,omitempty"` }
type LocalAPIEndpoint ¶
type NetworkScript ¶
type NetworkScript struct { Name string Type string OnBoot bool BrowserOnly bool BootProto string DefaultRoute bool ProxyMode string IPV4FailureFatal bool IPV6Init bool IPV6Autoconf bool IPV6DefaultRoute bool IPV6FailureFatal bool IPV6AddrGenMode string }
func DefaultNetwork ¶
func DefaultNetwork() *NetworkScript
func (*NetworkScript) ToFile ¶
func (n *NetworkScript) ToFile() (*File, error)
type Networking ¶
type NodeRegistration ¶
type NodeRegistration struct { KubeletExtraArgs KubeletExtraArgs `yaml:"kubeletExtraArgs"` Taints *[]string `yaml:"taints"` }
type Scheduler ¶
type Scheduler struct {
ExtraArgs SchedulerExtraArgs `yaml:"extraArgs,omitempty"`
}