Skip to content

Commit

Permalink
Support deprecated extensions/v1beta1 workload resources (#4478)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis authored Jul 17, 2020
1 parent da54a9a commit 1600809
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/skaffold/deploy/kubectl/visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ import (
var transformableWhitelist = map[apimachinery.GroupKind]bool{
{Group: "", Kind: "Pod"}: true,
{Group: "apps", Kind: "DaemonSet"}: true,
{Group: "apps", Kind: "Deployment"}: true,
{Group: "apps", Kind: "Deployment"}: true, // v1beta1, v1beta2: deprecated in K8s 1.9, removed in 1.16
{Group: "apps", Kind: "ReplicaSet"}: true,
{Group: "apps", Kind: "StatefulSet"}: true,
{Group: "batch", Kind: "CronJob"}: true,
{Group: "batch", Kind: "Job"}: true,
{Group: "extensions", Kind: "DaemonSet"}: true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
{Group: "extensions", Kind: "Deployment"}: true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
{Group: "extensions", Kind: "ReplicaSet"}: true, // v1beta1: deprecated in K8s 1.9, removed in 1.16
{Group: "serving.knative.dev", Kind: "Service"}: true,
}

Expand Down
30 changes: 30 additions & 0 deletions pkg/skaffold/deploy/kubectl/visitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,36 @@ spec:
replicas: 0`), []byte(`name: repl`)},
expected: []string{"apiVersion=apps...", "kind=Depl...", "metadata=map[...", "name=app", "labels=map[...", "name=x", "spec=map[...", "replicas=0", "name=foo"},
},
{
description: "deprecated daemonset.extensions",
manifests: ManifestList{[]byte(`apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: app
spec:
replicas: 0`)},
expected: []string{"apiVersion=exte...", "kind=Daem...", "metadata=map[...", "name=app", "spec=map[...", "replicas=0"},
},
{
description: "deprecated deployment.extensions",
manifests: ManifestList{[]byte(`apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: app
spec:
replicas: 0`)},
expected: []string{"apiVersion=exte...", "kind=Depl...", "metadata=map[...", "name=app", "spec=map[...", "replicas=0"},
},
{
description: "deprecated replicaset.extensions",
manifests: ManifestList{[]byte(`apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
name: app
spec:
replicas: 0`)},
expected: []string{"apiVersion=exte...", "kind=Repl...", "metadata=map[...", "name=app", "spec=map[...", "replicas=0"},
},
{
description: "invalid input",
manifests: ManifestList{[]byte(`test:bar`)},
Expand Down

0 comments on commit 1600809

Please sign in to comment.