Skip to content

Commit

Permalink
Use Go 1.23
Browse files Browse the repository at this point in the history
Signed-off-by: 1gtm <[email protected]>
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
1gtm authored and tamalsaha committed Aug 17, 2024
1 parent 9a0ec7e commit a49081a
Show file tree
Hide file tree
Showing 21 changed files with 264 additions and 186 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ concurrency:
jobs:
build:
name: Build
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Set up Go 1.22
- name: Set up Go 1.23
uses: actions/setup-go@v2
with:
go-version: '1.22'
go-version: '1.23'

- name: Check out code into the Go module directory
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
BASEIMAGE_PROD ?= gcr.io/distroless/static-debian11
BASEIMAGE_DBG ?= debian:bullseye

GO_VERSION ?= 1.22
GO_VERSION ?= 1.23
BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION)

OUTBIN = bin/$(OS)_$(ARCH)/$(BIN)
Expand Down
39 changes: 22 additions & 17 deletions cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
"github.com/stretchr/testify/assert"
"go.bytebuilders.dev/client"
clustermodel "go.bytebuilders.dev/resource-model/apis/cluster"
"go.bytebuilders.dev/resource-model/apis/cluster/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
kmapi "kmodules.xyz/resource-metadata/apis/meta/v1alpha1"
)

var (
Expand All @@ -38,6 +38,7 @@ var (
TestClusterID = "87873"
FeatureSetOpscenterCore = "opscenter-core"
FeatureKubeUIServer = "kube-ui-server"
FeatureLicenseServer = "license-proxyserver"
)

func TestClient_CheckClusterAPIs(t *testing.T) {
Expand All @@ -59,20 +60,22 @@ func TestClient_CheckClusterAPIs(t *testing.T) {
if !assert.Nil(t, err) {
return
}
assert.Equal(t, v1alpha1.ClusterPhaseNotImported, cluster.Status.Phase)
assert.Equal(t, kmapi.ClusterPhaseNotImported, cluster.Status.Phase)
})

t.Run("ImportCluster() should import the cluster", func(t *testing.T) {
cluster, err := c.ImportCluster(clustermodel.ImportOptions{
BasicInfo: basicInfo,
Provider: providerOptions,
Components: clustermodel.ComponentOptions{
FluxCD: true,
LicenseServer: true,
FluxCD: true,
FeatureSets: []clustermodel.FeatureSet{
{
Name: FeatureSetOpscenterCore,
Features: []string{FeatureKubeUIServer},
Name: FeatureSetOpscenterCore,
Features: []string{
FeatureKubeUIServer,
FeatureLicenseServer,
},
},
},
},
Expand All @@ -92,7 +95,7 @@ func TestClient_CheckClusterAPIs(t *testing.T) {
if !assert.Nil(t, err) {
return
}
assert.NotEqual(t, v1alpha1.ClusterPhaseNotImported, cluster.Status.Phase)
assert.NotEqual(t, kmapi.ClusterPhaseNotImported, cluster.Status.Phase)
})

t.Run("ListClusters() should return non empty cluster list when the cluster exist", func(t *testing.T) {
Expand Down Expand Up @@ -121,7 +124,7 @@ func TestClient_CheckClusterAPIs(t *testing.T) {
assert.Equal(t, TestClusterName, cluster.Spec.Name)
assert.Equal(t, TestClusterDisplayName, cluster.Spec.DisplayName)
assert.Equal(t, TestClusterProvider, string(cluster.Spec.Provider))
assert.Equal(t, v1alpha1.ClusterPhaseActive, cluster.Status.Phase)
assert.Equal(t, kmapi.ClusterPhaseActive, cluster.Status.Phase)
})

t.Run("GetClusterClientConfig() should return client-config for the cluster", func(t *testing.T) {
Expand Down Expand Up @@ -152,7 +155,7 @@ func TestClient_CheckClusterAPIs(t *testing.T) {
if !assert.Nil(t, err) {
return
}
assert.Equal(t, v1alpha1.ClusterPhaseActive, cluster.Status.Phase)
assert.Equal(t, kmapi.ClusterPhaseActive, cluster.Status.Phase)
})

// TODO: Remove cluster components, make the cluster NotReady, then run reconfigure.
Expand All @@ -168,12 +171,14 @@ func TestClient_CheckClusterAPIs(t *testing.T) {
err := c.RemoveCluster(clustermodel.RemovalOptions{
Name: TestClusterName,
Components: clustermodel.ComponentOptions{
FluxCD: true,
LicenseServer: true,
FluxCD: true,
FeatureSets: []clustermodel.FeatureSet{
{
Name: FeatureSetOpscenterCore,
Features: []string{FeatureKubeUIServer},
Name: FeatureSetOpscenterCore,
Features: []string{
FeatureKubeUIServer,
FeatureLicenseServer,
},
},
},
},
Expand Down Expand Up @@ -201,29 +206,29 @@ func TestClient_CheckClusterAPIs(t *testing.T) {
}

func waitForClusterToBeReady(c *client.Client, clusterName string) error {
return wait.PollImmediate(2*time.Second, 5*time.Minute, func() (done bool, err error) {
return wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 5*time.Minute, true, func(ctx context.Context) (done bool, err error) {
cluster, err := c.GetCluster(clustermodel.GetOptions{
Name: clusterName,
})
if err != nil {
return false, err
}
if cluster.Status.Phase == v1alpha1.ClusterPhaseActive {
if cluster.Status.Phase == kmapi.ClusterPhaseActive {
return true, nil
}
return false, nil
})
}

func waitForClusterToBeRemoved(c *client.Client, opts clustermodel.ProviderOptions) error {
return wait.PollImmediate(2*time.Second, 5*time.Minute, func() (done bool, err error) {
return wait.PollUntilContextTimeout(context.TODO(), 2*time.Second, 5*time.Minute, true, func(ctx context.Context) (done bool, err error) {
cluster, err := c.CheckClusterExistence(clustermodel.CheckOptions{
Provider: opts,
})
if err != nil {
return false, err
}
if cluster.Status.Phase == v1alpha1.ClusterPhaseNotImported {
if cluster.Status.Phase == kmapi.ClusterPhaseNotImported {
return true, nil
}
return false, nil
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ toolchain go1.22.4

require (
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/nats-io/nats.go v1.36.0
github.com/nats-io/nats.go v1.37.0
github.com/stretchr/testify v1.9.0
go.bytebuilders.dev/resource-model v0.0.11
k8s.io/apimachinery v0.30.1
k8s.io/client-go v0.30.1
go.bytebuilders.dev/resource-model v0.0.13-0.20240817060902-5c544790e4a4
k8s.io/apimachinery v0.30.2
k8s.io/client-go v0.30.2
kmodules.xyz/resource-metadata v0.18.10
x-helm.dev/apimachinery v0.0.16
)

Expand Down Expand Up @@ -92,15 +93,14 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.30.1 // indirect
k8s.io/api v0.30.2 // indirect
k8s.io/apiextensions-apiserver v0.30.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
kmodules.xyz/client-go v0.30.8 // indirect
kmodules.xyz/client-go v0.30.9 // indirect
kmodules.xyz/go-containerregistry v0.0.12 // indirect
kmodules.xyz/offshoot-api v0.29.4 // indirect
kmodules.xyz/resource-metadata v0.18.9 // indirect
kmodules.xyz/resource-metrics v0.30.1 // indirect
sigs.k8s.io/controller-runtime v0.18.4 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU=
github.com/nats-io/nats.go v1.36.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE=
github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
Expand Down Expand Up @@ -201,8 +201,8 @@ github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
go.bytebuilders.dev/resource-model v0.0.11 h1:JimHpmLFYoaX3Mr/wPVS4/sZq25nRDd44jGHrVlphmU=
go.bytebuilders.dev/resource-model v0.0.11/go.mod h1:RjAWtH/PUF3gF4nwcJhiMODftsYdv/zj2flO7YJA6UE=
go.bytebuilders.dev/resource-model v0.0.13-0.20240817060902-5c544790e4a4 h1:MiuuFs1zxabwJ2PXOthRD589H8UqkcdrtIPTn3vjNTY=
go.bytebuilders.dev/resource-model v0.0.13-0.20240817060902-5c544790e4a4/go.mod h1:TaZLPXaDqX83tKyOr/hgFpdzM0R97c48z7SI2hUvEoQ=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
Expand Down Expand Up @@ -299,28 +299,28 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk=
gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ=
k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY=
k8s.io/api v0.30.1/go.mod h1:ddbN2C0+0DIiPntan/bye3SW3PdwLa11/0yqwvuRrJM=
k8s.io/api v0.30.2 h1:+ZhRj+28QT4UOH+BKznu4CBgPWgkXO7XAvMcMl0qKvI=
k8s.io/api v0.30.2/go.mod h1:ULg5g9JvOev2dG0u2hig4Z7tQ2hHIuS+m8MNZ+X6EmI=
k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws=
k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4=
k8s.io/apimachinery v0.30.1 h1:ZQStsEfo4n65yAdlGTfP/uSHMQSoYzU/oeEbkmF7P2U=
k8s.io/apimachinery v0.30.1/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q=
k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc=
k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg=
k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/client-go v0.30.2 h1:sBIVJdojUNPDU/jObC+18tXWcTJVcwyqS9diGdWHk50=
k8s.io/client-go v0.30.2/go.mod h1:JglKSWULm9xlJLx4KCkfLLQ7XwtlbflV6uFFSHTMgVs=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f h1:0LQagt0gDpKqvIkAMPaRGcXawNMouPECM1+F9BVxEaM=
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f/go.mod h1:S9tOR0FxgyusSNR+MboCuiDpVWkAifZvaYI1Q2ubgro=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
kmodules.xyz/client-go v0.30.8 h1:LG4sc94GPYyY2yGBEyCdiww4DZryjZ+Z/AxkHlnD+dk=
kmodules.xyz/client-go v0.30.8/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4=
kmodules.xyz/client-go v0.30.9 h1:wiLivFlqVZOitAqLFEa1n53GkbYYOmiR8upjIHPHrYk=
kmodules.xyz/client-go v0.30.9/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4=
kmodules.xyz/go-containerregistry v0.0.12 h1:Tl32QGmSqRVm9PUEb/f3dgDeu9zW5fVzt3qmAFIE37I=
kmodules.xyz/go-containerregistry v0.0.12/go.mod h1:KgeNg0hDsgeda+qc0NzWk0iVRdF0+ZIg/oRzGoYh78I=
kmodules.xyz/offshoot-api v0.29.4 h1:WQV2BIUIoVKKiqZNmZ4gAy367jEdwBhEl3dFCLZM1qA=
kmodules.xyz/offshoot-api v0.29.4/go.mod h1:e+NQ0s4gW/YTPWBWEfdISZcmk+tlTq8IjvP5SLdqvko=
kmodules.xyz/resource-metadata v0.18.9 h1:W/39Blg0hCvZYl0rReDIPiOMQuMN//pKVqRjhWAUrKo=
kmodules.xyz/resource-metadata v0.18.9/go.mod h1:qqieeMPdwJIEyAVkGcgh7h9PZbZTLw4KNEkkqEh5EyA=
kmodules.xyz/resource-metadata v0.18.10 h1:B0DAMsJJBuSOGCKzptZvB8AWcbxzDdUm+3CIE7g9ftE=
kmodules.xyz/resource-metadata v0.18.10/go.mod h1:PXyZXif1b1QRpe0Pwr92OeOveptZricB0jLssCjsYTc=
kmodules.xyz/resource-metrics v0.30.1 h1:o7mVY8ZwSe5iEILy1eMG4EPZCli7mXZCkgQONjoY9uU=
kmodules.xyz/resource-metrics v0.30.1/go.mod h1:UYcQQLN+3o8rNPQJwJa2D9bt5ihJCeo5bCDuQ4O3MPY=
sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw=
Expand Down
97 changes: 3 additions & 94 deletions vendor/github.com/nats-io/nats.go/README.md

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

2 changes: 2 additions & 0 deletions vendor/github.com/nats-io/nats.go/context.go

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

Loading

0 comments on commit a49081a

Please sign in to comment.