Class KubeSetupState
Holds cluster provisioning related state.
Namespace: Neon.Kube
Assembly: Neon.Kube.dll
Syntax
public class KubeSetupState
Remarks
NEONKUBE cluster provisioning includes two major phases, **prepare** and **setup**, where preparing the cluster involves initializing infrastructure, including configuring the network and creating the virtual machines that will host the cluster. Cluster setup is where we configure Kubernetes, install the necessary components, and then wrap up any network configuration.
The prepare and setup steps need a temporary place to persist information that will bew required later. For example, prepare generates the SSH credentials that setup will need to perform node operations. This class persists its state to YAML files located in the SetupFolder, with the file names set to the Kubernetes context name for the cluster.
Constructors
KubeSetupState()
Default constructor.
Declaration
public KubeSetupState()
Properties
ClusterDefinition
Specifies the cluster definition.
Declaration
[JsonProperty(PropertyName = "ClusterDefinition", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "clusterDefinition", ApplyNamingConventions = false)]
public ClusterDefinition ClusterDefinition { get; set; }
Property Value
| Type | Description |
|---|---|
| ClusterDefinition |
ClusterDomain
Specifies the cluster DNS domain. NEONKUBE generates a domain like GUID.neoncluster.io for your cluster by default when this is not set.
note
Setting this to a specific domain that you've already registered is not supported at this time and will be ignored.
Declaration
[JsonProperty(PropertyName = "ClusterDomain", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "clusterDomain", ApplyNamingConventions = false)]
public string ClusterDomain { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
The idea here is that NEONKUBE will be use the generated domain to deploy a fully functional cluster out-of-the-box, with real DNS records and a SSL certificate. This works even for clusters deployed behind a firewall or NEONDESKTOP clusters running on a workstation or laptop.
In the future, we plan to support custom DNS domains where these are pre-registered by the customer or we manage the DNS hosts on behalf of the customer via a domain registar API.
ClusterId
The unique cluster ID. This is generated during cluster setup and must not be specified by the user.
Declaration
[JsonProperty(PropertyName = "ClusterId", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "clusterId", ApplyNamingConventions = false)]
public string ClusterId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ClusterJoinCommand
Specifies the command to be used join nodes to an existing cluster.
Declaration
[JsonProperty(PropertyName = "ClusterJoinCommand", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "clusterJoinCommand", ScalarStyle = ScalarStyle.Literal, ApplyNamingConventions = false)]
public string ClusterJoinCommand { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ClusterName
The cluster name.
Declaration
[JsonProperty(PropertyName = "ClusterName", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "clusterName", ApplyNamingConventions = false)]
public string ClusterName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ClusterVersion
Specifies the NEONKUBE version of the cluster. This is formatted as a SemanticVersion.
Declaration
[JsonProperty(PropertyName = "ClusterVersion", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "clusterVersion", ApplyNamingConventions = false)]
public string ClusterVersion { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ContextName
Identifies the KubeConfig context that will be created locally for the cluster being setup.
Declaration
[JsonProperty(PropertyName = "ContextName", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "contextName", ApplyNamingConventions = false)]
public string ContextName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ControlNodeFiles
Holds files captured from the boot control-plane node that will need to be provisioned on the remaining control-plane nodes. The dictionary key is the file path and the value specifies the file text, permissions, and owner.
Declaration
[JsonProperty(PropertyName = "ControlNodeFiles", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "controlNodeFiles", ScalarStyle = ScalarStyle.Literal, ApplyNamingConventions = false)]
public Dictionary<string, KubeFileDetails> ControlNodeFiles { get; set; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, KubeFileDetails> |
DeploymentStatus
Indicates the cluster deployment state.
Declaration
[JsonProperty(PropertyName = "DeploymentStatus", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "deploymentStatus", ApplyNamingConventions = false)]
public ClusterDeploymentStatus DeploymentStatus { get; set; }
Property Value
| Type | Description |
|---|---|
| ClusterDeploymentStatus |
NeonCloudToken
Holds the JWT used to authenticate with NEONCLOUD headend services.
Declaration
[JsonProperty(PropertyName = "NeonCloudToken", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "neonCloudToken", ScalarStyle = ScalarStyle.Literal, ApplyNamingConventions = false)]
public string NeonCloudToken { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
PublicAddresses
Specifies any public IP addresses for the cluster.
Declaration
[JsonProperty(PropertyName = "PublicAddresses", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "publicAddresses", ApplyNamingConventions = false)]
public List<string> PublicAddresses { get; set; }
Property Value
| Type | Description |
|---|---|
| List<string> |
SshCredentials
Returns a SshCredentials instance suitable for connecting to a cluster node.
Declaration
[JsonIgnore]
[YamlIgnore]
public SshCredentials SshCredentials { get; }
Property Value
| Type | Description |
|---|---|
| SshCredentials |
SshKey
Specifies the public and private parts of the SSH client key used to authenticate a SSH session with a cluster node.
Declaration
[JsonProperty(PropertyName = "SshClientKey", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "sshClientKey", ApplyNamingConventions = false)]
public KubeSshKey SshKey { get; set; }
Property Value
| Type | Description |
|---|---|
| KubeSshKey |
SshPassword
Specifies the SSH admin password.
note
Technically, this is actually the admin user account password on the cluster nodes, not an SSH password because clusters disable SSH password authentication.
Declaration
[JsonProperty(PropertyName = "SshPassword", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "sshPassword", ApplyNamingConventions = false)]
public string SshPassword { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
SshUsername
The SSH admin username.
Declaration
[JsonProperty(PropertyName = "SshUsername", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "sshUsername", ApplyNamingConventions = false)]
public string SshUsername { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
SsoPassword
The SSO admin password.
Declaration
[JsonProperty(PropertyName = "SsoPassword", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "ssoPassword", ApplyNamingConventions = false)]
public string SsoPassword { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
SsoUsername
The SSO admin username.
Declaration
[JsonProperty(PropertyName = "SsoUsername", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[YamlMember(Alias = "ssoUsername", ApplyNamingConventions = false)]
public string SsoUsername { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Create(string)
Creates a new KubeSetupState instance to be used to persist setup state about the named cluster.
Declaration
public static KubeSetupState Create(string contextName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contextName | Specifies the Kubernetes context name for the cluster. |
Returns
| Type | Description |
|---|---|
| KubeSetupState | The new instance. |
Remarks
note
This removes any existing file persisting this information.
Delete()
Removes the file associated with the details, if it exists.
Declaration
public void Delete()
Delete(string)
Deletes the setup state file for a cluster, if it exists.
Declaration
public static void Delete(string contextName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contextName | Specifies the Kubernetes context name for the cluster. |
Exists(string)
Determines whether a setup state file exists for a cluster.
Declaration
public static bool Exists(string contextName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contextName | Specifies the Kubernetes context name for the cluster. |
Returns
| Type | Description |
|---|---|
| bool |
|
GetPath(string)
Returns the file path where the details will be persisted.
Declaration
public static string GetPath(string contextName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contextName | Specifies the Kubernetes context name for the cluster. |
Returns
| Type | Description |
|---|---|
| string | The file path. |
Load(string, bool)
Loads setup state for the named cluster from its file.
Declaration
public static KubeSetupState Load(string contextName, bool nullIfMissing = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contextName | Specifies the Kubernetes context name for the cluster. |
| bool | nullIfMissing | Optionally return |
Returns
| Type | Description |
|---|---|
| KubeSetupState | The instance loaded from the file. |
Exceptions
| Type | Condition |
|---|---|
| FileNotFoundException | Thrown when the file doesn't exist and |
LoadOrCreate(string)
Loads setup state for the named cluster from its file when that exists, otherwise creates an unintialized instance.
Declaration
public static KubeSetupState LoadOrCreate(string contextName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contextName | Specifies the Kubernetes context name for the cluster. |
Returns
| Type | Description |
|---|---|
| KubeSetupState | The instance loaded or created instance. |
Exceptions
| Type | Condition |
|---|---|
| FileNotFoundException | Thrown when the file doesn't exist. |
Save()
Persists the details to its associated file.
Declaration
public void Save()
ToKubeClusterInfo()
Returns a KubeClusterInfo instance initialized from this instance.
Declaration
public KubeClusterInfo ToKubeClusterInfo()
Returns
| Type | Description |
|---|---|
| KubeClusterInfo | The KubeClusterInfo. |