Click or drag to resize

KubeHelper Class

cluster related utilties.
Inheritance Hierarchy
SystemObject
  Neon.KubeKubeHelper

Namespace:  Neon.Kube
Assembly:  Neon.Kube (in Neon.Kube.dll) Version: 2.1.0
Syntax
public static class KubeHelper

The KubeHelper type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberCacheFolder
Returns the path the folder containing cached files for various environments.
Public propertyStatic memberClientCertificate
Returns the Kuberneties API client certificate for the current cluster context or null if we're not connected to a cluster.
Public propertyStatic memberClientConfig
Accesses the neonKUBE desktop client configuration.
Public propertyStatic memberClusterCertificate
Returns the Kuberneties API service certificate for the current cluster context or null if we're not connected to a cluster.
Public propertyStatic memberClustersFolder
Returns the path the folder containing cluster related files (including kube context extension), creating the folder if it doesn't already exist.
Public propertyStatic memberConfig
Returns the user's current Config.
Public propertyStatic memberCurrentContext
Returns the CurrentContext for the connected cluster or null when there is no current context.
Public propertyStatic memberCurrentContextName
Returns the current context's CurrentContextName or null if there's no current context.
Public propertyStatic memberDesktop
Returns the DesktopClient suitable for communicating with the neonKUBE desktop application.
Public propertyStatic memberDesktopFolder
Returns path to the neonKUBE desktop application state folder.
Public propertyStatic memberHeadend
Returns a HeadendClient.
Public propertyStatic memberHostPlatform
Returns the KubeHostPlatform for the current workstation.
Public propertyStatic memberInToolContainer
Returns true if the current application is running in the special neon-cli container as a shimmed application.
Public propertyStatic memberIsTestMode
Returns true if the class is running in test mode.
Public propertyStatic memberKubeConfigPath
Returns the path to the Kubernetes configuration file.
Public propertyStatic memberLogFolder
Returns the default directory path where neon-cli logs will be written.
Public propertyStatic memberPasswordsFolder
Returns path to the folder holding the encryption passwords.
Public propertyStatic memberProgramFolder
Returns the path to the neonKUBE program folder.
Public propertyStatic memberPwshPath
Returns the path to the Powershell Core executable to be used. This will first examine the NEONKUBE_PROGRAM_FOLDER environment variable to see if the installed version of Powershell Core should be used, otherwise it will simply return pwsh.exe so that the PATH will be searched.
Public propertyStatic memberRunFolder
Returns the directory path where the [neon run CMD ...] will copy secrets and run the command.
Public propertyStatic memberTempFolder
Returns the path the neonFORGE temporary folder, creating the folder if it doesn't already exist.
Public propertyStatic memberVmTemplatesFolder
Returns the path to the current user's cluster virtual machine templates folder, creating the directory if it doesn't already exist.
Top
Methods
  NameDescription
Public methodStatic memberEncryptSensitiveFiles
Ensures that sensitive folders and files on the local workstation are encrypted at rest for security purposes. These include the users .kube, .neonkube, and any the OpenVPN if it exists.
Public methodStatic memberExecInPod
Executes a command in a k8s pod.
Public methodStatic memberGetCachedComponentPath
Returns the path to the cached file for a specific named component with optional version.
Public methodStatic memberGetContextExtension
Returns the kubecontext extension for the structured configuration name.
Public methodStatic memberGetContextExtensionPath
Returns the path to the kubecontext extension file path for a specific context by raw name.
Public methodStatic memberGetKubeUserFolder
Returns the path the folder holding the user specific Kubernetes configuration files.
Public methodStatic memberGetNeonKubeUserFolder
Returns the path the folder holding the user specific Kubernetes files.
Public methodStatic memberGetPlatformCacheFolder
Returns the path to the folder containing cached files for the specified platform.
Public methodStatic memberInitContext
This is used for special situations for setting up a cluster to set an uninitialized Kubernetes config context as the current CurrentContext.
Public methodStatic memberInstallHelm

Ensures that helm tool whose version is at least as great as the requested cluster version is installed to the neonKUBE programs folder by copying the tool from the cache if necessary.

Note Note
This will probably require elevated privileges.
Note Note
This assumes that Helm has already been downloaded and cached and also that more recent Helm releases are backwards compatible with older deployed versions of Tiller.
Public methodStatic memberInstallKubeCtl

Ensures that kubectl tool whose version is at least as great as the Kubernetes cluster version is installed to the neonKUBE programs folder by copying the tool from the cache if necessary.

Note Note
This will probably require elevated privileges.
Note Note
This assumes that kubectl has already been downloaded and cached and also that more recent kubectl releases are backwards compatible with older deployed versions of Kubernetes.
Public methodStatic memberKubectl
Executes a kubectl command on the local workstation.
Public methodStatic memberLoadClientConfig
Loads or reloads the ClientConfig.
Public methodStatic memberLoadConfig
Loads or reloads the Kubernetes configuration.
Public methodStatic memberLookupPassword
Looks up a password given its name.
Public methodStatic memberPortForward
Executes a kubectl port-forward command on the local workstation.
Public methodStatic memberResetTestMode
Resets the test mode, restoring normal operation.
Public methodStatic memberSaveClientState
Persists the ClientConfig to disk.
Public methodStatic memberSetConfig
Rewrites the local kubeconfig file.
Public methodStatic memberSetCurrentContext(String)
Sets the current Kubernetes config context by string name.
Public methodStatic memberSetCurrentContext(KubeContextName)
Sets the current Kubernetes config context.
Public methodStatic memberSetLogger
Explicitly sets the class INeonLogger implementation. This defaults to a reasonable value.
Public methodStatic memberSetTestMode
Puts KubeHelper into test mode to support unit testing. This changes the folders where Kubernetes and neonKUBE persists their state to directories beneath the folder passed. This also modifies the KUBECONFIG environment variable to reference the new location.
Top
See Also