-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Include a tool to migrate v1alpha5 manifests to v1beta1 ones (#…
…4690) Co-authored-by: Jonathan Innis <jonathan.innis.ji@gmail.com> Co-authored-by: Giacomo Tomolillo <gto@amazon.com> Co-authored-by: Chris Negus <striker57@gmail.com>
- Loading branch information
1 parent
b919a06
commit 72badc1
Showing
10 changed files
with
1,104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# karpenter-convert | ||
|
||
karpenter-convert is a simple CLI tool to bump the API manifests from alpha to beta. | ||
It converts `v1alpha5/Provisioner` to `v1beta1/NodePool` and `v1alpha1/AWSNodeTemplate` to `v1beta1/EC2NodeClass`. | ||
|
||
## Installation | ||
|
||
``` | ||
go install github.com/aws/karpenter/tools/karpenter-convert/cmd/karpenter-convert@latest | ||
``` | ||
|
||
## Usage: | ||
|
||
```console | ||
# Convert a single Provisioner file to NodePool | ||
karpenter-convert -f provisioner.yaml > nodepool.yaml | ||
|
||
# Convert a single AWSNodeTemplate file to EC2NodeClass | ||
karpenter-convert -f nodetemplate.yaml > nodeclass.yaml | ||
|
||
# Convert an entire directory (.json, .yaml, .yml files) to the equivalent new APIs | ||
karpenter-convert -f . > output.yaml | ||
|
||
# Convert a single provisioner and apply directly to the cluster | ||
karpenter-convert -f provisioner.yaml | kubectl apply -f - | ||
``` | ||
|
||
## Usage notes | ||
|
||
When converting an AWSNodeTemplate to EC2NodeClass, the newly introduced field `role` can't be mapped automatically. | ||
The tool leaves a placeholder `<your AWS role here>` which needs to be manually updated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/aws/karpenter/tools/karpenter-convert/pkg/convert" | ||
|
||
"k8s.io/cli-runtime/pkg/genericclioptions" | ||
"k8s.io/cli-runtime/pkg/genericiooptions" | ||
cmdutil "k8s.io/kubectl/pkg/cmd/util" | ||
|
||
"k8s.io/component-base/cli" | ||
) | ||
|
||
func main() { | ||
kubeConfigFlags := genericclioptions.NewConfigFlags(false).WithDeprecatedPasswordFlag() | ||
f := cmdutil.NewFactory(kubeConfigFlags) | ||
cmd := convert.NewCmd(f, genericiooptions.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}) | ||
code := cli.Run(cmd) | ||
os.Exit(code) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
module github.com/aws/karpenter/tools/karpenter-convert | ||
|
||
go 1.21 | ||
|
||
require ( | ||
github.com/aws/karpenter v0.31.0 | ||
github.com/aws/karpenter-core v0.31.1-0.20231003200119-b5ccaf30be9c | ||
github.com/onsi/ginkgo/v2 v2.12.1 | ||
github.com/onsi/gomega v1.28.0 | ||
github.com/spf13/cobra v1.7.0 | ||
k8s.io/apimachinery v0.28.2 | ||
k8s.io/cli-runtime v0.28.2 | ||
k8s.io/client-go v0.28.2 | ||
k8s.io/component-base v0.28.2 | ||
k8s.io/kubectl v0.28.2 | ||
) | ||
|
||
require ( | ||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect | ||
github.com/MakeNowJust/heredoc v1.0.0 // indirect | ||
github.com/aws/aws-sdk-go v1.45.15 // indirect | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/blang/semver/v4 v4.0.0 // indirect | ||
github.com/cespare/xxhash/v2 v2.2.0 // indirect | ||
github.com/chai2010/gettext-go v1.0.2 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/emicklei/go-restful/v3 v3.9.0 // indirect | ||
github.com/evanphx/json-patch v4.12.0+incompatible // indirect | ||
github.com/evanphx/json-patch/v5 v5.6.0 // indirect | ||
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect | ||
github.com/go-errors/errors v1.4.2 // indirect | ||
github.com/go-logr/logr v1.2.4 // indirect | ||
github.com/go-openapi/jsonpointer v0.19.6 // indirect | ||
github.com/go-openapi/jsonreference v0.20.2 // indirect | ||
github.com/go-openapi/swag v0.22.3 // indirect | ||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/google/btree v1.0.1 // indirect | ||
github.com/google/gnostic-models v0.6.8 // indirect | ||
github.com/google/go-cmp v0.5.9 // indirect | ||
github.com/google/gofuzz v1.2.0 // indirect | ||
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect | ||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect | ||
github.com/imdario/mergo v0.3.16 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/jmespath/go-jmespath v0.4.0 // indirect | ||
github.com/josharian/intern v1.0.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect | ||
github.com/mailru/easyjson v0.7.7 // indirect | ||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect | ||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect | ||
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect | ||
github.com/moby/spdystream v0.2.0 // indirect | ||
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect | ||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/prometheus/client_golang v1.17.0 // indirect | ||
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect | ||
github.com/prometheus/common v0.44.0 // indirect | ||
github.com/prometheus/procfs v0.11.1 // indirect | ||
github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
github.com/samber/lo v1.38.1 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/stretchr/testify v1.8.2 // indirect | ||
github.com/xlab/treeprint v1.2.0 // indirect | ||
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect | ||
go.uber.org/multierr v1.11.0 // indirect | ||
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect | ||
golang.org/x/net v0.14.0 // indirect | ||
golang.org/x/oauth2 v0.8.0 // indirect | ||
golang.org/x/sync v0.3.0 // indirect | ||
golang.org/x/sys v0.12.0 // indirect | ||
golang.org/x/term v0.11.0 // indirect | ||
golang.org/x/text v0.13.0 // indirect | ||
golang.org/x/time v0.3.0 // indirect | ||
golang.org/x/tools v0.12.0 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/protobuf v1.31.0 // indirect | ||
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
k8s.io/api v0.28.2 // indirect | ||
k8s.io/apiextensions-apiserver v0.26.6 // indirect | ||
k8s.io/klog/v2 v2.100.1 // indirect | ||
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect | ||
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect | ||
knative.dev/pkg v0.0.0-20230712131115-7051d301e7f4 // indirect | ||
sigs.k8s.io/controller-runtime v0.14.6 // indirect | ||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect | ||
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect | ||
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect | ||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect | ||
sigs.k8s.io/yaml v1.3.0 // indirect | ||
) |
Oops, something went wrong.