Skip to content

Commit 96aa4cb

Browse files
authored
Merge pull request #5508 from makhov/add-version-to-controlnode-status
Publish version in controlnode status
2 parents 85061c3 + d1b9f65 commit 96aa4cb

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

pkg/apis/autopilot/v1beta2/types.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ type ControlNode struct {
3636

3737
// ControlNodeStatus has the runtime status info of the controller such as address etc.
3838
type ControlNodeStatus struct {
39-
Addresses []corev1.NodeAddress `json:"addresses,omitempty"`
39+
Addresses []corev1.NodeAddress `json:"addresses,omitempty"`
40+
K0sVersion string `json:"k0sVersion,omitempty"`
4041
}
4142

4243
// GetInternalIP returns the internal IP address for the object. Returns empty string if the object does not have InternalIP set.

pkg/autopilot/controller/setup.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
apcli "github.com/k0sproject/k0s/pkg/autopilot/client"
2727
apcomm "github.com/k0sproject/k0s/pkg/autopilot/common"
2828
apconst "github.com/k0sproject/k0s/pkg/autopilot/constant"
29+
"github.com/k0sproject/k0s/pkg/build"
2930
"github.com/k0sproject/k0s/pkg/component/status"
3031
"github.com/k0sproject/k0s/pkg/kubernetes/watch"
3132

@@ -174,7 +175,8 @@ func (sc *setupController) createControlNode(ctx context.Context, cf apcli.Facto
174175
}
175176

176177
node.Status = apv1beta2.ControlNodeStatus{
177-
Addresses: addresses,
178+
Addresses: addresses,
179+
K0sVersion: build.Version,
178180
}
179181

180182
logger.Infof("Updating controlnode status '%s'", name)

static/_crds/autopilot/autopilot.k0sproject.io_controlnodes.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ spec:
5858
- type
5959
type: object
6060
type: array
61+
k0sVersion:
62+
type: string
6163
type: object
6264
type: object
6365
served: true

0 commit comments

Comments
 (0)