Skip to content

Add ECK version to version.json #270

@stefnestor

Description

@stefnestor

👋 howdy, team (cc: @kunisen @jakommo 🙏!)

AFAICT, currently in order to determine the running ECK version, we have to regex search ECK version is (.+?)\n from under eck-diagnostics.log which emits from this code:

func logVersion(v *version.Version) {
s := v.String()
if v == fallbackMaxVersion {
s = "unknown"
}
logger.Printf("ECK version is %s\n", s)
}

Will you kindly consider expanding the version.json file to include this content, likely by extending this code:

// versionInfo exists to marshal both eck-diagnostics version information and K8s server version information.
type versionInfo struct {
DiagnosticsVersion DiagnosticsVersion
ServerVersion *version.Info
}
// Version is inspired by "kubectl version" but includes version information about this tool in addition to K8s
// server version information.
func (c Kubectl) Version(out io.Writer) error {
v := versionInfo{
DiagnosticsVersion: about(),
}
client, err := c.factory.ToDiscoveryClient()
if err != nil {
return err
}
// mirroring kubectl behaviour to fetch fresh data from server
client.Invalidate()
serverVersion, err := client.ServerVersion()
if err != nil {
return err
}
v.ServerVersion = serverVersion
bytes, err := json.MarshalIndent(v, "", " ")
if err != nil {
return err
}
_, err = out.Write(bytes)
return err
}

Example diagnostic of current state:

Image

I was told after filing this ballpark also potentially comes through in a lower file; however, since the namespace can be dynamic requesting in a root-folder file:

$ cat ./elastic-system/configmaps.json | jq '.items[]|select(.metadata.name=="elastic-operator")|.metadata.labels."app.kubernetes.io/version"'
"2.10.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions