Skip to content

Commit

Permalink
Merge pull request #969 from richardcase/bump_capi_144
Browse files Browse the repository at this point in the history
chore: bump CAPI to v1.4.4
  • Loading branch information
k8s-ci-robot authored Jul 11, 2023
2 parents cfaac04 + f7d3805 commit 2131458
Show file tree
Hide file tree
Showing 27 changed files with 202 additions and 1,027 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ GOLANGCI_LINT_VER := v1.52.1
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)

KIND_VER := v0.17.0
KIND_VER := v0.20.0
KIND_BIN := kind
KIND := $(TOOLS_BIN_DIR)/$(KIND_BIN)-$(KIND_VER)

Expand All @@ -102,7 +102,7 @@ SETUP_ENVTEST_VER := v0.0.0-20211110210527-619e6b92dab9
SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)

GO_APIDIFF_VER := v0.4.0
GO_APIDIFF_VER := v0.6.0
GO_APIDIFF_BIN := go-apidiff
GO_APIDIFF := $(TOOLS_BIN_DIR)/$(GO_APIDIFF_BIN)

Expand Down Expand Up @@ -473,7 +473,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KIND) $(KUBECTL)
./hack/install-cert-manager.sh

# Deploy CAPI
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.3.8/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.4/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -

# Deploy CAPG
$(KIND) load docker-image $(CONTROLLER_IMG)-$(ARCH):$(TAG) --name=clusterapi
Expand Down
4 changes: 2 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ settings = {
"deploy_cert_manager": True,
"preload_images_for_kind": True,
"kind_cluster_name": "capg",
"capi_version": "v1.3.8",
"capi_version": "v1.4.4",
"cert_manager_version": "v1.11.0",
"kubernetes_version": "v1.25.10",
"kubernetes_version": "v1.26.1",
}

keys = ["GCP_B64ENCODED_CREDENTIALS"]
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha3/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha3 contains the v1alpha3 API implementation.
//
// Deprecated: This package will be removed in one of the next releases
package v1alpha3

// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-gcp/api/v1beta1
2 changes: 1 addition & 1 deletion api/v1alpha3/gcpcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1alpha3

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3" //nolint: staticcheck
)

const (
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha4/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha4 contains the v1alpha4 API implementation.
//
// Deprecated: This package will be removed in one of the next releases.
package v1alpha4

// +k8s:conversion-gen=sigs.k8s.io/cluster-api-provider-gcp/api/v1beta1
2 changes: 1 addition & 1 deletion api/v1alpha4/gcpcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1alpha4

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" //nolint: staticcheck
)

const (
Expand Down
12 changes: 6 additions & 6 deletions cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ func (m *MachineScope) Role() string {

// GetInstanceID returns the GCPMachine instance id by parsing Spec.ProviderID.
func (m *MachineScope) GetInstanceID() *string {
parsed, err := noderefutil.NewProviderID(m.GetProviderID())
parsed, err := noderefutil.NewProviderID(m.GetProviderID()) //nolint: staticcheck
if err != nil {
return nil
}

return pointer.StringPtr(parsed.ID())
return pointer.String(parsed.ID()) //nolint: staticcheck
}

// GetProviderID returns the GCPMachine providerID from the spec.
Expand All @@ -171,7 +171,7 @@ func (m *MachineScope) GetProviderID() string {
// SetProviderID sets the GCPMachine providerID in spec.
func (m *MachineScope) SetProviderID() {
providerID, _ := providerid.New(m.ClusterGetter.Project(), m.Zone(), m.Name())
m.GCPMachine.Spec.ProviderID = pointer.StringPtr(providerID.String())
m.GCPMachine.Spec.ProviderID = pointer.String(providerID.String())
}

// GetInstanceStatus returns the GCPMachine instance status.
Expand All @@ -191,7 +191,7 @@ func (m *MachineScope) SetReady() {

// SetFailureMessage sets the GCPMachine status failure message.
func (m *MachineScope) SetFailureMessage(v error) {
m.GCPMachine.Status.FailureMessage = pointer.StringPtr(v.Error())
m.GCPMachine.Status.FailureMessage = pointer.String(v.Error())
}

// SetFailureReason sets the GCPMachine status failure reason.
Expand Down Expand Up @@ -253,7 +253,7 @@ func (m *MachineScope) InstanceAdditionalDiskSpec() []*compute.AttachedDisk {
additionalDisk := &compute.AttachedDisk{
AutoDelete: true,
InitializeParams: &compute.AttachedDiskInitializeParams{
DiskSizeGb: pointer.Int64PtrDerefOr(disk.Size, 30),
DiskSizeGb: pointer.Int64Deref(disk.Size, 30),
DiskType: path.Join("zones", m.Zone(), "diskTypes", string(*disk.DeviceType)),
},
}
Expand Down Expand Up @@ -341,7 +341,7 @@ func (m *MachineScope) InstanceSpec(log logr.Logger) *compute.Instance {
Labels: infrav1.Build(infrav1.BuildParams{
ClusterName: m.ClusterGetter.Name(),
Lifecycle: infrav1.ResourceLifecycleOwned,
Role: pointer.StringPtr(m.Role()),
Role: pointer.String(m.Role()),
// TODO(vincepri): Check what needs to be added for the cloud provider label.
Additional: m.ClusterGetter.AdditionalLabels().AddLabels(m.GCPMachine.Spec.AdditionalLabels),
}),
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/managedcontrolplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (s *ManagedControlPlaneScope) GetAllNodePools(ctx context.Context) ([]infra
if s.AllManagedMachinePools == nil || len(s.AllManagedMachinePools) == 0 {
listOptions := []client.ListOption{
client.InNamespace(s.GCPManagedControlPlane.Namespace),
client.MatchingLabels(map[string]string{clusterv1.ClusterLabelName: s.Cluster.Name}),
client.MatchingLabels(map[string]string{clusterv1.ClusterNameLabel: s.Cluster.Name}),
}

machinePoolList := &clusterv1exp.MachinePoolList{}
Expand Down
2 changes: 1 addition & 1 deletion cloud/services/compute/instances/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (s *Service) createOrGetInstance(ctx context.Context) (*compute.Instance, e
instanceKey := meta.ZonalKey(instanceName, s.scope.Zone())
instanceSpec.Metadata.Items = append(instanceSpec.Metadata.Items, &compute.MetadataItems{
Key: "user-data",
Value: pointer.StringPtr(bootstrapData),
Value: pointer.String(bootstrapData),
})

log.V(2).Info("Looking for instance", "name", instanceName, "zone", s.scope.Zone())
Expand Down
4 changes: 2 additions & 2 deletions clusterctl-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "infrastructure-gcp",
"config": {
"componentsFile": "infrastructure-components.yaml",
"nextVersion": "v1.3.0"
"nextVersion": "v1.4.0"
}
}
}
8 changes: 8 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ spec:
port: healthz
initialDelaySeconds: 10
periodSeconds: 10
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
runAsUser: 65532
runAsGroup: 65532
env:
- name: NODE_NAME
valueFrom:
Expand Down
2 changes: 1 addition & 1 deletion controllers/gcpmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (r *GCPMachineReconciler) GCPClusterToGCPMachines(ctx context.Context) hand
return result
}

labels := map[string]string{clusterv1.ClusterLabelName: cluster.Name}
labels := map[string]string{clusterv1.ClusterNameLabel: cluster.Name}
machineList := &clusterv1.MachineList{}
if err := r.List(ctx, machineList, client.InNamespace(c.Namespace), client.MatchingLabels(labels)); err != nil {
log.Error(err, "failed to list Machines")
Expand Down
2 changes: 1 addition & 1 deletion controllers/gcpmachine_controller_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func newMachine(clusterName, machineName string) *clusterv1.Machine {
return &clusterv1.Machine{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
clusterv1.ClusterLabelName: clusterName,
clusterv1.ClusterNameLabel: clusterName,
},
Name: machineName,
Namespace: "default",
Expand Down
9 changes: 3 additions & 6 deletions exp/api/v1beta1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"testing"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

admissionv1beta1 "k8s.io/api/admission/v1beta1"
Expand All @@ -34,7 +34,6 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)
Expand All @@ -51,9 +50,7 @@ var cancel context.CancelFunc
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Webhook Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Webhook Suite")
}

var _ = BeforeSuite(func() {
Expand Down Expand Up @@ -130,7 +127,7 @@ var _ = BeforeSuite(func() {
return nil
}).Should(Succeed())

}, 60)
})

var _ = AfterSuite(func() {
cancel()
Expand Down
2 changes: 1 addition & 1 deletion exp/controllers/gcpmanagedmachinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func managedControlPlaneToManagedMachinePoolMapFunc(c client.Client, gvk schema.

managedPoolForClusterList := expclusterv1.MachinePoolList{}
if err := c.List(
ctx, &managedPoolForClusterList, client.InNamespace(clusterKey.Namespace), client.MatchingLabels{clusterv1.ClusterLabelName: clusterKey.Name},
ctx, &managedPoolForClusterList, client.InNamespace(clusterKey.Namespace), client.MatchingLabels{clusterv1.ClusterNameLabel: clusterKey.Name},
); err != nil {
log.Error(err, "couldn't list pools for cluster")
return nil
Expand Down
9 changes: 3 additions & 6 deletions exp/controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import (
"path/filepath"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
infrastructurev1beta1 "sigs.k8s.io/cluster-api-provider-gcp/exp/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)
Expand All @@ -42,9 +41,7 @@ var testEnv *envtest.Environment
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Controller Suite")
}

var _ = BeforeSuite(func() {
Expand All @@ -71,7 +68,7 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())

}, 60)
})

var _ = AfterSuite(func() {
By("tearing down the test environment")
Expand Down
Loading

0 comments on commit 2131458

Please sign in to comment.