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

chore: update to ginkgo v2, golang v1.20, and k8s client v1.27 #242

Merged
merged 3 commits into from
Apr 29, 2024
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Go for aks-engine-azurestack",
"image": "mcr.microsoft.com/oss/azcu/go-dev:v1.36.2",
"image": "mcr.microsoft.com/oss/azcu/go-dev:v1.38.3",
"customizations": {
"vscode": {
"extensions": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
docker run --rm \
-v ${GITHUB_WORKSPACE}:/go/src/github.com/Azure/aks-engine-azurestack \
-w /go/src/github.com/Azure/aks-engine-azurestack \
mcr.microsoft.com/oss/azcu/go-dev:v1.36.2 make dist
mcr.microsoft.com/oss/azcu/go-dev:v1.38.3 make dist
- name: Rename outputs
run: |
mkdir ./outputs
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/pr-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pr:
resources:
containers:
- container: dev1
image: mcr.microsoft.com/oss/azcu/go-dev:v1.36.2
image: mcr.microsoft.com/oss/azcu/go-dev:v1.38.3

jobs:
- job: unit_tests
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/vhd-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: $(Year:yyyy).$(DayOfYear).$(Rev:r)_Ubuntu_$(UBUNTU_SKU)
trigger: none

variables:
CONTAINER_IMAGE: 'mcr.microsoft.com/oss/azcu/go-dev:v1.36.2'
CONTAINER_IMAGE: 'mcr.microsoft.com/oss/azcu/go-dev:v1.38.3'

pool:
vmImage: 'Ubuntu 20.04'
Expand Down
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ifeq ($(GITTAG),)
GITTAG := $(VERSION_SHORT)
endif

DEV_ENV_IMAGE := mcr.microsoft.com/oss/azcu/go-dev:v1.36.2
DEV_ENV_IMAGE := mcr.microsoft.com/oss/azcu/go-dev:v1.38.3
DEV_ENV_WORK_DIR := /aks-engine-azurestack
DEV_ENV_OPTS := --rm -v $(GOPATH)/pkg/mod:/go/pkg/mod -v $(CURDIR):$(DEV_ENV_WORK_DIR) -w $(DEV_ENV_WORK_DIR) $(DEV_ENV_VARS)
DEV_ENV_CMD := docker run $(DEV_ENV_OPTS) $(DEV_ENV_IMAGE)
Expand Down Expand Up @@ -129,16 +129,11 @@ checksum:
clean: tools-clean
@rm -rf $(BINDIR) ./_dist ./pkg/helpers/unit_tests

GIT_BASEDIR = $(shell git rev-parse --show-toplevel 2>/dev/null)
ifneq ($(GIT_BASEDIR),)
LDFLAGS += -X github.com/Azure/aks-engine-azurestack/pkg/test.JUnitOutDir=$(GIT_BASEDIR)/test/junit
endif

ginkgoBuild: generate
make -C ./test/e2e ginkgo-build

test: generate
ginkgo -mod=vendor -skipPackage test/e2e -failFast -r -v -tags=fast -ldflags '$(LDFLAGS)' .
ginkgo -mod=vendor -junit-report -skip-package test/e2e -fail-fast -r -v -tags=fast .

.PHONY: test-style
test-style: validate-go validate-shell validate-copyright-headers
Expand Down
21 changes: 16 additions & 5 deletions cmd/rotatecerts/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package rotatecerts

import (
"context"
"fmt"
"time"

Expand All @@ -26,7 +27,9 @@ func waitForNodesCondition(client internal.KubeClient, condition nodesCondition,
var nl *v1.NodeList
var err error
var successesCount int
err = wait.PollImmediate(interval, timeout, func() (bool, error) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
err = wait.PollUntilContextCancel(ctx, interval, true, func(ctx context.Context) (bool, error) {
nl, err = client.ListNodes()
if err != nil {
return false, err
Expand Down Expand Up @@ -82,7 +85,9 @@ func waitForPodsCondition(client internal.KubeClient, namespace string, conditio
var listErr, condErr error
var successesCount int
var pl *v1.PodList
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
err := wait.PollUntilContextCancel(ctx, interval, true, func(ctx context.Context) (bool, error) {
pl, listErr = client.ListPods(namespace, metav1.ListOptions{})
if listErr != nil {
return false, listErr
Expand Down Expand Up @@ -176,7 +181,9 @@ func waitForDaemonSetCondition(client internal.KubeClient, namespace string, con
var listErr, condErr error
var successesCount int
var dsl *appsv1.DaemonSetList
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
err := wait.PollUntilContextCancel(ctx, interval, true, func(ctx context.Context) (bool, error) {
dsl, listErr = client.ListDaemonSets(namespace, metav1.ListOptions{})
if listErr != nil {
return false, listErr
Expand Down Expand Up @@ -222,7 +229,9 @@ func waitForDeploymentCondition(client internal.KubeClient, namespace string, co
var listErr, condErr error
var successesCount int
var dl *appsv1.DeploymentList
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
err := wait.PollUntilContextCancel(ctx, interval, true, func(ctx context.Context) (bool, error) {
dl, listErr = client.ListDeployments(namespace, metav1.ListOptions{})
if listErr != nil {
return false, listErr
Expand Down Expand Up @@ -265,7 +274,9 @@ func allDeploymentReplicasUpdatedCondition(dsl *appsv1.DeploymentList) error {
func WaitForVMsRunning(client internal.ARMClient, resourceGroupName string, requiredVMs []string, interval, timeout time.Duration) error {
var err error
var successesCount int
err = wait.PollImmediate(interval, timeout, func() (bool, error) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
err = wait.PollUntilContextCancel(ctx, interval, true, func(ctx context.Context) (bool, error) {
allRunning := true
for _, vm := range requiredVMs {
var state string
Expand Down
3 changes: 2 additions & 1 deletion cmd/rotatecerts/wait_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package rotatecerts

import (
"context"
"fmt"
"testing"
"time"
Expand Down Expand Up @@ -57,7 +58,7 @@ func TestWaitForNodesCondition(t *testing.T) {

_, err := waitForNodesCondition(mock, falseCond, 1, 500*time.Millisecond, 1*time.Second)
g.Expect(err).To(HaveOccurred())
g.Expect(fmt.Sprint(err)).To(Equal("timed out waiting for the condition"))
g.Expect(errors.Is(err, context.DeadlineExceeded)).To(BeTrue())
})
}

Expand Down
70 changes: 40 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Azure/aks-engine-azurestack

go 1.19
go 1.20

require (
github.com/Azure/azure-sdk-for-go v43.0.0+incompatible
Expand All @@ -16,28 +16,28 @@ require (
github.com/davecgh/go-spew v1.1.1
github.com/fatih/structs v1.1.0
github.com/golang/mock v1.4.4
github.com/google/go-cmp v0.5.5
github.com/google/uuid v1.1.2
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.3.0
github.com/imdario/mergo v0.3.6
github.com/jarcoal/httpmock v1.0.1
github.com/leonelquinteros/gotext v1.4.0
github.com/mattn/go-colorable v0.0.9
github.com/mitchellh/go-homedir v1.1.0
github.com/onsi/ginkgo v1.15.0
github.com/onsi/gomega v1.10.1
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.30.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.0
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.5
github.com/x-cray/logrus-prefixed-formatter v0.5.2
golang.org/x/crypto v0.17.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/crypto v0.21.0
golang.org/x/sync v0.6.0
golang.org/x/text v0.14.0
gopkg.in/go-playground/validator.v9 v9.25.0
gopkg.in/ini.v1 v1.41.0
k8s.io/api v0.21.10
k8s.io/apimachinery v0.21.10
k8s.io/client-go v0.21.10
k8s.io/api v0.27.13
k8s.io/apimachinery v0.27.13
k8s.io/client-go v0.27.13
)

require (
Expand All @@ -48,41 +48,51 @@ require (
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/dimchansky/utfbom v1.1.0 // indirect
github.com/dnaeon/go-vcr v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-playground/locales v0.12.1 // indirect
github.com/go-playground/universal-translator v0.16.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.1.0 // indirect
github.com/magefile/mage v1.10.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/nxadm/tail v1.4.4 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.26.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog/v2 v2.9.0 // indirect
k8s.io/utils v0.0.0-20210521133846-da695404a2bc // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading