From 7d2b66b6f28e9ea415d5778135edfca277cc5d17 Mon Sep 17 00:00:00 2001 From: vsoch Date: Sun, 1 Sep 2024 12:06:04 -0600 Subject: [PATCH] version: update builds and ci to go 1.22 Problem: the upstream scheduler-plugins is now using 1.22.0. Solution: we should do the same. Signed-off-by: vsoch --- .github/workflows/build-deploy.yaml | 6 +++--- .github/workflows/e2e-test.yaml | 6 +++--- .github/workflows/test.yaml | 2 +- Makefile | 2 +- .../scheduling/v1alpha1/podgroup_webhook.go | 20 +++++++++---------- src/build/scheduler/Dockerfile | 2 +- src/fluence/go.mod | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-deploy.yaml b/.github/workflows/build-deploy.yaml index b5b9db7..e2f7abd 100644 --- a/.github/workflows/build-deploy.yaml +++ b/.github/workflows/build-deploy.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: ^1.21 + go-version: ^1.22 - name: Build Containers run: | @@ -57,7 +57,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: ^1.21 + go-version: ^1.22 - name: Build Containers run: | @@ -94,7 +94,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: ^1.21 + go-version: ^1.22 - name: Build Container run: | diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index 0832080..741be75 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: ^1.21 + go-version: ^1.22 - name: Build Containers run: | @@ -56,7 +56,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: ^1.21 + go-version: ^1.22 - name: Build Container run: | @@ -87,7 +87,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: ^1.21 + go-version: ^1.22 - name: Download fluence artifact uses: actions/download-artifact@v4 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 593d1a0..c6c9b22 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: ^1.21 + go-version: ^1.22 - name: Run Tests run: | diff --git a/Makefile b/Makefile index 33a5ab1..e09871c 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ PLATFORMS ?= linux/amd64 BUILDER ?= docker # We match this to the fluence build (see src/build/scheduler/Dockerfile) -GO_VERSION ?= 1.21.9 +GO_VERSION ?= 1.22.0 GO_BASE_IMAGE ?= golang:${GO_VERSION} DISTROLESS_BASE_IMAGE ?= gcr.io/distroless/static:nonroot diff --git a/sig-scheduler-plugins/apis/scheduling/v1alpha1/podgroup_webhook.go b/sig-scheduler-plugins/apis/scheduling/v1alpha1/podgroup_webhook.go index 7266d85..64bac65 100644 --- a/sig-scheduler-plugins/apis/scheduling/v1alpha1/podgroup_webhook.go +++ b/sig-scheduler-plugins/apis/scheduling/v1alpha1/podgroup_webhook.go @@ -38,19 +38,19 @@ var ( // NewMutatingWebhook allows us to keep the sidecarInjector private // If it's public it's exported and kubebuilder tries to add to zz_generated_deepcopy // and you get all kinds of terrible errors about admission.Decoder missing DeepCopyInto -func NewMutatingWebhook(mgr manager.Manager) *fluenceWatcher { - return &fluenceWatcher{decoder: admission.NewDecoder(mgr.GetScheme())} +func NewMutatingWebhook(mgr manager.Manager) fluenceWatcher { + return fluenceWatcher{decoder: admission.NewDecoder(mgr.GetScheme())} } // mutate-v1-fluence type fluenceWatcher struct { - decoder *admission.Decoder + decoder admission.Decoder } // Handle is the main handler for the webhook, which is looking for jobs and pods (in that order) // If a job comes in (with a pod template) first, we add the labels there first (and they will // not be added again). -func (hook *fluenceWatcher) Handle(ctx context.Context, req admission.Request) admission.Response { +func (hook fluenceWatcher) Handle(ctx context.Context, req admission.Request) admission.Response { logger.Info("Running webhook handle, determining pod wrapper abstraction...") @@ -145,7 +145,7 @@ func (hook *fluenceWatcher) Handle(ctx context.Context, req admission.Request) a } // Default is the expected entrypoint for a webhook... -func (hook *fluenceWatcher) Default(ctx context.Context, obj runtime.Object) error { +func (hook fluenceWatcher) Default(ctx context.Context, obj runtime.Object) error { switch obj.(type) { case *batchv1.Job: @@ -179,7 +179,7 @@ func (hook *fluenceWatcher) Default(ctx context.Context, obj runtime.Object) err // Note that we need to do similar for Job. // A pod without a job wrapper, and without metadata is a group // of size 1. -func (hook *fluenceWatcher) EnsureGroup(pod *corev1.Pod) error { +func (hook fluenceWatcher) EnsureGroup(pod *corev1.Pod) error { // Add labels if we don't have anything. Everything is a group! if pod.Labels == nil { @@ -221,7 +221,7 @@ func getJobLabel(job *batchv1.Job, labelName, defaultLabel string) string { // EnsureGroupOnJob looks for fluence labels (size and name) on both the job // and the pod template. We ultimately put on the pod, the lowest level unit. // Since we have the size of the job (parallelism) we can use that for the size -func (a *fluenceWatcher) EnsureGroupOnJob(job *batchv1.Job) error { +func (a fluenceWatcher) EnsureGroupOnJob(job *batchv1.Job) error { // Be forgiving - allow the person to specify it on the job directly or on the Podtemplate // We will ultimately put the metadata on the Pod. @@ -251,7 +251,7 @@ func (a *fluenceWatcher) EnsureGroupOnJob(job *batchv1.Job) error { } // EnsureGroupStatefulSet creates a PodGroup for a StatefulSet -func (hook *fluenceWatcher) EnsureGroupStatefulSet(set *appsv1.StatefulSet) error { +func (hook fluenceWatcher) EnsureGroupStatefulSet(set *appsv1.StatefulSet) error { // StatefulSet requires on top level explicitly if set.Labels == nil { @@ -279,7 +279,7 @@ func (hook *fluenceWatcher) EnsureGroupStatefulSet(set *appsv1.StatefulSet) erro } // EnsureGroupStatefulSet creates a PodGroup for a StatefulSet -func (a *fluenceWatcher) EnsureGroupReplicaSet(set *appsv1.ReplicaSet) error { +func (a fluenceWatcher) EnsureGroupReplicaSet(set *appsv1.ReplicaSet) error { // StatefulSet requires on top level explicitly if set.Labels == nil { @@ -308,7 +308,7 @@ func (a *fluenceWatcher) EnsureGroupReplicaSet(set *appsv1.ReplicaSet) error { // EnsureGroupDeployment creates a PodGroup for a Deployment // This is redundant, can refactor later -func (a *fluenceWatcher) EnsureGroupDeployment(d *appsv1.Deployment) error { +func (a fluenceWatcher) EnsureGroupDeployment(d *appsv1.Deployment) error { // StatefulSet requires on top level explicitly if d.Labels == nil { diff --git a/src/build/scheduler/Dockerfile b/src/build/scheduler/Dockerfile index b39a141..fe04771 100644 --- a/src/build/scheduler/Dockerfile +++ b/src/build/scheduler/Dockerfile @@ -2,7 +2,7 @@ FROM fluxrm/flux-sched:jammy USER root ENV DEBIAN_FRONTEND=noninteractive -ENV GO_VERSION=1.21.9 +ENV GO_VERSION=1.22.0 RUN apt-get update && apt-get clean -y && apt -y autoremove diff --git a/src/fluence/go.mod b/src/fluence/go.mod index 31228d9..a8a54ed 100644 --- a/src/fluence/go.mod +++ b/src/fluence/go.mod @@ -1,6 +1,6 @@ module github.com/flux-framework/flux-k8s/flux-plugin/fluence -go 1.21 +go 1.22 require ( github.com/flux-framework/fluxion-go v0.32.1-0.20240420052153-909523c84ca2