diff --git a/src/K8sOperator.NET/Commands/VersionCommand.cs b/src/K8sOperator.NET/Commands/VersionCommand.cs index 9386981..2d92cc6 100644 --- a/src/K8sOperator.NET/Commands/VersionCommand.cs +++ b/src/K8sOperator.NET/Commands/VersionCommand.cs @@ -1,6 +1,5 @@ using K8sOperator.NET.Builder; using K8sOperator.NET.Metadata; -using System.Reflection; namespace K8sOperator.NET.Commands; @@ -9,7 +8,7 @@ internal class VersionCommand(IOperatorApplication app) : IOperatorCommand { public Task RunAsync(string[] args) { - Console.WriteLine($"{app.Name} version {Assembly.GetEntryAssembly()?.GetName().Version}"); + Console.WriteLine($"{app.Name} version {app.Version}."); return Task.CompletedTask; } diff --git a/src/K8sOperator.NET/OperatorHost.cs b/src/K8sOperator.NET/OperatorHost.cs index d5c3223..4e3e075 100644 --- a/src/K8sOperator.NET/OperatorHost.cs +++ b/src/K8sOperator.NET/OperatorHost.cs @@ -17,6 +17,11 @@ public interface IOperatorApplication /// string Name { get; } + /// + /// The version number of the operator + /// + public string Version { get; } + /// /// Gets the service provider that is used to resolve dependencies within the application. /// @@ -96,6 +101,7 @@ string[] args public ILoggerFactory Logger { get; } public string Name => DataSource.Metadata.OfType().First().OperatorName; + public string Version => DataSource.Metadata.OfType().First().Tag; public async Task RunAsync() {