|
| 1 | +using Newtonsoft.Json; |
| 2 | + |
| 3 | +namespace ConplementAG.CopsController.Models |
| 4 | +{ |
| 5 | + public class K8SLimitRange |
| 6 | + { |
| 7 | + [JsonProperty("apiVersion")] |
| 8 | + public string ApiVersion { get; set; } |
| 9 | + |
| 10 | + [JsonProperty("kind")] |
| 11 | + public string Kind { get; set; } |
| 12 | + |
| 13 | + [JsonProperty("metadata")] |
| 14 | + public K8sMetadata Metadata { get; set; } |
| 15 | + |
| 16 | + [JsonProperty("spec")] |
| 17 | + public K8sSpec Spec { get; set; } |
| 18 | + |
| 19 | + public static K8SLimitRange Default(string namespacename) |
| 20 | + { |
| 21 | + return new K8SLimitRange |
| 22 | + { |
| 23 | + Kind = "LimitRange", |
| 24 | + ApiVersion = "v1", |
| 25 | + Metadata = new K8sMetadata { Name = "copsnamespace-default-limitrange", Namespace = namespacename }, |
| 26 | + Spec = new K8sSpec |
| 27 | + { |
| 28 | + Limits = new[] |
| 29 | + { |
| 30 | + new K8sLimit{ |
| 31 | + Default = new K8sDefault {Cpu = "20m", Memory = "50Mi"}, |
| 32 | + DefaultRequest = new K8sDefault {Cpu = "10m", Memory = "25Mi"}, |
| 33 | + Type = "Container" |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | + }; |
| 38 | + } |
| 39 | + } |
| 40 | + |
| 41 | + public class K8sSpec |
| 42 | + { |
| 43 | + [JsonProperty("limits")] |
| 44 | + public K8sLimit[] Limits { get; set; } |
| 45 | + } |
| 46 | + |
| 47 | + public class K8sLimit |
| 48 | + { |
| 49 | + [JsonProperty("default")] |
| 50 | + public K8sDefault Default { get; set; } |
| 51 | + |
| 52 | + [JsonProperty("defaultRequest")] |
| 53 | + public K8sDefault DefaultRequest { get; set; } |
| 54 | + |
| 55 | + [JsonProperty("type")] |
| 56 | + public string Type { get; set; } |
| 57 | + } |
| 58 | + |
| 59 | + public class K8sDefault |
| 60 | + { |
| 61 | + [JsonProperty("cpu")] |
| 62 | + public string Cpu { get; set; } |
| 63 | + |
| 64 | + [JsonProperty("memory")] |
| 65 | + public string Memory { get; set; } |
| 66 | + } |
| 67 | +} |
0 commit comments