Skip to content

Commit

Permalink
Changes to update capa v1beta1 and support golang 1.17
Browse files Browse the repository at this point in the history
Bring CAPA v1beta1, kube 1.23 deps and golang 1.17.
Drops https://github.com/bombsimon/logrusr/ which does not support golang 1.17 in favour of zapr.
Adds .ci-operator.yaml so upcoming golang bumps can be done in this repo atomically.

Note the TODO in HostedCluster
This kubernetes-sigs/cluster-api-provider-aws#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.
  • Loading branch information
enxebre committed Nov 23, 2021
1 parent 5cd9ada commit 0c77b1a
Show file tree
Hide file tree
Showing 49 changed files with 274 additions and 164 deletions.
4 changes: 4 additions & 0 deletions .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build_root_image:
namespace: openshift
name: release
tag: golang-1.17
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion api/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/capi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/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 availability-prober/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
7 changes: 2 additions & 5 deletions cmd/bastion/aws/logging.go
Original file line number Diff line number Diff line change
@@ -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())
2 changes: 1 addition & 1 deletion cmd/cluster/aws/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
7 changes: 2 additions & 5 deletions cmd/cluster/aws/log.go
Original file line number Diff line number Diff line change
@@ -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())
5 changes: 2 additions & 3 deletions cmd/cluster/core/log.go
Original file line number Diff line number Diff line change
@@ -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())
5 changes: 2 additions & 3 deletions cmd/cluster/none/log.go
Original file line number Diff line number Diff line change
@@ -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())
7 changes: 2 additions & 5 deletions cmd/consolelogs/aws/logging.go
Original file line number Diff line number Diff line change
@@ -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())
7 changes: 2 additions & 5 deletions cmd/infra/aws/logging.go
Original file line number Diff line number Diff line change
@@ -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())
8 changes: 4 additions & 4 deletions cmd/install/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
singular: awsclustercontrolleridentity
scope: Cluster
versions:
- name: v1alpha4
- name: v1beta1
schema:
openAPIV3Schema:
description: AWSClusterControllerIdentity is the Schema for the awsclustercontrolleridentities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
singular: awsclusterroleidentity
scope: Cluster
versions:
- name: v1alpha4
- name: v1beta1
schema:
openAPIV3Schema:
description: AWSClusterRoleIdentity is the Schema for the awsclusterroleidentities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -566,6 +577,7 @@ spec:
important.
type: string
required:
- lastTransitionTime
- status
- type
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
singular: awsclusterstaticidentity
scope: Cluster
versions:
- name: v1alpha4
- name: v1beta1
schema:
openAPIV3Schema:
description: AWSClusterStaticIdentity is the Schema for the awsclusterstaticidentities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -144,6 +144,7 @@ spec:
important.
type: string
required:
- lastTransitionTime
- status
- type
type: object
Expand Down
Loading

0 comments on commit 0c77b1a

Please sign in to comment.