diff --git a/.ci-operator.yaml b/.ci-operator.yaml new file mode 100644 index 0000000000..1d93c32196 --- /dev/null +++ b/.ci-operator.yaml @@ -0,0 +1,4 @@ +build_root_image: + namespace: openshift + name: release + tag: golang-1.17 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9b252b89ce..fd67745c7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.ci.openshift.org/openshift/release:golang-1.16 as builder +FROM registry.ci.openshift.org/openshift/release:golang-1.17 as builder WORKDIR /hypershift diff --git a/Makefile b/Makefile index d98b6fdb62..39a05414dd 100644 --- a/Makefile +++ b/Makefile @@ -113,8 +113,8 @@ cluster-api: $(CONTROLLER_GEN) .PHONY: cluster-api-provider-aws cluster-api-provider-aws: $(CONTROLLER_GEN) rm -rf cmd/install/assets/cluster-api-provider-aws/*.yaml - $(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./vendor/sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" output:crd:artifacts:config=cmd/install/assets/cluster-api-provider-aws - $(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./vendor/sigs.k8s.io/cluster-api-provider-aws/exp/api/v1alpha4" output:crd:artifacts:config=cmd/install/assets/cluster-api-provider-aws + $(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./vendor/sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" output:crd:artifacts:config=cmd/install/assets/cluster-api-provider-aws + $(CONTROLLER_GEN) $(CRD_OPTIONS) paths="./vendor/sigs.k8s.io/cluster-api-provider-aws/exp/api/v1beta1" output:crd:artifacts:config=cmd/install/assets/cluster-api-provider-aws .PHONY: cluster-api-provider-ibmcloud cluster-api-provider-ibmcloud: $(CONTROLLER_GEN) diff --git a/README.md b/README.md index be4e5a0718..2c942e1dd9 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The `hypershift` CLI tool helps you install and work with HyperShift. **Prerequisites:** -* Go 1.16 +* Go 1.17 Install the `hypershift` CLI using Go: diff --git a/api/scheme.go b/api/scheme.go index 0a9449f1a9..c9aea9a032 100644 --- a/api/scheme.go +++ b/api/scheme.go @@ -15,7 +15,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer/json" kasv1beta1 "k8s.io/apiserver/pkg/apis/apiserver/v1beta1" clientgoscheme "k8s.io/client-go/kubernetes/scheme" - capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" + capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" ) diff --git a/api/v1alpha1/capi_types.go b/api/v1alpha1/capi_types.go index 1086c57b45..2746723603 100644 --- a/api/v1alpha1/capi_types.go +++ b/api/v1alpha1/capi_types.go @@ -3,8 +3,8 @@ package v1alpha1 // These imports are used to explicitly declare external API dependencies import ( _ "github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/api/v1alpha4" - _ "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" - _ "sigs.k8s.io/cluster-api-provider-aws/exp/api/v1alpha4" + _ "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" + _ "sigs.k8s.io/cluster-api-provider-aws/exp/api/v1beta1" _ "sigs.k8s.io/cluster-api/api/v1beta1" _ "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1" _ "sigs.k8s.io/cluster-api/exp/api/v1beta1" diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index e28ba1235c..1a39ca596c 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated /* diff --git a/availability-prober/main.go b/availability-prober/main.go index 406f20bef6..5a66cdac6f 100644 --- a/availability-prober/main.go +++ b/availability-prober/main.go @@ -7,9 +7,9 @@ import ( "net/url" "time" - "github.com/bombsimon/logrusr" "github.com/go-logr/logr" "github.com/sirupsen/logrus" + "sigs.k8s.io/controller-runtime/pkg/log/zap" ) type options struct { @@ -21,7 +21,7 @@ func main() { flag.StringVar(&opts.target, "target", "", "A http url to probe. The program will continue until it gets a http 2XX back.") flag.Parse() - log := logrusr.NewLogger(logrus.New()) + log := zap.New(zap.UseDevMode(true), zap.JSONEncoder()) url, err := url.Parse(opts.target) if err != nil { diff --git a/cmd/bastion/aws/logging.go b/cmd/bastion/aws/logging.go index 213536f381..655b51aa94 100644 --- a/cmd/bastion/aws/logging.go +++ b/cmd/bastion/aws/logging.go @@ -1,8 +1,5 @@ package aws -import ( - "github.com/bombsimon/logrusr" - "github.com/sirupsen/logrus" -) +import "sigs.k8s.io/controller-runtime/pkg/log/zap" -var log = logrusr.NewLogger(logrus.New()) +var log = zap.New(zap.UseDevMode(true), zap.JSONEncoder()) diff --git a/cmd/cluster/aws/dump.go b/cmd/cluster/aws/dump.go index c671162b0f..b8889dbd79 100644 --- a/cmd/cluster/aws/dump.go +++ b/cmd/cluster/aws/dump.go @@ -20,7 +20,7 @@ import ( corev1 "k8s.io/api/core/v1" kubeclient "k8s.io/client-go/kubernetes" restclient "k8s.io/client-go/rest" - capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" + capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/cmd/cluster/aws/log.go b/cmd/cluster/aws/log.go index 213536f381..655b51aa94 100644 --- a/cmd/cluster/aws/log.go +++ b/cmd/cluster/aws/log.go @@ -1,8 +1,5 @@ package aws -import ( - "github.com/bombsimon/logrusr" - "github.com/sirupsen/logrus" -) +import "sigs.k8s.io/controller-runtime/pkg/log/zap" -var log = logrusr.NewLogger(logrus.New()) +var log = zap.New(zap.UseDevMode(true), zap.JSONEncoder()) diff --git a/cmd/cluster/core/log.go b/cmd/cluster/core/log.go index e0286e0ab5..7f530fbe26 100644 --- a/cmd/cluster/core/log.go +++ b/cmd/cluster/core/log.go @@ -1,8 +1,7 @@ package core import ( - "github.com/bombsimon/logrusr" - "github.com/sirupsen/logrus" + "sigs.k8s.io/controller-runtime/pkg/log/zap" ) -var log = logrusr.NewLogger(logrus.New()) +var log = zap.New(zap.UseDevMode(true), zap.JSONEncoder()) diff --git a/cmd/cluster/none/log.go b/cmd/cluster/none/log.go index a60e7b62e9..5c647a8a00 100644 --- a/cmd/cluster/none/log.go +++ b/cmd/cluster/none/log.go @@ -1,8 +1,7 @@ package none import ( - "github.com/bombsimon/logrusr" - "github.com/sirupsen/logrus" + "sigs.k8s.io/controller-runtime/pkg/log/zap" ) -var log = logrusr.NewLogger(logrus.New()) +var log = zap.New(zap.UseDevMode(true), zap.JSONEncoder()) diff --git a/cmd/consolelogs/aws/logging.go b/cmd/consolelogs/aws/logging.go index 213536f381..655b51aa94 100644 --- a/cmd/consolelogs/aws/logging.go +++ b/cmd/consolelogs/aws/logging.go @@ -1,8 +1,5 @@ package aws -import ( - "github.com/bombsimon/logrusr" - "github.com/sirupsen/logrus" -) +import "sigs.k8s.io/controller-runtime/pkg/log/zap" -var log = logrusr.NewLogger(logrus.New()) +var log = zap.New(zap.UseDevMode(true), zap.JSONEncoder()) diff --git a/cmd/infra/aws/logging.go b/cmd/infra/aws/logging.go index 213536f381..655b51aa94 100644 --- a/cmd/infra/aws/logging.go +++ b/cmd/infra/aws/logging.go @@ -1,8 +1,5 @@ package aws -import ( - "github.com/bombsimon/logrusr" - "github.com/sirupsen/logrus" -) +import "sigs.k8s.io/controller-runtime/pkg/log/zap" -var log = logrusr.NewLogger(logrus.New()) +var log = zap.New(zap.UseDevMode(true), zap.JSONEncoder()) diff --git a/cmd/install/assets/assets.go b/cmd/install/assets/assets.go index b1493f8196..8f66b9ae06 100644 --- a/cmd/install/assets/assets.go +++ b/cmd/install/assets/assets.go @@ -28,10 +28,10 @@ const capiLabel = "cluster.x-k8s.io/v1beta1" // to satisfy CAPI contracts. There might be a way to achieve this during CRD // generation, but for now we're just post-processing at runtime here. var capiResources = map[string]string{ - "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusters.yaml": "v1alpha4", - "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachines.yaml": "v1alpha4", - "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml": "v1alpha4", - "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml": "v1alpha4", + "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusters.yaml": "v1beta1", + "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachines.yaml": "v1beta1", + "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml": "v1beta1", + "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml": "v1beta1", "hypershift-operator/hypershift.openshift.io_hostedcontrolplanes.yaml": "v1alpha1", } diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclustercontrolleridentities.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclustercontrolleridentities.yaml index a837f42668..f1616069ce 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclustercontrolleridentities.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclustercontrolleridentities.yaml @@ -20,7 +20,7 @@ spec: singular: awsclustercontrolleridentity scope: Cluster versions: - - name: v1alpha4 + - name: v1beta1 schema: openAPIV3Schema: description: AWSClusterControllerIdentity is the Schema for the awsclustercontrolleridentities diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusterroleidentities.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusterroleidentities.yaml index c9fc546d53..58a4d6a153 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusterroleidentities.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusterroleidentities.yaml @@ -20,7 +20,7 @@ spec: singular: awsclusterroleidentity scope: Cluster versions: - - name: v1alpha4 + - name: v1beta1 schema: openAPIV3Schema: description: AWSClusterRoleIdentity is the Schema for the awsclusterroleidentities diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusters.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusters.yaml index a9d9e91471..624d87730a 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusters.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusters.yaml @@ -42,10 +42,11 @@ spec: jsonPath: .status.bastion.publicIp name: Bastion IP type: string - name: v1alpha4 + name: v1beta1 schema: openAPIV3Schema: - description: AWSCluster is the Schema for the awsclusters API. + description: AWSCluster is the schema for Amazon EC2 based Kubernetes Cluster + API. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -60,7 +61,8 @@ spec: metadata: type: object spec: - description: AWSClusterSpec defines the desired state of AWSCluster + description: AWSClusterSpec defines the desired state of an EC2-based + Kubernetes cluster. properties: additionalTags: additionalProperties: @@ -137,12 +139,21 @@ spec: registered instances in its Availability Zone only. \n Defaults to false." type: boolean + name: + description: Name sets the name of the classic ELB load balancer. + As per AWS, the name must be unique within your set of load + balancers for the region, must have a maximum of 32 characters, + must contain only alphanumeric characters or hyphens, and cannot + begin or end with a hyphen. Once set, the value cannot be changed. + maxLength: 32 + pattern: ^[A-Za-z0-9]([A-Za-z0-9]{0,31}|[-A-Za-z0-9]{0,30}[A-Za-z0-9])$ + type: string scheme: - default: Internet-facing + default: internet-facing description: Scheme sets the scheme of the load balancer (defaults - to Internet-facing) + to internet-facing) enum: - - Internet-facing + - internet-facing - internal type: string subnets: @@ -335,7 +346,7 @@ spec: type: string type: object status: - description: AWSClusterStatus defines the observed state of AWSCluster + description: AWSClusterStatus defines the observed state of AWSCluster. properties: bastion: description: Instance describes an AWS instance. @@ -390,7 +401,7 @@ spec: description: Configuration options for the non root storage volumes. items: description: Volume encapsulates the configuration options for - the storage device + the storage device. properties: deviceName: description: Device name @@ -566,6 +577,7 @@ spec: important. type: string required: + - lastTransitionTime - status - type type: object diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusterstaticidentities.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusterstaticidentities.yaml index 43a71f8909..fee1b9e02b 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusterstaticidentities.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusterstaticidentities.yaml @@ -20,7 +20,7 @@ spec: singular: awsclusterstaticidentity scope: Cluster versions: - - name: v1alpha4 + - name: v1beta1 schema: openAPIV3Schema: description: AWSClusterStaticIdentity is the Schema for the awsclusterstaticidentities diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclustertemplates.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclustertemplates.yaml index cbdc5a57da..a4529a986b 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclustertemplates.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclustertemplates.yaml @@ -20,11 +20,11 @@ spec: singular: awsclustertemplate scope: Namespaced versions: - - name: v1alpha4 + - name: v1beta1 schema: openAPIV3Schema: - description: AWSClusterTemplate is the Schema for the awsclustertemplates - API. + description: AWSClusterTemplate is the schema for Amazon EC2 based Kubernetes + Cluster Templates. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -43,8 +43,30 @@ spec: properties: template: properties: + metadata: + description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata' + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + type: object spec: - description: AWSClusterSpec defines the desired state of AWSCluster + description: AWSClusterSpec defines the desired state of an EC2-based + Kubernetes cluster. properties: additionalTags: additionalProperties: @@ -125,12 +147,22 @@ spec: registered instances in its Availability Zone only. \n Defaults to false." type: boolean + name: + description: Name sets the name of the classic ELB load + balancer. As per AWS, the name must be unique within + your set of load balancers for the region, must have + a maximum of 32 characters, must contain only alphanumeric + characters or hyphens, and cannot begin or end with + a hyphen. Once set, the value cannot be changed. + maxLength: 32 + pattern: ^[A-Za-z0-9]([A-Za-z0-9]{0,31}|[-A-Za-z0-9]{0,30}[A-Za-z0-9])$ + type: string scheme: - default: Internet-facing + default: internet-facing description: Scheme sets the scheme of the load balancer - (defaults to Internet-facing) + (defaults to internet-facing) enum: - - Internet-facing + - internet-facing - internal type: string subnets: diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsfargateprofiles.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsfargateprofiles.yaml index 666efcaa9e..47ccce236f 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsfargateprofiles.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsfargateprofiles.yaml @@ -33,10 +33,10 @@ spec: jsonPath: .status.failureReason name: FailureReason type: string - name: v1alpha4 + name: v1beta1 schema: openAPIV3Schema: - description: AWSFargateProfile is the Schema for the awsfargateprofiles API + description: AWSFargateProfile is the Schema for the awsfargateprofiles API. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -51,7 +51,7 @@ spec: metadata: type: object spec: - description: FargateProfileSpec defines the desired state of FargateProfile + description: FargateProfileSpec defines the desired state of FargateProfile. properties: additionalTags: additionalProperties: @@ -78,7 +78,7 @@ spec: description: Selectors specify fargate pod selectors. items: description: FargateSelector specifies a selector for pods that - should run on this fargate pool + should run on this fargate pool. properties: labels: additionalProperties: @@ -102,7 +102,7 @@ spec: - clusterName type: object status: - description: FargateProfileStatus defines the observed state of FargateProfile + description: FargateProfileStatus defines the observed state of FargateProfile. properties: conditions: description: Conditions defines current state of the Fargate profile. @@ -144,6 +144,7 @@ spec: important. type: string required: + - lastTransitionTime - status - type type: object diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinepools.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinepools.yaml index 1515cf0906..e7a41d33bd 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinepools.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinepools.yaml @@ -41,10 +41,10 @@ spec: jsonPath: .status.launchTemplateID name: LaunchTemplate ID type: string - name: v1alpha4 + name: v1beta1 schema: openAPIV3Schema: - description: AWSMachinePool is the Schema for the awsmachinepools API + description: AWSMachinePool is the Schema for the awsmachinepools API. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -59,7 +59,7 @@ spec: metadata: type: object spec: - description: AWSMachinePoolSpec defines the desired state of AWSMachinePool + description: AWSMachinePoolSpec defines the desired state of AWSMachinePool. properties: additionalTags: additionalProperties: @@ -97,7 +97,7 @@ spec: rules defined by the AWS API: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html' items: description: Filter is a filter used to identify an AWS - resource + resource. properties: name: description: Name of the filter. Filter names are @@ -341,7 +341,7 @@ spec: a resource They are applied according to the rules defined by the AWS API: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html' items: - description: Filter is a filter used to identify an AWS resource + description: Filter is a filter used to identify an AWS resource. properties: name: description: Name of the filter. Filter names are case-sensitive. @@ -368,11 +368,11 @@ spec: - minSize type: object status: - description: AWSMachinePoolStatus defines the observed state of AWSMachinePool + description: AWSMachinePoolStatus defines the observed state of AWSMachinePool. properties: asgStatus: description: ASGStatus is a status string returned by the autoscaling - API + API. type: string conditions: description: Conditions defines current service state of the AWSMachinePool. @@ -414,6 +414,7 @@ spec: important. type: string required: + - lastTransitionTime - status - type type: object diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachines.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachines.yaml index 2ac10ee345..3f7cee451f 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachines.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachines.yaml @@ -41,10 +41,10 @@ spec: jsonPath: .metadata.ownerReferences[?(@.kind=="Machine")].name name: Machine type: string - name: v1alpha4 + name: v1beta1 schema: openAPIV3Schema: - description: AWSMachine is the Schema for the awsmachines API + description: AWSMachine is the schema for Amazon EC2 machines. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -59,7 +59,8 @@ spec: metadata: type: object spec: - description: AWSMachineSpec defines the desired state of AWSMachine + description: AWSMachineSpec defines the desired state of an Amazon EC2 + instance. properties: additionalSecurityGroups: description: AdditionalSecurityGroups is an array of references to @@ -83,7 +84,7 @@ spec: a resource They are applied according to the rules defined by the AWS API: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html' items: - description: Filter is a filter used to identify an AWS resource + description: Filter is a filter used to identify an AWS resource. properties: name: description: Name of the filter. Filter names are case-sensitive. @@ -196,6 +197,7 @@ spec: instanceType: description: 'InstanceType is the type of instance to create. Example: m4.xlarge' + minLength: 2 type: string networkInterfaces: description: NetworkInterfaces is a list of ENIs to associate with @@ -208,7 +210,7 @@ spec: description: Configuration options for the non root storage volumes. items: description: Volume encapsulates the configuration options for the - storage device + storage device. properties: deviceName: description: Device name @@ -323,7 +325,7 @@ spec: a resource They are applied according to the rules defined by the AWS API: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html' items: - description: Filter is a filter used to identify an AWS resource + description: Filter is a filter used to identify an AWS resource. properties: name: description: Name of the filter. Filter names are case-sensitive. @@ -357,9 +359,11 @@ spec: built-in support for gzip-compressed user data user data stored in aws secret manager is always gzip-compressed. type: boolean + required: + - instanceType type: object status: - description: AWSMachineStatus defines the observed state of AWSMachine + description: AWSMachineStatus defines the observed state of AWSMachine. properties: addresses: description: Addresses contains the AWS instance associated addresses. @@ -419,6 +423,7 @@ spec: important. type: string required: + - lastTransitionTime - status - type type: object diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml index 1f153920ea..b35c6a131d 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml @@ -20,11 +20,11 @@ spec: singular: awsmachinetemplate scope: Namespaced versions: - - name: v1alpha4 + - name: v1beta1 schema: openAPIV3Schema: - description: AWSMachineTemplate is the Schema for the awsmachinetemplates - API + description: AWSMachineTemplate is the schema for the Amazon EC2 Machine Templates + API. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -39,12 +39,33 @@ spec: metadata: type: object spec: - description: AWSMachineTemplateSpec defines the desired state of AWSMachineTemplate + description: AWSMachineTemplateSpec defines the desired state of AWSMachineTemplate. properties: template: description: AWSMachineTemplateResource describes the data needed - to create am AWSMachine from a template + to create am AWSMachine from a template. properties: + metadata: + description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata' + properties: + annotations: + additionalProperties: + type: string + description: 'Annotations is an unstructured key value map + stored with a resource that may be set by external tools + to store and retrieve arbitrary metadata. They are not queryable + and should be preserved when modifying objects. More info: + http://kubernetes.io/docs/user-guide/annotations' + type: object + labels: + additionalProperties: + type: string + description: 'Map of string keys and values that can be used + to organize and categorize (scope and select) objects. May + match selectors of replication controllers and services. + More info: http://kubernetes.io/docs/user-guide/labels' + type: object + type: object spec: description: Spec is the specification of the desired behavior of the machine. @@ -72,7 +93,7 @@ spec: to the rules defined by the AWS API: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html' items: description: Filter is a filter used to identify an - AWS resource + AWS resource. properties: name: description: Name of the filter. Filter names @@ -189,6 +210,7 @@ spec: instanceType: description: 'InstanceType is the type of instance to create. Example: m4.xlarge' + minLength: 2 type: string networkInterfaces: description: NetworkInterfaces is a list of ENIs to associate @@ -202,7 +224,7 @@ spec: volumes. items: description: Volume encapsulates the configuration options - for the storage device + for the storage device. properties: deviceName: description: Device name @@ -324,7 +346,7 @@ spec: the rules defined by the AWS API: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html' items: description: Filter is a filter used to identify an - AWS resource + AWS resource. properties: name: description: Name of the filter. Filter names are @@ -359,6 +381,8 @@ spec: cloud-init has built-in support for gzip-compressed user data user data stored in aws secret manager is always gzip-compressed. type: boolean + required: + - instanceType type: object required: - spec diff --git a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml index 1a82f4d174..bf0c672aab 100644 --- a/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml +++ b/cmd/install/assets/cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml @@ -29,11 +29,11 @@ spec: jsonPath: .status.replicas name: Replicas type: integer - name: v1alpha4 + name: v1beta1 schema: openAPIV3Schema: description: AWSManagedMachinePool is the Schema for the awsmanagedmachinepools - API + API. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -48,7 +48,7 @@ spec: metadata: type: object spec: - description: AWSManagedMachinePoolSpec defines the desired state of AWSManagedMachinePool + description: AWSManagedMachinePoolSpec defines the desired state of AWSManagedMachinePool. properties: additionalTags: additionalProperties: @@ -77,6 +77,14 @@ spec: items: type: string type: array + capacityType: + default: onDemand + description: CapacityType specifies the capacity type for the ASG + behind this pool + enum: + - onDemand + - spot + type: string diskSize: description: DiskSize specifies the root disk size format: int32 @@ -121,6 +129,13 @@ spec: plane is used. type: string type: object + roleAdditionalPolicies: + description: RoleAdditionalPolicies allows you to attach additional + polices to the node group role. You must enable the EKSAllowAddRoles + feature flag to incorporate these into the created role. + items: + type: string + type: array roleName: description: RoleName specifies the name of IAM role for the node group. If the role is pre-existing we will treat it as unmanaged @@ -171,7 +186,7 @@ spec: type: object status: description: AWSManagedMachinePoolStatus defines the observed state of - AWSManagedMachinePool + AWSManagedMachinePool. properties: conditions: description: Conditions defines current service state of the managed @@ -214,6 +229,7 @@ spec: important. type: string required: + - lastTransitionTime - status - type type: object diff --git a/cmd/install/assets/hypershift_operator.go b/cmd/install/assets/hypershift_operator.go index 09ea55742f..6fdce28dfa 100644 --- a/cmd/install/assets/hypershift_operator.go +++ b/cmd/install/assets/hypershift_operator.go @@ -167,7 +167,7 @@ func (o HyperShiftOperatorDeployment) Build() *appsv1.Deployment { Command: []string{"/usr/bin/hypershift-operator"}, Args: args, LivenessProbe: &corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/metrics", Port: intstr.FromInt(9000), @@ -181,7 +181,7 @@ func (o HyperShiftOperatorDeployment) Build() *appsv1.Deployment { TimeoutSeconds: int32(5), }, ReadinessProbe: &corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/metrics", Port: intstr.FromInt(9000), diff --git a/control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller.go b/control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller.go index 6efec94619..f7dcbd7c7a 100644 --- a/control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller.go +++ b/control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller.go @@ -177,7 +177,11 @@ func (r *AWSEndpointServiceReconciler) SetupWithManager(mgr ctrl.Manager) error } func (r *AWSEndpointServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - log := logr.FromContext(ctx) + log, err := logr.FromContext(ctx) + if err != nil { + return ctrl.Result{}, fmt.Errorf("logger not found: %w", err) + } + log.Info("reconciling") // Fetch the AWSEndpointService @@ -273,7 +277,11 @@ func (r *AWSEndpointServiceReconciler) Reconcile(ctx context.Context, req ctrl.R } func reconcileAWSEndpointService(ctx context.Context, awsEndpointService *hyperv1.AWSEndpointService, ec2Client ec2iface.EC2API, hcp hyperv1.HostedControlPlane) error { - log := logr.FromContext(ctx) + log, err := logr.FromContext(ctx) + if err != nil { + return fmt.Errorf("logger not found: %w", err) + } + serviceName := awsEndpointService.Status.EndpointServiceName endpointID := awsEndpointService.Status.EndpointID @@ -319,7 +327,10 @@ func reconcileAWSEndpointService(ctx context.Context, awsEndpointService *hyperv } func (r *AWSEndpointServiceReconciler) delete(ctx context.Context, awsEndpointService *hyperv1.AWSEndpointService, ec2Client ec2iface.EC2API) (bool, error) { - log := logr.FromContext(ctx) + log, err := logr.FromContext(ctx) + if err != nil { + return false, fmt.Errorf("logger not found: %w", err) + } endpointID := awsEndpointService.Status.EndpointID if endpointID == "" { diff --git a/control-plane-operator/controllers/hostedcontrolplane/etcd/reconcile.go b/control-plane-operator/controllers/hostedcontrolplane/etcd/reconcile.go index ee7f63d5d2..54f0cccdb8 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/etcd/reconcile.go +++ b/control-plane-operator/controllers/hostedcontrolplane/etcd/reconcile.go @@ -12,6 +12,7 @@ import ( prometheusoperatorv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + //TODO: Switch to k8s.io/api/policy/v1 when all management clusters at 1.21+ OR 4.8_openshift+ policyv1beta1 "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -185,7 +186,7 @@ func buildEtcdContainer(p *EtcdParams, namespace string) func(c *corev1.Containe }, } c.ReadinessProbe = &corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ Exec: &corev1.ExecAction{ Command: []string{"/bin/sh", "-c", "/usr/bin/etcdctl --cacert /etc/etcd/tls/client/etcd-client-ca.crt --cert /etc/etcd/tls/client/etcd-client.crt --key /etc/etcd/tls/client/etcd-client.key --endpoints=localhost:2379 endpoint health"}, diff --git a/control-plane-operator/controllers/hostedcontrolplane/ignition/reconcile.go b/control-plane-operator/controllers/hostedcontrolplane/ignition/reconcile.go index 3a157129fa..90f2d00c18 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/ignition/reconcile.go +++ b/control-plane-operator/controllers/hostedcontrolplane/ignition/reconcile.go @@ -201,7 +201,7 @@ func generateHAProxyStaticPod(image, internalAPIAddress string, internalAPIPort InitialDelaySeconds: 120, PeriodSeconds: 120, SuccessThreshold: 1, - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/version", Scheme: corev1.URISchemeHTTPS, diff --git a/control-plane-operator/controllers/hostedcontrolplane/kas/params.go b/control-plane-operator/controllers/hostedcontrolplane/kas/params.go index 30f7ab7d89..7325c6f4c4 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/kas/params.go +++ b/control-plane-operator/controllers/hostedcontrolplane/kas/params.go @@ -111,7 +111,7 @@ func NewKubeAPIServerParams(ctx context.Context, hcp *hyperv1.HostedControlPlane PriorityClass: config.APICriticalPriorityClass, } baseLivenessProbeConfig := corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(params.APIServerPort)), @@ -154,7 +154,7 @@ func NewKubeAPIServerParams(ctx context.Context, hcp *hyperv1.HostedControlPlane params.LivenessProbes = config.LivenessProbes{ kasContainerMain().Name: baseLivenessProbeConfig, kasContainerIBMCloudKMS().Name: corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTP, Port: intstr.FromInt(int(ibmCloudKMSHealthPort)), @@ -168,7 +168,7 @@ func NewKubeAPIServerParams(ctx context.Context, hcp *hyperv1.HostedControlPlane SuccessThreshold: 1, }, kasContainerAWSKMSBackup().Name: corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTP, Port: intstr.FromInt(backupAWSKMSHealthPort), @@ -182,7 +182,7 @@ func NewKubeAPIServerParams(ctx context.Context, hcp *hyperv1.HostedControlPlane SuccessThreshold: 1, }, kasContainerAWSKMSActive().Name: corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTP, Port: intstr.FromInt(activeAWSKMSHealthPort), @@ -196,7 +196,7 @@ func NewKubeAPIServerParams(ctx context.Context, hcp *hyperv1.HostedControlPlane SuccessThreshold: 1, }, kasContainerPortieries().Name: corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(portierisPort), @@ -212,7 +212,7 @@ func NewKubeAPIServerParams(ctx context.Context, hcp *hyperv1.HostedControlPlane } params.ReadinessProbes = config.ReadinessProbes{ kasContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(params.APIServerPort)), diff --git a/control-plane-operator/controllers/hostedcontrolplane/kcm/params.go b/control-plane-operator/controllers/hostedcontrolplane/kcm/params.go index 414db89606..f8818c3b2c 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/kcm/params.go +++ b/control-plane-operator/controllers/hostedcontrolplane/kcm/params.go @@ -55,7 +55,7 @@ func NewKubeControllerManagerParams(ctx context.Context, hcp *hyperv1.HostedCont } params.LivenessProbes = config.LivenessProbes{ kcmContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(params.Port)), @@ -71,7 +71,7 @@ func NewKubeControllerManagerParams(ctx context.Context, hcp *hyperv1.HostedCont } params.ReadinessProbes = config.ReadinessProbes{ kcmContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(params.Port)), diff --git a/control-plane-operator/controllers/hostedcontrolplane/konnectivity/params.go b/control-plane-operator/controllers/hostedcontrolplane/konnectivity/params.go index 80e69a6b27..d55a3892f3 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/konnectivity/params.go +++ b/control-plane-operator/controllers/hostedcontrolplane/konnectivity/params.go @@ -35,7 +35,7 @@ func NewKonnectivityParams(hcp *hyperv1.HostedControlPlane, images map[string]st } p.ServerDeploymentConfig.LivenessProbes = config.LivenessProbes{ konnectivityServerContainer().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTP, Port: intstr.FromInt(int(healthPort)), @@ -74,7 +74,7 @@ func NewKonnectivityParams(hcp *hyperv1.HostedControlPlane, images map[string]st p.AgentDeploymentConfig.Scheduling.PriorityClass = config.DefaultPriorityClass p.AgentDeploymentConfig.LivenessProbes = config.LivenessProbes{ konnectivityAgentContainer().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTP, Port: intstr.FromInt(int(healthPort)), @@ -110,7 +110,7 @@ func NewKonnectivityParams(hcp *hyperv1.HostedControlPlane, images map[string]st } p.AgentDeamonSetConfig.LivenessProbes = config.LivenessProbes{ konnectivityAgentContainer().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTP, Port: intstr.FromInt(int(healthPort)), diff --git a/control-plane-operator/controllers/hostedcontrolplane/oapi/params.go b/control-plane-operator/controllers/hostedcontrolplane/oapi/params.go index 971bc636f7..1ae1f05a2d 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/oapi/params.go +++ b/control-plane-operator/controllers/hostedcontrolplane/oapi/params.go @@ -57,7 +57,7 @@ func NewOpenShiftAPIServerParams(hcp *hyperv1.HostedControlPlane, globalConfig g }, LivenessProbes: config.LivenessProbes{ oasContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(OpenShiftAPIServerPort)), @@ -73,7 +73,7 @@ func NewOpenShiftAPIServerParams(hcp *hyperv1.HostedControlPlane, globalConfig g }, ReadinessProbes: config.ReadinessProbes{ oasContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(OpenShiftAPIServerPort)), @@ -104,7 +104,7 @@ func NewOpenShiftAPIServerParams(hcp *hyperv1.HostedControlPlane, globalConfig g }, LivenessProbes: config.LivenessProbes{ oauthContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(OpenShiftOAuthAPIServerPort)), @@ -120,7 +120,7 @@ func NewOpenShiftAPIServerParams(hcp *hyperv1.HostedControlPlane, globalConfig g }, ReadinessProbes: config.ReadinessProbes{ oasContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(OpenShiftOAuthAPIServerPort)), diff --git a/control-plane-operator/controllers/hostedcontrolplane/oauth/params.go b/control-plane-operator/controllers/hostedcontrolplane/oauth/params.go index ed8c337917..ccbec20ead 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/oauth/params.go +++ b/control-plane-operator/controllers/hostedcontrolplane/oauth/params.go @@ -96,7 +96,7 @@ func NewOAuthServerParams(hcp *hyperv1.HostedControlPlane, globalConfig globalco } p.LivenessProbes = config.LivenessProbes{ oauthContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(OAuthServerPort)), @@ -112,7 +112,7 @@ func NewOAuthServerParams(hcp *hyperv1.HostedControlPlane, globalConfig globalco } p.ReadinessProbes = config.ReadinessProbes{ oauthContainerMain().Name: { - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Scheme: corev1.URISchemeHTTPS, Port: intstr.FromInt(int(OAuthServerPort)), diff --git a/docs/content/quickstart.md b/docs/content/quickstart.md index 0e86b7aee4..6d3a1fa656 100644 --- a/docs/content/quickstart.md +++ b/docs/content/quickstart.md @@ -15,7 +15,7 @@ you should adjust to your own environment. ## Prerequisites -* Go 1.16+ +* Go 1.17+ * Admin access to an OpenShift cluster (version 4.8+) specified by the `KUBECONFIG` environment variable * The OpenShift CLI (`oc`) or Kubernetes CLI (`kubectl`) * An [AWS credentials file](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) diff --git a/hosted-cluster-config-operator/operator/config.go b/hosted-cluster-config-operator/operator/config.go index 9ed26fdd59..294c8663ad 100644 --- a/hosted-cluster-config-operator/operator/config.go +++ b/hosted-cluster-config-operator/operator/config.go @@ -166,9 +166,7 @@ func (c *HostedClusterConfigOperatorConfig) Config() *rest.Config { } func (c *HostedClusterConfigOperatorConfig) Logger() logr.Logger { - if c.logger == nil { - c.logger = ctrl.Log.WithName("hypershift-operator") - } + c.logger = ctrl.Log.WithName("hypershift-operator") return c.logger } diff --git a/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go b/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go index f76a281e0c..988f6c60aa 100644 --- a/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go +++ b/hypershift-operator/controllers/hostedcluster/hostedcluster_controller.go @@ -73,8 +73,8 @@ import ( "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/util/workqueue" k8sutilspointer "k8s.io/utils/pointer" - capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" - capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" + capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" + capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" // Need this dep atm to satisfy IBM provider dep. capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -96,17 +96,17 @@ const ( // Upstream canonical image is k8s.gcr.io/autoscaling/cluster-autoscaler:v1.21.0 imageClusterAutoscaler = "quay.io/openshift/origin-cluster-autoscaler:4.10.0" + // Image built from https://github.com/openshift/cluster-machine-approver/tree/release-4.10 + imageMachineApprover = "quay.io/openshift/origin-cluster-machine-approver:4.10.0" + // Image built from https://github.com/openshift/cluster-api/tree/release-1.0 // Upstream canonical image comes from https://console.cloud.google.com/gcr/images/k8s-staging-cluster-api/global/ // us.gcr.io/k8s-artifacts-prod/cluster-api/cluster-api-controller:v1.0.0 imageCAPI = "registry.ci.openshift.org/hypershift/cluster-api:v1.0.0" - // Image built from https://github.com/openshift/cluster-machine-approver/tree/release-4.10 - imageMachineApprover = "quay.io/openshift/origin-cluster-machine-approver:4.10.0" - // TODO (alberto): Eventually this image will be mirrored and pulled from an internal registry. // This comes from https://console.cloud.google.com/gcr/images/k8s-artifacts-prod - imageCAPA = "us.gcr.io/k8s-artifacts-prod/cluster-api-aws/cluster-api-aws-controller:v0.7.0" + imageCAPA = "us.gcr.io/k8s-artifacts-prod/cluster-api-aws/cluster-api-aws-controller:v1.1.0" ) // NoopReconcile is just a default mutation function that does nothing. @@ -1729,7 +1729,7 @@ func (r *HostedClusterReconciler) reconcileIgnitionServer(ctx context.Context, h "--registry-overrides", convertRegistryOverridesToCommandLineFlag(r.ReleaseProvider.(*releaseinfo.RegistryMirrorProviderDecorator).RegistryOverrides), }, LivenessProbe: &corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ TCPSocket: &corev1.TCPSocketAction{ Port: intstr.FromInt(9090), }, @@ -1741,7 +1741,7 @@ func (r *HostedClusterReconciler) reconcileIgnitionServer(ctx context.Context, h SuccessThreshold: 1, }, ReadinessProbe: &corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ TCPSocket: &corev1.TCPSocketAction{ Port: intstr.FromInt(9090), }, @@ -2165,6 +2165,20 @@ func reconcileAWSCluster(awsCluster *capiawsv1.AWSCluster, hcluster *hyperv1.Hos if hcluster.Spec.Platform.AWS.CloudProviderConfig != nil { awsCluster.Spec.NetworkSpec.VPC.ID = hcluster.Spec.Platform.AWS.CloudProviderConfig.VPC + + // TODO: This https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/2728 + // broke our assumption in CAPA 0.7 for externally managed infrastructure. + // This effectively limit our ability to span NodePools across multiple subnets. + // In a follow up we need to either enable upstream back to support arbitrary subnets IDs + // in the awsMachine CR or possibly expose a slice of available subnets for NodePools in hcluster.Spec.Platform.AWS. + if hcluster.Spec.Platform.AWS.CloudProviderConfig.Subnet != nil && + hcluster.Spec.Platform.AWS.CloudProviderConfig.Subnet.ID != nil { + awsCluster.Spec.NetworkSpec.Subnets = []capiawsv1.SubnetSpec{ + { + ID: *hcluster.Spec.Platform.AWS.CloudProviderConfig.Subnet.ID, + }, + } + } } if len(hcluster.Spec.Platform.AWS.ResourceTags) > 0 { @@ -2177,7 +2191,7 @@ func reconcileAWSCluster(awsCluster *capiawsv1.AWSCluster, hcluster *hyperv1.Hos // Set the values for upper level controller awsCluster.Status.Ready = true - awsCluster.Spec.ControlPlaneEndpoint = capiv1alpha4.APIEndpoint{ + awsCluster.Spec.ControlPlaneEndpoint = capiv1.APIEndpoint{ Host: apiEndpoint.Host, Port: apiEndpoint.Port, } @@ -2528,7 +2542,7 @@ func reconcileCAPIAWSProviderDeployment(deployment *appsv1.Deployment, hc *hyper }, }, LivenessProbe: &corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/healthz", Port: intstr.FromString("healthz"), @@ -2536,7 +2550,7 @@ func reconcileCAPIAWSProviderDeployment(deployment *appsv1.Deployment, hc *hyper }, }, ReadinessProbe: &corev1.Probe{ - Handler: corev1.Handler{ + ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/readyz", Port: intstr.FromString("healthz"), diff --git a/hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go b/hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go index 6905a55fb3..7049e2ef12 100644 --- a/hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go +++ b/hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go @@ -4,23 +4,20 @@ import ( "testing" "time" - "github.com/openshift/hypershift/hypershift-operator/controllers/manifests/ignitionserver" - "k8s.io/apimachinery/pkg/util/intstr" - capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" - "github.com/google/go-cmp/cmp" . "github.com/onsi/gomega" - + configv1 "github.com/openshift/api/config/v1" + hyperv1 "github.com/openshift/hypershift/api/v1alpha1" + "github.com/openshift/hypershift/hypershift-operator/controllers/manifests/autoscaler" + "github.com/openshift/hypershift/hypershift-operator/controllers/manifests/ignitionserver" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/clock" + "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/utils/pointer" - - configv1 "github.com/openshift/api/config/v1" - hyperv1 "github.com/openshift/hypershift/api/v1alpha1" - "github.com/openshift/hypershift/hypershift-operator/controllers/manifests/autoscaler" + capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" ) var Now = metav1.NewTime(time.Now()) diff --git a/hypershift-operator/controllers/manifests/controlplaneoperator/manifests.go b/hypershift-operator/controllers/manifests/controlplaneoperator/manifests.go index bfb503c370..da15914c48 100644 --- a/hypershift-operator/controllers/manifests/controlplaneoperator/manifests.go +++ b/hypershift-operator/controllers/manifests/controlplaneoperator/manifests.go @@ -8,7 +8,7 @@ import ( corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" + capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" ) @@ -82,15 +82,6 @@ func HostedControlPlane(controlPlaneNamespace string, hostedClusterName string) } } -func AWSCluster(controlPlaneNamespace string, hostedClusterName string) *capiawsv1.AWSCluster { - return &capiawsv1.AWSCluster{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: controlPlaneNamespace, - Name: hostedClusterName, - }, - } -} - func PullSecret(controlPlaneNamespace string) *corev1.Secret { return &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ @@ -135,3 +126,12 @@ func PodMonitor(controlPlaneNamespace string, hostedClusterName string) *prometh }, } } + +func AWSCluster(controlPlaneNamespace string, hostedClusterName string) *capiawsv1.AWSCluster { + return &capiawsv1.AWSCluster{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: controlPlaneNamespace, + Name: hostedClusterName, + }, + } +} diff --git a/hypershift-operator/controllers/nodepool/manifest_test.go b/hypershift-operator/controllers/nodepool/manifest_test.go index b93c341892..e0fb13cb2d 100644 --- a/hypershift-operator/controllers/nodepool/manifest_test.go +++ b/hypershift-operator/controllers/nodepool/manifest_test.go @@ -7,7 +7,7 @@ import ( hyperv1 "github.com/openshift/hypershift/api/v1alpha1" "k8s.io/apimachinery/pkg/api/equality" k8sutilspointer "k8s.io/utils/pointer" - capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" + capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" ) const amiName = "ami" diff --git a/hypershift-operator/controllers/nodepool/manifests.go b/hypershift-operator/controllers/nodepool/manifests.go index a626076d98..8fc564bb9b 100644 --- a/hypershift-operator/controllers/nodepool/manifests.go +++ b/hypershift-operator/controllers/nodepool/manifests.go @@ -7,7 +7,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8sutilspointer "k8s.io/utils/pointer" - capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" + capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" ctrlclient "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/hypershift-operator/controllers/nodepool/nodepool_controller.go b/hypershift-operator/controllers/nodepool/nodepool_controller.go index f3f2d9e7e0..8d9b39d3aa 100644 --- a/hypershift-operator/controllers/nodepool/nodepool_controller.go +++ b/hypershift-operator/controllers/nodepool/nodepool_controller.go @@ -40,7 +40,7 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" k8sutilspointer "k8s.io/utils/pointer" - capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" + capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/patch" diff --git a/hypershift-operator/controllers/platform/aws/controller.go b/hypershift-operator/controllers/platform/aws/controller.go index 9bb3925a8a..b50e52894e 100644 --- a/hypershift-operator/controllers/platform/aws/controller.go +++ b/hypershift-operator/controllers/platform/aws/controller.go @@ -59,7 +59,10 @@ func (r *AWSEndpointServiceReconciler) SetupWithManager(mgr ctrl.Manager) error } func (r *AWSEndpointServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - log := logr.FromContext(ctx) + log, err := logr.FromContext(ctx) + if err != nil { + return ctrl.Result{}, fmt.Errorf("no logger found: %w", err) + } log.Info("reconciling") // Fetch the AWSEndpointService @@ -69,8 +72,7 @@ func (r *AWSEndpointServiceReconciler) Reconcile(ctx context.Context, req ctrl.R Namespace: req.Namespace, }, } - err := r.Get(ctx, client.ObjectKeyFromObject(obj), obj) - if err != nil { + if err := r.Get(ctx, client.ObjectKeyFromObject(obj), obj); err != nil { if apierrors.IsNotFound(err) { return ctrl.Result{}, nil } @@ -142,7 +144,10 @@ func (r *AWSEndpointServiceReconciler) Reconcile(ctx context.Context, req ctrl.R } func reconcileAWSEndpointService(ctx context.Context, awsEndpointService *hyperv1.AWSEndpointService, ec2Client ec2iface.EC2API, elbv2Client elbv2iface.ELBV2API) error { - log := logr.FromContext(ctx) + log, err := logr.FromContext(ctx) + if err != nil { + return fmt.Errorf("no logger found: %w", err) + } serviceName := awsEndpointService.Status.EndpointServiceName if len(serviceName) != 0 { @@ -241,7 +246,10 @@ func findExistingVpcEndpointService(ctx context.Context, ec2Client ec2iface.EC2A } func (r *AWSEndpointServiceReconciler) delete(ctx context.Context, awsEndpointService *hyperv1.AWSEndpointService) (bool, error) { - log := logr.FromContext(ctx) + log, err := logr.FromContext(ctx) + if err != nil { + return false, fmt.Errorf("no logger found: %w", err) + } serviceName := awsEndpointService.Status.EndpointServiceName if len(serviceName) == 0 { diff --git a/support/api/scheme.go b/support/api/scheme.go index 6ae0ef505b..357f44a078 100644 --- a/support/api/scheme.go +++ b/support/api/scheme.go @@ -22,7 +22,7 @@ import ( apiserverconfigv1 "k8s.io/apiserver/pkg/apis/config/v1" clientgoscheme "k8s.io/client-go/kubernetes/scheme" apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" - capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" + capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" ) diff --git a/support/upsert/loopdetector.go b/support/upsert/loopdetector.go index 3baf7bf387..f910a7015a 100644 --- a/support/upsert/loopdetector.go +++ b/support/upsert/loopdetector.go @@ -4,10 +4,10 @@ import ( "fmt" "sync" - "github.com/bombsimon/logrusr" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + "github.com/go-logr/logr" "github.com/google/go-cmp/cmp" - "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" @@ -18,7 +18,7 @@ func newUpdateLoopDetector() *updateLoopDetector { return &updateLoopDetector{ hasNoOpUpdate: sets.String{}, updateEventCount: map[string]int{}, - log: logrusr.NewLogger(func() logrus.FieldLogger { l := logrus.New(); l.SetFormatter(&logrus.JSONFormatter{}); return l }()), + log: zap.New(zap.UseDevMode(true), zap.JSONEncoder()), } } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 34737c2478..62c6e1f72f 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -22,14 +22,12 @@ import ( hyperv1 "github.com/openshift/hypershift/api/v1alpha1" "github.com/openshift/hypershift/cmd/cluster/core" "github.com/openshift/hypershift/cmd/version" - - "github.com/bombsimon/logrusr" "github.com/openshift/hypershift/test/e2e/podtimingcontroller" e2eutil "github.com/openshift/hypershift/test/e2e/util" "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/util/errors" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" "sigs.k8s.io/controller-runtime/pkg/manager" ) @@ -41,7 +39,7 @@ var ( // be cancelled if a SIGINT or SIGTERM is received. It's set up in TestMain. testContext context.Context - log = logrusr.NewLogger(logrus.New()) + log = zap.New(zap.UseDevMode(true), zap.JSONEncoder()) ) func init() { diff --git a/test/e2e/util/scheme.go b/test/e2e/util/scheme.go index e411851d27..a98f51e522 100644 --- a/test/e2e/util/scheme.go +++ b/test/e2e/util/scheme.go @@ -16,7 +16,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" kasv1beta1 "k8s.io/apiserver/pkg/apis/apiserver/v1beta1" clientgoscheme "k8s.io/client-go/kubernetes/scheme" - capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1alpha4" + capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" ) diff --git a/thirdparty/machineconfigoperator/pkg/apis/machineconfiguration.openshift.io/v1/zz_generated_deepcopy.go b/thirdparty/machineconfigoperator/pkg/apis/machineconfiguration.openshift.io/v1/zz_generated_deepcopy.go index 19715ebeae..8828dd972e 100644 --- a/thirdparty/machineconfigoperator/pkg/apis/machineconfiguration.openshift.io/v1/zz_generated_deepcopy.go +++ b/thirdparty/machineconfigoperator/pkg/apis/machineconfiguration.openshift.io/v1/zz_generated_deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by deepcopy-gen. DO NOT EDIT.