Skip to content

Commit 5ff80b2

Browse files
authored
Use same version number (#33)
1 parent 587f5ed commit 5ff80b2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/K8sOperator.NET/Commands/VersionCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using K8sOperator.NET.Builder;
22
using K8sOperator.NET.Metadata;
3-
using System.Reflection;
43

54
namespace K8sOperator.NET.Commands;
65

@@ -9,7 +8,7 @@ internal class VersionCommand(IOperatorApplication app) : IOperatorCommand
98
{
109
public Task RunAsync(string[] args)
1110
{
12-
Console.WriteLine($"{app.Name} version {Assembly.GetEntryAssembly()?.GetName().Version}");
11+
Console.WriteLine($"{app.Name} version {app.Version}.");
1312

1413
return Task.CompletedTask;
1514
}

src/K8sOperator.NET/OperatorHost.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ public interface IOperatorApplication
1717
/// </summary>
1818
string Name { get; }
1919

20+
/// <summary>
21+
/// The version number of the operator
22+
/// </summary>
23+
public string Version { get; }
24+
2025
/// <summary>
2126
/// Gets the service provider that is used to resolve dependencies within the application.
2227
/// </summary>
@@ -96,6 +101,7 @@ string[] args
96101
public ILoggerFactory Logger { get; }
97102

98103
public string Name => DataSource.Metadata.OfType<IOperatorNameMetadata>().First().OperatorName;
104+
public string Version => DataSource.Metadata.OfType<IImageMetadata>().First().Tag;
99105

100106
public async Task RunAsync()
101107
{

0 commit comments

Comments
 (0)