feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
@@ -24,6 +24,8 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apiserver/pkg/endpoints/deprecation"
|
||||
kscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
|
||||
"helm.sh/helm/v3/pkg/chartutil"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -45,7 +47,7 @@ func (e deprecatedAPIError) Error() string {
|
||||
return msg
|
||||
}
|
||||
|
||||
func validateNoDeprecations(resource *K8sYamlStruct) error {
|
||||
func validateNoDeprecations(resource *K8sYamlStruct, kubeVersion *chartutil.KubeVersion) error {
|
||||
// if `resource` does not have an APIVersion or Kind, we cannot test it for deprecation
|
||||
if resource.APIVersion == "" {
|
||||
return nil
|
||||
@@ -54,6 +56,14 @@ func validateNoDeprecations(resource *K8sYamlStruct) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
majorVersion := k8sVersionMajor
|
||||
minorVersion := k8sVersionMinor
|
||||
|
||||
if kubeVersion != nil {
|
||||
majorVersion = kubeVersion.Major
|
||||
minorVersion = kubeVersion.Minor
|
||||
}
|
||||
|
||||
runtimeObject, err := resourceToRuntimeObject(resource)
|
||||
if err != nil {
|
||||
// do not error for non-kubernetes resources
|
||||
@@ -62,11 +72,12 @@ func validateNoDeprecations(resource *K8sYamlStruct) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
maj, err := strconv.Atoi(k8sVersionMajor)
|
||||
|
||||
maj, err := strconv.Atoi(majorVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
min, err := strconv.Atoi(k8sVersionMinor)
|
||||
min, err := strconv.Atoi(minorVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user