controller: setting: add Kubernetes version for upgrade query
In case we have compatibility issues.
@@ -63,6 +63,7 @@ type Version struct {
type CheckUpgradeRequest struct {
LonghornVersion string `json:"longhornVersion"`
+ KubernetesVersion string `json:"kubernetesVersion"`
}
type CheckUpgradeResponse struct {
@@ -230,8 +231,14 @@ func (sc *SettingController) CheckLatestLonghornVersion() (string, error) {
resp CheckUpgradeResponse
content bytes.Buffer
)
+ kubeVersion, err := sc.kubeClient.Discovery().ServerVersion()
+ if err != nil {
+ return "", errors.Wrap(err, "failed to get Kubernetes server version")
+ }
+
req := &CheckUpgradeRequest{
LonghornVersion: sc.version,
+ KubernetesVersion: kubeVersion.GitVersion,
}
if err := json.NewEncoder(&content).Encode(req); err != nil {
return "", err
