|
| 1 | +using YamlDotNet.Serialization; |
| 2 | + |
| 3 | +namespace k8s.KubeConfigModels |
| 4 | +{ |
| 5 | + /// <summary> |
| 6 | + /// kubeconfig configuration model. Holds the information needed to build connect to remote |
| 7 | + /// Kubernetes clusters as a given user. |
| 8 | + /// </summary> |
| 9 | + /// <remarks> |
| 10 | + /// Should be kept in sync with https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/tools/clientcmd/api/v1/types.go |
| 11 | + /// Should update MergeKubeConfig in KubernetesClientConfiguration.ConfigFile.cs if updated. |
| 12 | + /// </remarks> |
| 13 | + [YamlSerializable] |
| 14 | + public class K8SConfiguration |
| 15 | + { |
| 16 | + // /// <summary> |
| 17 | + // /// Gets or sets general information to be use for CLI interactions |
| 18 | + // /// </summary> |
| 19 | + // [YamlMember(Alias = "preferences")] |
| 20 | + // public IDictionary<string, object> Preferences { get; set; } |
| 21 | + |
| 22 | + [YamlMember(Alias = "apiVersion")] |
| 23 | + public string ApiVersion { get; set; } |
| 24 | + |
| 25 | + [YamlMember(Alias = "kind")] |
| 26 | + public string Kind { get; set; } |
| 27 | + |
| 28 | + /// <summary> |
| 29 | + /// Gets or sets the name of the context that you would like to use by default. |
| 30 | + /// </summary> |
| 31 | + [YamlMember(Alias = "current-context", ApplyNamingConventions = false)] |
| 32 | + public string CurrentContext { get; set; } |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// Gets or sets a map of referencable names to context configs. |
| 36 | + /// </summary> |
| 37 | + [YamlMember(Alias = "contexts")] |
| 38 | + public List<Context> Contexts { get; set; } = new List<Context>(); |
| 39 | + |
| 40 | + /// <summary> |
| 41 | + /// Gets or sets a map of referencable names to cluster configs. |
| 42 | + /// </summary> |
| 43 | + [YamlMember(Alias = "clusters")] |
| 44 | + public List<Cluster> Clusters { get; set; } = new List<Cluster>(); |
| 45 | + |
| 46 | + /// <summary> |
| 47 | + /// Gets or sets a map of referencable names to user configs |
| 48 | + /// </summary> |
| 49 | + [YamlMember(Alias = "users")] |
| 50 | + public List<User> Users { get; set; } = new List<User>(); |
| 51 | + |
| 52 | + // /// <summary> |
| 53 | + // /// Gets or sets additional information. This is useful for extenders so that reads and writes don't clobber unknown fields. |
| 54 | + // /// </summary> |
| 55 | + // [YamlMember(Alias = "extensions")] |
| 56 | + // public List<NamedExtension> Extensions { get; set; } |
| 57 | + |
| 58 | + /// <summary> |
| 59 | + /// Gets or sets the name of the Kubernetes configuration file. This property is set only when the configuration |
| 60 | + /// was loaded from disk, and can be used to resolve relative paths. |
| 61 | + /// </summary> |
| 62 | + [YamlIgnore] |
| 63 | + public string FileName { get; set; } |
| 64 | + } |
| 65 | +} |
0 commit comments