Merge pull request #12064 from hakman/legacy_addons

Disallow the use of legacy addons
This commit is contained in:
Kubernetes Prow Robot 2021-08-07 13:09:30 -07:00 committed by GitHub
commit 8276ec1001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,5 @@
## Addons
Read on [addons](../docs/addons.md)
**Legacy addons are deprecated and unmaintained!!!**
Use [managed addons](../docs/addons.md) instead.

View File

@ -14,6 +14,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//channels/pkg/channels:go_default_library",
"//pkg/apis/kops/util:go_default_library",
"//util/pkg/tables:go_default_library",
"//vendor/github.com/blang/semver/v4:go_default_library",
"//vendor/github.com/jetstack/cert-manager/pkg/client/clientset/versioned:go_default_library",
@ -25,5 +26,6 @@ go_library(
"//vendor/k8s.io/client-go/plugin/pkg/client/auth:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
"//vendor/k8s.io/klog/v2:go_default_library",
],
)

View File

@ -26,7 +26,9 @@ import (
"github.com/blang/semver/v4"
"github.com/spf13/cobra"
"k8s.io/klog/v2"
"k8s.io/kops/channels/pkg/channels"
"k8s.io/kops/pkg/apis/kops/util"
"k8s.io/kops/util/pkg/tables"
)
@ -88,13 +90,20 @@ func RunApplyChannel(ctx context.Context, f Factory, out io.Writer, options *App
// We recognize the following "well-known" format:
// <name> with no slashes ->
if strings.Contains(name, "/") {
return fmt.Errorf("Channel format not recognized (did you mean to use `-f` to specify a local file?): %q", name)
return fmt.Errorf("channel format not recognized (did you mean to use `-f` to specify a local file?): %q", name)
}
expanded := "https://raw.githubusercontent.com/kubernetes/kops/master/addons/" + name + "/addon.yaml"
location, err = url.Parse(expanded)
if err != nil {
return fmt.Errorf("unable to parse expanded argument %q as url", expanded)
}
// Disallow the use of legacy addons from the "well-known" location starting Kubernetes 1.23:
// https://raw.githubusercontent.com/kubernetes/kops/master/addons/<name>/addon.yaml
if util.IsKubernetesGTE("1.23", kubernetesVersion) {
return fmt.Errorf("legacy addons are deprecated and unmaintained, use managed addons instead of %s", expanded)
} else {
klog.Warningf("Legacy addons are deprecated and unmaintained, use managed addons instead of %s", expanded)
}
}
o, err := channels.LoadAddons(name, location)
if err != nil {

View File

@ -40,6 +40,8 @@ spec:
* Support for Kubernetes versions 1.15 and 1.16 has been removed.
* The legacy addons from `https://github.com/kubernetes/kops/tree/master/addons` have been deprecated and will not be available in Kubernetes 1.23+. Use [managed addons](https://kops.sigs.k8s.io/addons) instead.
* The legacy location for downloads `s3://https://kubeupv2.s3.amazonaws.com/kops/` has been deprecated and will not be used for new releases. The new canonical downloads location is `https://artifacts.k8s.io/binaries/kops/`.
* The `assets` phase of `kops update cluster` has been removed. It is replaced by the new `kops get assets --copy` command.
@ -76,9 +78,7 @@ spec:
* Support for Ubuntu 18.04 (Bionic) is deprecated and will be removed in future versions of kOps.
* The [manifest based metrics server addon](https://github.com/kubernetes/kops/tree/master/addons/metrics-server) has been deprecated in favour of a configurable addon.
* The [manifest based cluster autoscaler addon](https://github.com/kubernetes/kops/tree/master/addons/cluster-autoscaler) has been deprecated in favour of a configurable addon.
* All legacy addons are deprecated in favor of managed addons, including the [metrics server addon](https://github.com/kubernetes/kops/tree/master/addons/metrics-server) and the [autoscaler addon](https://github.com/kubernetes/kops/tree/master/addons/cluster-autoscaler).
* The `node-role.kubernetes.io/master` and `kubernetes.io/role` labels are deprecated and might be removed from control plane nodes in kOps 1.23.