Skip to content

Commit 8acb511

Browse files
authored
Metadata attributes need to be public (#16)
1 parent 6a33e06 commit 8acb511

File tree

6 files changed

+59
-6
lines changed

6 files changed

+59
-6
lines changed

src/K8sOperator.NET/Metadata/EntityScopeMetadata.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,22 @@ public interface IEntityScopeMetadata
2929
EntityScope Scope { get; }
3030
}
3131

32+
/// <summary>
33+
/// Sets the scope of the entity.
34+
/// </summary>
35+
/// <param name="scope"></param>
3236
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
33-
internal class EntityScopeMetadata(EntityScope scope) : Attribute, IEntityScopeMetadata
37+
public class EntityScopeMetadata(EntityScope scope) : Attribute, IEntityScopeMetadata
3438
{
39+
/// <summary>
40+
/// Default value.
41+
/// </summary>
3542
public const EntityScope Default = EntityScope.Namespaced;
3643

44+
/// <inheritdoc/>
3745
public EntityScope Scope => scope;
3846

47+
/// <inheritdoc/>
3948
public override string ToString()
4049
=> DebuggerHelpers.GetDebugText(nameof(Scope), Scope);
4150
}

src/K8sOperator.NET/Metadata/FinalizerMetadata.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,23 @@ public interface IFinalizerMetadata
1313
string Name { get; }
1414
}
1515

16+
17+
/// <summary>
18+
/// Mark a Controller that it has a finalizer
19+
/// </summary>
20+
/// <param name="name"></param>
1621
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
17-
internal class FinalizerMetadata(string name) : Attribute, IFinalizerMetadata
22+
public class FinalizerMetadata(string name) : Attribute, IFinalizerMetadata
1823
{
24+
/// <summary>
25+
/// Default value of the finalizer.
26+
/// </summary>
1927
public const string Default = "operator.default.finalizer";
2028

29+
/// <inheritdoc/>
2130
public string Name => name;
2231

32+
/// <inheritdoc/>
2333
public override string ToString()
2434
=> DebuggerHelpers.GetDebugText(nameof(Name), Name);
2535
}

src/K8sOperator.NET/Metadata/ImageRepositoryMetadata.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,29 @@ public interface IImageMetadata
3232
string GetImage();
3333
}
3434

35+
/// <summary>
36+
/// Annotates the assemnbly with the docker image information.
37+
/// </summary>
38+
/// <param name="registery">The registry of the image.</param>
39+
/// <param name="repository">The image repository name.</param>
40+
/// <param name="imageName">The name of the image.</param>
41+
/// <param name="tag">The tag of the image.</param>
3542
[AttributeUsage(AttributeTargets.Assembly)]
36-
internal class DockerImageAttribute(string registery, string repository, string imageName, string tag) : Attribute, IImageMetadata
43+
public class DockerImageAttribute(string registery, string repository, string imageName, string tag) : Attribute, IImageMetadata
3744
{
45+
/// <summary>
46+
/// Default docker image
47+
/// </summary>
3848
public static DockerImageAttribute Default => new("ghcr.io", "operator", "operator", "latest");
3949

50+
/// <inheritdoc/>
4051
public string Registery => registery;
52+
/// <inheritdoc/>
4153
public string Repository => repository;
54+
/// <inheritdoc/>
4255
public string Name => imageName;
56+
/// <inheritdoc/>
4357
public string Tag => tag;
44-
58+
/// <inheritdoc/>
4559
public string GetImage() => $"{Registery}/{Repository}/{Name}:{Tag}";
4660
}

src/K8sOperator.NET/Metadata/LabelSelectorMetadata.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,20 @@ public interface ILabelSelectorMetadata
1414
public string LabelSelector { get; }
1515
}
1616

17+
/// <summary>
18+
///
19+
/// </summary>
20+
/// <param name="labelSelector"></param>
1721
internal class LabelSelectorMetadata(string labelSelector) : ILabelSelectorMetadata
1822
{
23+
/// <summary>
24+
///
25+
/// </summary>
1926
public string LabelSelector => labelSelector;
27+
/// <summary>
28+
///
29+
/// </summary>
30+
/// <returns></returns>
2031
public override string ToString()
2132
=> DebuggerHelpers.GetDebugText(nameof(LabelSelector), LabelSelector);
2233
}

src/K8sOperator.NET/Metadata/OperatorNameMetadata.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,19 @@ public interface IOperatorNameMetadata
1111
string Name { get; }
1212
}
1313

14+
15+
/// <summary>
16+
/// Sets the name of the operator at assembly level.
17+
/// </summary>
18+
/// <param name="name"></param>
1419
[AttributeUsage(AttributeTargets.Assembly)]
15-
internal class OperatorNameAttribute(string name) : Attribute, IOperatorNameMetadata
20+
public class OperatorNameAttribute(string name) : Attribute, IOperatorNameMetadata
1621
{
22+
/// <summary>
23+
/// Default value of the attribute
24+
/// </summary>
1725
public static OperatorNameAttribute Default => new("operator");
1826

27+
/// <inheritdoc/>
1928
public string Name => name;
2029
}

src/K8sOperator.NET/OperatorHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ public async Task RunAsync()
116116
private bool Filter(CommandInfo command)
117117
{
118118
var arg = command.Metadata.OfType<ICommandArgumentMetadata>().First().Argument;
119-
return _args.Contains(arg) || _args.Contains($"--{arg}");
119+
return _args.FirstOrDefault() == arg || _args.FirstOrDefault() == $"--{arg}";
120120
}
121121
}

0 commit comments

Comments
 (0)