Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 WIP: Bump CAPI to v1.9.z #5209

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ E2E_SKIP_EKS_UPGRADE ?= "false"
EKS_SOURCE_TEMPLATE ?= eks/cluster-template-eks-control-plane-only.yaml

# set up `setup-envtest` to install kubebuilder dependency
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.30.2
SETUP_ENVTEST_VER := v0.0.0-20240923090159-236e448db12c
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.31.0
SETUP_ENVTEST_VER := release-0.19
SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
Expand Down
3 changes: 1 addition & 2 deletions api/v1beta1/awsmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/errors"
)

const (
Expand Down Expand Up @@ -231,7 +230,7 @@ type AWSMachineStatus struct {
// can be added as events to the Machine object and/or logged in the
// controller's output.
// +optional
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
FailureReason *string `json:"failureReason,omitempty"`

// FailureMessage will be set in the event that there is a terminal problem
// reconciling the Machine and will contain a more verbose string suitable
Expand Down
5 changes: 2 additions & 3 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/v1beta2/awscluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ func TestAWSClusterValidateCreate(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.BootstrapFormatIgnition, true)()
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.BootstrapFormatIgnition, true)

cluster := tt.cluster.DeepCopy()
cluster.ObjectMeta = metav1.ObjectMeta{
Expand Down
3 changes: 1 addition & 2 deletions api/v1beta2/awsmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/errors"
)

const (
Expand Down Expand Up @@ -352,7 +351,7 @@ type AWSMachineStatus struct {
// can be added as events to the Machine object and/or logged in the
// controller's output.
// +optional
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
FailureReason *string `json:"failureReason,omitempty"`

// FailureMessage will be set in the event that there is a terminal problem
// reconciling the Machine and will contain a more verbose string suitable
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta2/awsmachine_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func TestAWSMachineCreate(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.BootstrapFormatIgnition, true)()
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.BootstrapFormatIgnition, true)

machine := tt.machine.DeepCopy()
machine.ObjectMeta = metav1.ObjectMeta{
Expand Down
3 changes: 1 addition & 2 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bootstrap/eks/controllers/eksconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (r *EKSConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Man
b := ctrl.NewControllerManagedBy(mgr).
For(&eksbootstrapv1.EKSConfig{}).
WithOptions(option).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(logger.FromContext(ctx).GetLogger(), r.WatchFilterValue)).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), logger.FromContext(ctx).GetLogger(), r.WatchFilterValue)).
Watches(
&clusterv1.Machine{},
handler.EnqueueRequestsFromMapFunc(r.MachineToBootstrapMapFunc),
Expand All @@ -315,7 +315,7 @@ func (r *EKSConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Man
err = c.Watch(
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
handler.EnqueueRequestsFromMapFunc((r.ClusterToEKSConfigs)),
predicates.ClusterUnpausedAndInfrastructureReady(logger.FromContext(ctx).GetLogger())),
predicates.ClusterPausedTransitionsOrInfrastructureReady(mgr.GetScheme(), logger.FromContext(ctx).GetLogger())),
)
if err != nil {
return errors.Wrap(err, "failed adding watch for Clusters to controller manager")
Expand Down
4 changes: 2 additions & 2 deletions cmd/clusterawsadm/cmd/ami/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ package ami

import (
"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"

cm "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/ami/common"
ls "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/ami/list"
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
)

// RootCmd is the root of the `ami command`.
Expand All @@ -31,7 +31,7 @@ func RootCmd() *cobra.Command {
Use: "ami [command]",
Short: "AMI commands",
Args: cobra.NoArgs,
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
All AMI related actions such as:
# Copy AMIs based on Kubernetes version, OS etc from an AWS account where AMIs are stored
to the current AWS account (use case: air-gapped deployments)
Expand Down
6 changes: 3 additions & 3 deletions cmd/clusterawsadm/cmd/ami/common/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"os"

"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"

"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/ami"
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/flags"
cmdout "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/printers"
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
logf "sigs.k8s.io/cluster-api/cmd/clusterctl/log"
)

Expand All @@ -34,11 +34,11 @@ func CopyAMICmd() *cobra.Command {
newCmd := &cobra.Command{
Use: "copy",
Short: "Copy AMIs from an AWS account to the AWS account which credentials are provided",
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
Copy AMIs based on Kubernetes version, OS, region from an AWS account where AMIs are stored
to the current AWS account (use case: air-gapped deployments)
`),
Example: cmd.Examples(`
Example: templates.Examples(`
# Copy AMI from the default AWS account where AMIs are stored.
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
clusterawsadm ami copy --kubernetes-version=v1.30.1 --os=ubuntu-22.04 --region=us-west-2
Expand Down
6 changes: 3 additions & 3 deletions cmd/clusterawsadm/cmd/ami/common/encryptedcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
"os"

"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"
ctrl "sigs.k8s.io/controller-runtime"

"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/ami"
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/flags"
cmdout "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/printers"
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
)

var (
Expand All @@ -38,12 +38,12 @@ func EncryptedCopyAMICmd() *cobra.Command {
newCmd := &cobra.Command{
Use: "encrypted-copy",
Short: "Encrypt and copy AMI snapshot, then create an AMI with that snapshot",
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
Find the AMI based on Kubernetes version, OS, region in the AWS account where AMIs are stored.
Encrypt and copy the snapshot of the AMI to the current AWS account.
Create an AMI with that snapshot.
`),
Example: cmd.Examples(`
Example: templates.Examples(`
# Create an encrypted AMI:
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
clusterawsadm ami encrypted-copy --kubernetes-version=v1.18.12 --os=ubuntu-20.04 --region=us-west-2
Expand Down
6 changes: 3 additions & 3 deletions cmd/clusterawsadm/cmd/ami/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"os"

"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"

"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/ami"
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/flags"
cmdout "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/printers"
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
)

var (
Expand All @@ -41,15 +41,15 @@ func ListAMICmd() *cobra.Command {
newCmd := &cobra.Command{
Use: "list",
Short: "List AMIs from the default AWS account where AMIs are stored",
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
List AMIs based on Kubernetes version, OS, region. If no arguments are provided,
it will print all AMIs in all regions, OS types for the supported Kubernetes versions.
Supported Kubernetes versions start from the latest stable version and goes 2 release back:
if the latest stable release is v1.20.4- v1.19.x and v1.18.x are supported.
Note: First release of each version will be skipped, e.g., v1.21.0
To list AMIs of unsupported Kubernetes versions, --kubernetes-version flag needs to be provided.
`),
Example: cmd.Examples(`
Example: templates.Examples(`
# List AMIs from the default AWS account where AMIs are stored.
# Available os options: centos-7, ubuntu-24.04, ubuntu-22.04, amazon-2, flatcar-stable
clusterawsadm ami list --kubernetes-version=v1.18.12 --os=ubuntu-20.04 --region=us-west-2
Expand Down
4 changes: 2 additions & 2 deletions cmd/clusterawsadm/cmd/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ package bootstrap

import (
"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"

"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/bootstrap/credentials"
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/bootstrap/iam"
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
)

// RootCmd is the root of the `alpha bootstrap command`.
Expand All @@ -32,7 +32,7 @@ func RootCmd() *cobra.Command {
Use: "bootstrap [command]",
Short: "bootstrap commands",
Args: cobra.NoArgs,
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
In order to use Kubernetes Cluster API Provider AWS, an AWS account needs to
be prepared with AWS Identity and Access Management (IAM) roles to be used by
clusters as well as provide Kubernetes Cluster API Provider AWS with credentials
Expand Down
10 changes: 5 additions & 5 deletions cmd/clusterawsadm/cmd/bootstrap/credentials/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"os"

"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"

"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/flags"
creds "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/credentials"
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
)

const (
Expand Down Expand Up @@ -86,10 +86,10 @@ func RootCmd() *cobra.Command {
newCmd := &cobra.Command{
Use: "credentials",
Short: `Encode credentials to use with Kubernetes Cluster API Provider AWS`,
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
Encode credentials to use with Kubernetes Cluster API Provider AWS.
` + CredentialHelp + EncodingHelp),
Example: cmd.Examples(examples),
Example: templates.Examples(examples),
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Expand All @@ -113,10 +113,10 @@ func generateAWSDefaultProfileWithChain() *cobra.Command {
newCmd := &cobra.Command{
Use: "encode-as-profile",
Short: "Generate an AWS profile from the current environment",
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
Generate an AWS profile from the current environment for the ephemeral bootstrap cluster.
` + CredentialHelp + EncodingHelp),
Example: cmd.Examples(examples),
Example: templates.Examples(examples),
RunE: func(c *cobra.Command, args []string) error {
flags.CredentialWarning(c)

Expand Down
12 changes: 6 additions & 6 deletions cmd/clusterawsadm/cmd/bootstrap/iam/cloudformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
cfn "github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"

"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cloudformation/bootstrap"
cloudformation "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cloudformation/service"
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/bootstrap/credentials"
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cmd/flags"
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
)

func printCloudFormationTemplateCmd() *cobra.Command {
newCmd := &cobra.Command{
Use: "print-cloudformation-template",
Short: "Print cloudformation template",
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
Generate and print out a CloudFormation template that can be used to
provision AWS Identity and Access Management (IAM) policies and roles for use
with Kubernetes Cluster API Provider AWS.
`),
Example: cmd.Examples(`
Example: templates.Examples(`
# Print out the default CloudFormation template.
clusterawsadm bootstrap iam print-cloudformation-template

Expand Down Expand Up @@ -75,12 +75,12 @@ func createCloudFormationStackCmd() *cobra.Command {
Aliases: []string{"update-cloudformation-stack"},
Short: "Create or update an AWS CloudFormation stack",
Args: cobra.NoArgs,
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
Create or update an AWS CloudFormation stack for bootstrapping Kubernetes Cluster
API and Kubernetes AWS Identity and Access Management (IAM) permissions. To use this
command, there must be AWS credentials loaded in this environment.
` + credentials.CredentialHelp),
Example: cmd.Examples(`
Example: templates.Examples(`
# Create or update IAM roles and policies for Kubernetes using a AWS CloudFormation stack.
clusterawsadm bootstrap iam create-cloudformation-stack

Expand Down Expand Up @@ -128,7 +128,7 @@ func deleteCloudFormationStackCmd() *cobra.Command {
Use: "delete-cloudformation-stack",
Short: "Delete an AWS CloudFormation stack",
Args: cobra.NoArgs,
Long: cmd.LongDesc(`
Long: templates.LongDesc(`
Delete the AWS CloudFormation stack that created AWS Identity and Access
Management (IAM) resources for use with Kubernetes Cluster API Provider
AWS.
Expand Down
8 changes: 4 additions & 4 deletions cmd/clusterawsadm/cmd/bootstrap/iam/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ import (
"fmt"

"github.com/spf13/cobra"
"k8s.io/kubectl/pkg/util/templates"
"sigs.k8s.io/yaml"

bootstrapv1 "sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/api/bootstrap/v1beta1"
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/cloudformation/bootstrap"
"sigs.k8s.io/cluster-api-provider-aws/v2/cmd/clusterawsadm/configreader"
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd"
)

func printConfigCmd() *cobra.Command {
newCmd := &cobra.Command{
Use: "print-config",
Short: "Print configuration",
Long: cmd.LongDesc("Print configuration"),
Example: cmd.Examples(`
Long: templates.LongDesc("Print configuration"),
Example: templates.Examples(`
# Print the default configuration.
clusterawsadm bootstrap iam print-config

Expand Down Expand Up @@ -83,7 +83,7 @@ func getBootstrapTemplate(cmd *cobra.Command) (*bootstrap.Template, error) {
}

func addConfigFlag(c *cobra.Command) {
c.Flags().String("config", "", cmd.LongDesc(`
c.Flags().String("config", "", templates.LongDesc(`
clusterawsadm will load a bootstrap configuration from this file. The path may be
absolute or relative; relative paths start at the current working directory.

Expand Down
Loading