Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/K8sOperator.NET/Commands/VersionCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using K8sOperator.NET.Builder;
using K8sOperator.NET.Metadata;
using System.Reflection;

namespace K8sOperator.NET.Commands;

Expand All @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions src/K8sOperator.NET/OperatorHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public interface IOperatorApplication
/// </summary>
string Name { get; }

/// <summary>
/// The version number of the operator
/// </summary>
public string Version { get; }

/// <summary>
/// Gets the service provider that is used to resolve dependencies within the application.
/// </summary>
Expand Down Expand Up @@ -96,6 +101,7 @@ string[] args
public ILoggerFactory Logger { get; }

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

public async Task RunAsync()
{
Expand Down