windows

package
v0.0.0-...-e561cac Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// GcpGetHostnameScriptRemotePath is the remote location of the PowerShell script that resolves the hostname
	// for GCP instances
	GcpGetHostnameScriptRemotePath = remoteDir + "\\" + payload.GcpGetHostnameScriptName
	// WinDefenderExclusionScriptRemotePath is the remote location of the PowerShell script that creates an exclusion
	// for containerd if the Windows Defender Antivirus is active
	WinDefenderExclusionScriptRemotePath = remoteDir + "\\" + payload.WinDefenderExclusionScriptName
	// HNSPSModule is the remote location of the hns.psm1 module
	HNSPSModule = remoteDir + "\\hns.psm1"
	// K8sDir is the remote kubernetes executable directory
	K8sDir = "C:\\k"
	// CredentialProviderConfig is the config file for the credential provider
	CredentialProviderConfig = K8sDir + "\\credential-provider-config.yaml"
	// KubeconfigPath is the remote location of the kubelet's kubeconfig
	KubeconfigPath = K8sDir + "\\kubeconfig"

	// KubeletLogDir is the remote kubelet log directory
	KubeletLogDir = logDir + "\\kubelet"
	// KubeProxyLogDir is the remote kube-proxy log directory
	KubeProxyLogDir = logDir + "\\kube-proxy"
	// HybridOverlayLogDir is the remote hybrid-overlay log directory
	HybridOverlayLogDir = logDir + "\\hybrid-overlay"

	// CniConfDir is the directory for storing CNI configuration
	CniConfDir = cniDir + "\\config"
	// ContainerdDir is the directory for storing Containerd binary
	ContainerdDir = K8sDir + "\\containerd"
	// ContainerdPath is the location of the containerd exe
	ContainerdPath = ContainerdDir + "\\containerd.exe"
	// ContainerdConfPath is the location of containerd config file
	ContainerdConfPath = ContainerdDir + "\\containerd_conf.toml"

	// ContainerdLogPath is the location of the containerd log file
	ContainerdLogPath = containerdLogDir + "\\containerd.log"
	// ContainerdServiceName is containerd Windows service name
	ContainerdServiceName = "containerd"
	// WicdServiceName is the Windows service name for WICD
	WicdServiceName = "windows-instance-config-daemon"

	// NetworkConfScriptPath is the location of the network configuration script
	NetworkConfScriptPath = remoteDir + "\\network-conf.ps1"
	// AzureCloudNodeManagerPath is the location of the azure-cloud-node-manager.exe
	AzureCloudNodeManagerPath = K8sDir + "\\" + payload.AzureCloudNodeManager
	// ECRCredentialProviderPath is the location of ecr credential provider exe
	ECRCredentialProviderPath = K8sDir + "\\ecr-credential-provider.exe"

	// BootstrapKubeconfigPath is the location of the bootstrap kubeconfig
	BootstrapKubeconfigPath = K8sDir + "\\bootstrap-kubeconfig"
	// KubeletPath is the location of the kubelet exe
	KubeletPath = K8sDir + "\\kubelet.exe"
	// KubeLogRunnerPath is the location of the kube-log-runner exe
	KubeLogRunnerPath = K8sDir + "\\kube-log-runner.exe"
	// KubeletConfigPath is the location of the kubelet configuration file
	KubeletConfigPath = K8sDir + "\\kubelet.conf"
	// KubeletLog is the location of the kubelet log file
	KubeletLog = KubeletLogDir + "\\kubelet.log"
	// KubeProxyLog is the location of the kube-proxy log file
	KubeProxyLog = KubeProxyLogDir + "\\kube-proxy.log"
	// KubeProxyPath is the location of the kube-proxy exe
	KubeProxyPath = K8sDir + "\\kube-proxy.exe"
	// CSIProxyPath is the location of the csi-proxy exe
	CSIProxyPath = K8sDir + "\\csi-proxy.exe"

	// CSIProxyLog is the location of the csi-proxy log file
	CSIProxyLog = csiProxyLogDir + "\\csi-proxy.log"
	// HybridOverlayPath is the location of the hybrid-overlay-node exe
	HybridOverlayPath = K8sDir + "\\hybrid-overlay-node.exe"
	// HybridOverlayServiceName is the name of the hybrid-overlay-node Windows service
	HybridOverlayServiceName = "hybrid-overlay-node"
	// BaseOVNKubeOverlayNetwork is the name of base OVN HNS Overlay network
	BaseOVNKubeOverlayNetwork = "BaseOVNKubernetesHybridOverlayNetwork"
	// OVNKubeOverlayNetwork is the name of the OVN HNS Overlay network
	OVNKubeOverlayNetwork = "OVNKubernetesHybridOverlayNetwork"
	// KubeProxyServiceName is the name of the kube-proxy Windows service
	KubeProxyServiceName = "kube-proxy"
	// KubeletServiceName is the name of the kubelet Windows service
	KubeletServiceName = "kubelet"
	// WindowsExporterServiceName is the name of the windows_exporter Windows service
	WindowsExporterServiceName = "windows_exporter"
	// AzureCloudNodeManagerServiceName is the name of the azure cloud node manager service
	AzureCloudNodeManagerServiceName = "cloud-node-manager"
	// WindowsExporterServiceCommand specifies metrics for the windows_exporter service to collect
	// and expose metrics at endpoint with default port :9182 and default URL path /metrics
	WindowsExporterServiceCommand = windowsExporterPath + " --collectors.enabled " +
		"cpu,cs,logical_disk,net,os,service,system,textfile,container,memory,cpu_info"

	// ManagedTag indicates that the service being described is managed by OpenShift. This ensures that all services
	// created as part of Node configuration can be searched for by checking their description for this string
	ManagedTag = "OpenShift managed"

	// TrustedCABundlePath is the location of the trusted CA bundle file
	TrustedCABundlePath = remoteDir + "\\ca-bundle.crt"
)

Variables

View Source
var (
	// RequiredServices is a list of Windows services installed by WMCO. WICD owns all services aside from itself.
	// The order of this slice matters due to service dependencies. If a service depends on another service, the
	// dependent service should be placed before the service it depends on.
	RequiredServices = []string{
		WindowsExporterServiceName,
		KubeProxyServiceName,
		HybridOverlayServiceName,
		KubeletServiceName,
		WicdServiceName,
		ContainerdServiceName}
	// RequiredDirectories is a list of directories to be created by WMCO
	RequiredDirectories = []string{
		remoteDir,
		cniDir,
		CniConfDir,
		logDir,
		KubeletLogDir,
		csiProxyLogDir,
		KubeProxyLogDir,
		wicdLogDir,
		HybridOverlayLogDir,
		ContainerdDir,
		containerdLogDir,
		podManifestDirectory,
		K8sDir,
	}
)

Functions

func GetK8sDir

func GetK8sDir() string

GetK8sDir returns the location of the kubernetes executable directory

func SplitPath

func SplitPath(filepath string) (dir string, fileName string)

SplitPath splits a Windows file path into the directory and base file name. Example: 'C:\\k\\bootstrap-kubeconfig' --> dir: 'C:\\k\\', fileName: 'bootstrap-kubeconfig'

Types

type AuthErr

type AuthErr struct {
	// contains filtered or unexported fields
}

AuthErr occurs when our authentication into the VM is rejected

func (*AuthErr) Error

func (e *AuthErr) Error() string

type Windows

type Windows interface {
	// GetIPv4Address returns the IPv4 address of the associated instance.
	GetIPv4Address() string
	// EnsureFile ensures the given file exists within the specified directory on the Windows VM. The file will be copied
	// to the Windows VM if it is not present or if it has the incorrect contents. The remote directory is created if it
	// does not exist.
	EnsureFile(*payload.FileInfo, string) error
	// EnsureFileContent ensures the given filename and content exists within the specified directory on the Windows VM.
	// The content will be copied to the Windows VM if the file is not present or has incorrect contents. The remote
	// directory is created if it does not exist.
	EnsureFileContent([]byte, string, string) error
	// FileExists returns true if a specific file exists at the given path and checksum on the Windows VM. Set an
	// empty checksum (checksum == "") to disable checksum check.
	FileExists(string, string) (bool, error)
	// Run executes the given command remotely on the Windows VM over a ssh connection and returns the combined output
	// of stdout and stderr. If the bool is set, it implies that the cmd is to be execute in PowerShell. This function
	// should be used in scenarios where you want to execute a command that runs in the background. In these cases we
	// have observed that Run() returns before the command completes and as a result killing the process.
	Run(string, bool) (string, error)
	// RebootAndReinitialize reboots the instance and re-initializes the Windows SSH client
	RebootAndReinitialize() error
	// Bootstrap prepares the Windows instance and runs the WICD bootstrap command
	Bootstrap(string, string, string) error
	// ConfigureWICD ensures that the Windows Instance Config Daemon is running on the node
	ConfigureWICD(string, string) error
	// RemoveFilesAndNetworks removes all files and networks created by WMCO
	RemoveFilesAndNetworks() error
	// RunWICDCleanup ensures the WICD service is stopped and runs the cleanup command that ensures all WICD-managed
	// services are also stopped
	RunWICDCleanup(string, string) error
	// RestoreAWSRoutes restores the default routes on AWS VMs. This function should not be called on non-AWS VMs
	RestoreAWSRoutes() error
}

Windows contains all the methods needed to configure a Windows VM to become a worker node

func New

func New(clusterDNS string, instanceInfo *instance.Info, signer ssh.Signer, platform *config.PlatformType) (Windows, error)

New returns a new Windows instance constructed from the given WindowsVM

Jump to

Keyboard shortcuts

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