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" // TLSDir is the directory for storing WMCO tls certs TLSDir = K8sDir + "\\tls" // TLSConfPath is the location of TLS config files TLSConfPath = TLSDir + "\\windows-exporter-webconfig.yaml" // TLSCertsPath is the location of TLS cert files TLSCertsPath = TLSDir + "\\certs" ContainerdPath = ContainerdDir + "\\containerd.exe" // ContainerdConfPath is the location of containerd config file ContainerdConfPath = ContainerdDir + "\\containerd_conf.toml" // ContainerdConfigDir is the remote directory for containerd registry config ContainerdConfigDir = ContainerdDir + "\\registries" // 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" // WindowsExporterPath is the location of the windows_exporter.exe WindowsExporterPath = K8sDir + "\\windows_exporter.exe" // 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" // KubeProxyConfigPath is the location of the kube proxy configuration file KubeProxyConfigPath = K8sDir + "\\kube-proxy.conf" // 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" // 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" // WICDKubeconfigPath is the path of the kubeconfig used by WICD WICDKubeconfigPath = K8sDir + "\\wicd-kubeconfig" // TrustedCABundlePath is the location of the trusted CA bundle file TrustedCABundlePath = K8sDir + "\\ca-bundle.crt" // GetHostnameFQDNCommand is the PowerShell command to get the FQDN hostname of the Windows instance GetHostnameFQDNCommand = "$output = Invoke-Expression 'ipconfig /all'; " + "$hostNameLine = ($output -split '`n') | Where-Object { $_ -match 'Host Name' }; " + "$dnsSuffixLine = ($output -split '`n') | Where-Object { $_ -match 'Primary Dns Suffix' }; " + "$hostName = ($hostNameLine -split ':')[1].Trim(); " + "$dnsSuffix = ($dnsSuffixLine -split ':')[1].Trim(); " + "if (-not $dnsSuffix) { return $hostName }; " + "$fqdn = $hostName + '.' + $dnsSuffix; " + "return $fqdn" )
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, ContainerdConfigDir, podManifestDirectory, K8sDir, TLSDir, } )
Functions ¶
Types ¶
type AuthErr ¶
type AuthErr struct {
// contains filtered or unexported fields
}
AuthErr occurs when our authentication into the VM is rejected
type Windows ¶
type Windows interface { // GetIPv4Address returns the IPv4 address of the associated instance. GetIPv4Address() string // GetHostname returns the FQDN of the associated instance including the domain name, if any GetHostname() (string, error) // 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) // ReplaceDir transfers the given files to their given paths within the remote directory the Windows instance. // The destination dir will only contain the given files after this function is called, clearing existing content. ReplaceDir(map[string][]byte, string) 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(context.Context) error // Bootstrap prepares the Windows instance and runs the WICD bootstrap command Bootstrap(context.Context, 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 Close() error }
Windows contains all the methods needed to configure a Windows VM to become a worker node
Click to show internal directories.
Click to hide internal directories.