Skip to content

Commit 3de2c1a

Browse files
ewassefbuehler
andauthored
feat: changing the kustomization commonLabels (#856)
#854 Co-authored-by: Christoph Bühler <[email protected]>
1 parent 201e14e commit 3de2c1a

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace KubeOps.Abstractions.Kustomize;
2+
3+
/// <summary>
4+
/// Common labels for the resources.
5+
/// </summary>
6+
public class KustomizationCommonLabels
7+
{
8+
public KustomizationCommonLabels(IDictionary<string, string> pairs)
9+
{
10+
Pairs.Add(new KustomizationCommonLabelsPair() { Pairs = pairs });
11+
}
12+
13+
/// <summary>
14+
/// A list of common labels.
15+
/// </summary>
16+
public List<KustomizationCommonLabelsPair> Pairs { get; set; } = new List<KustomizationCommonLabelsPair>();
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace KubeOps.Abstractions.Kustomize;
2+
3+
public class KustomizationCommonLabelsPair
4+
{
5+
/// <summary>
6+
/// A dictionary of common labels.
7+
/// </summary>
8+
public IDictionary<string, string>? Pairs { get; set; }
9+
10+
/// <summary>
11+
/// Include selectors.
12+
/// </summary>
13+
public bool IncludeSelectors { get; init; } = true;
14+
}

src/KubeOps.Abstractions/Kustomize/KustomizationConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public KustomizationConfig()
2626
/// <summary>
2727
/// Common labels for the resources.
2828
/// </summary>
29-
public IDictionary<string, string>? CommonLabels { get; set; }
29+
public KustomizationCommonLabels? Labels { get; set; }
3030

3131
/// <summary>
3232
/// Resource list.

src/KubeOps.Cli/Commands/Generator/OperatorGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private static async Task Handler(InvocationContext ctx)
116116
{
117117
NamePrefix = $"{name}-",
118118
Namespace = $"{name}-system",
119-
CommonLabels = new Dictionary<string, string> { { "operator", name }, },
119+
Labels = new KustomizationCommonLabels(new Dictionary<string, string> { { "operator", name }, }),
120120
Resources = result.DefaultFormatFiles.ToList(),
121121
Images =
122122
new List<KustomizationImage>

0 commit comments

Comments
 (0)