Skip to content

Commit

Permalink
Merge pull request #82 from flux-framework/update-go-version
Browse files Browse the repository at this point in the history
version: update builds and CI to go 1.22
  • Loading branch information
vsoch authored Sep 3, 2024
2 parents ad764b9 + 8ca051f commit 33a854a
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -54,12 +54,20 @@ prepare: clone
cp sig-scheduler-plugins/apis/scheduling/v1alpha1/*.go $(CLONE_UPSTREAM)/apis/scheduling/v1alpha1/
cp sig-scheduler-plugins/cmd/controller/app/server.go $(CLONE_UPSTREAM)/cmd/controller/app/server.go

# This logic was moved from upstream/hack/build-images.sh - too much changing logic
# and became hard to maintain
build: prepare
echo ${GO_BASE_IMAGE}
BUILDER=${BUILDER} PLATFORMS=${PLATFORMS} REGISTRY=${REGISTRY} IMAGE=${SCHEDULER_IMAGE} \
CONTROLLER_IMAGE=${CONTROLLER_IMAGE} RELEASE_VERSION=${RELEASE_VERSION} \
GO_BASE_IMAGE=${GO_BASE_IMAGE} DISTROLESS_BASE_IMAGE=${DISTROLESS_BASE_IMAGE} \
$(BASH) $(CLONE_UPSTREAM)/hack/build-images.sh

docker build -f $(CLONE_UPSTREAM)/build/scheduler/Dockerfile --build-arg RELEASE_VERSION=${RELEASE_VERSION} \
--build-arg GO_BASE_IMAGE=${GO_BASE_IMAGE} \
--build-arg DISTROLESS_BASE_IMAGE=${DISTROLESS_BASE_IMAGE} \
--build-arg CGO_ENABLED=0 -t ${REGISTRY}/${SCHEDULER_IMAGE} $(CLONE_UPSTREAM)

docker build -f $(CLONE_UPSTREAM)/build/controller/Dockerfile --build-arg RELEASE_VERSION=${RELEASE_VERSION} \
--build-arg GO_BASE_IMAGE=${GO_BASE_IMAGE} \
--build-arg DISTROLESS_BASE_IMAGE=${DISTROLESS_BASE_IMAGE} \
--build-arg CGO_ENABLED=0 -t ${REGISTRY}/${CONTROLLER_IMAGE} $(CLONE_UPSTREAM)

push-sidecar:
$(DOCKER) push $(REGISTRY)/$(SIDECAR_IMAGE):$(TAG) --all-tags
Expand Down
20 changes: 10 additions & 10 deletions sig-scheduler-plugins/apis/scheduling/v1alpha1/podgroup_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...")

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- containerPort: {{ .Values.scheduler.port }}
hostPort: {{ .Values.scheduler.port }}{{ end }}
- command:
- /kube-scheduler
- /bin/kube-scheduler
- --config=/etc/kubernetes/scheduler-config.yaml
- -v={{ .Values.scheduler.loggingLevel }}
image: {{ .Values.scheduler.image }}
Expand Down
3 changes: 1 addition & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ INSTALL_PREFIX ?= /usr
LIB_PREFIX ?= /usr/lib
LOCALBIN ?= $(shell pwd)/bin
COMMONENVVAR=GOOS=$(shell uname -s | tr A-Z a-z)
#BUILDENVVAR=CGO_CFLAGS="-I${FLUX_SCHED_ROOT}/resource/reapi/bindings/c" CGO_LDFLAGS="-L${INSTALL_PREFIX}/lib -L${FLUX_SCHED_ROOT}/resource -lresource -L${FLUX_SCHED_ROOT}/resource/libjobspec -ljobspec_conv -L/${FLUX_SCHED_ROOT}/resource/reapi/bindings -lreapi_cli -lflux-idset -lstdc++ -ljansson -lhwloc -lboost_system -lflux-hostlist -lboost_graph -lyaml-cpp"
BUILDENVVAR=CGO_CFLAGS="-I${FLUX_SCHED_ROOT} -I${FLUX_SCHED_ROOT}/resource/reapi/bindings/c" CGO_LDFLAGS="-L${LIB_PREFIX} -L${LIB_PREFIX}/flux -L${FLUX_SCHED_ROOT}/resource/reapi/bindings -lreapi_cli -lflux-idset -lstdc++ -ljansson -lhwloc -lboost_system -lflux-hostlist -lboost_graph -lyaml-cpp"
BUILDENVVAR=CGO_CFLAGS="-I${FLUX_SCHED_ROOT} -I${FLUX_SCHED_ROOT}/resource/reapi/bindings/c" CGO_LDFLAGS="-L${LIB_PREFIX} -L${LIB_PREFIX}/flux -L${FLUX_SCHED_ROOT}/resource/reapi/bindings -lreapi_cli -lflux-idset -lstdc++ -ljansson -lhwloc -lflux-hostlist -lboost_graph -lyaml-cpp"


LOCAL_REGISTRY=localhost:5000
Expand Down
2 changes: 1 addition & 1 deletion src/build/scheduler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/fluence/go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 33a854a

Please sign in to comment.