Skip to content

Commit

Permalink
Merge pull request #47 from flux-framework/modular-fluence-build
Browse files Browse the repository at this point in the history
Update fluence to use flux-sched 0.31.0 and build from kubernetes-sigs/scheduler-plugins
  • Loading branch information
vsoch authored Jan 5, 2024
2 parents 93b1796 + 105562e commit 9bfabef
Show file tree
Hide file tree
Showing 25 changed files with 607 additions and 289 deletions.
31 changes: 14 additions & 17 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,22 @@ jobs:
runs-on: ubuntu-latest
name: build fluence
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.19

- name: Build Container
- name: Build Containers
run: |
git clone -b fluence https://github.com/openshift-psap/scheduler-plugins ./plugins
cd ./plugins
make local-image LOCAL_REGISTRY=ghcr.io/flux-framework LOCAL_IMAGE=fluence
make prepare
make build REGISTRY=ghcr.io/flux-framework SCHEDULER_IMAGE=fluence
- name: Tag and Push Release Image
- name: Tag Release Image
if: (github.event_name == 'release')
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Tagging and releasing ${{ env.container }}:${tag}"
echo "Tagging and releasing ${{ env.container}}:${tag}"
docker tag ${{ env.container }}:latest ${{ env.container }}:${tag}
docker push ${{ env.container }}:${tag}
- name: GHCR Login
if: (github.event_name != 'pull_request')
Expand All @@ -46,7 +44,7 @@ jobs:

- name: Deploy Container
if: (github.event_name != 'pull_request')
run: docker push ${{ env.container }}:latest
run: docker push ${{ env.container }} --all-tags

build-sidecar:
permissions:
Expand All @@ -56,23 +54,22 @@ jobs:
runs-on: ubuntu-latest
name: build sidecar
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.19

- name: Build Container
run: |
cd scheduler-plugin
make LOCAL_REGISTRY=ghcr.io/flux-framework
make prepare
make build-sidecar REGISTRY=ghcr.io/flux-framework SIDECAR_IMAGE=fluence-sidecar
- name: Tag and Push Release Image
- name: Tag Release Image
if: (github.event_name == 'release')
run: |
tag=${GITHUB_REF#refs/tags/}
echo "Tagging and releasing ${{ env.container }}:${tag}"
docker tag ${{ env.container }}:latest ${{ env.container }}:${tag}
docker push ${{ env.container }}:${tag}
- name: GHCR Login
if: (github.event_name != 'pull_request')
Expand All @@ -84,4 +81,4 @@ jobs:

- name: Deploy Container
if: (github.event_name != 'pull_request')
run: docker push ${{ env.container }}:latest
run: docker push ${{ env.container }} --all-tags
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
plugins
scheduler-plugins
upstream
scheduler-plugins
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
CLONE_UPSTREAM ?= ./upstream
UPSTREAM ?= https://github.com/kubernetes-sigs/scheduler-plugins
BASH ?= /bin/bash
DOCKER ?= docker
TAG ?= latest

# These are passed to build the sidecar
REGISTRY ?= ghcr.io/flux-framework
SIDECAR_IMAGE ?= fluence-sidecar:latest
CONTROLLER_IMAGE ?= fluence-controller
SCHEDULER_IMAGE ?= fluence

.PHONY: all build build-sidecar prepare push push-sidecar push-controller

all: build-sidecar prepare build

build-sidecar:
make -C ./src LOCAL_REGISTRY=${REGISTRY} LOCAL_IMAGE=${SIDECAR_IMAGE}

prepare:
if [ -d "$(CLONE_UPSTREAM)" ]; then echo "Upstream is cloned"; else git clone $(UPSTREAM) ./$(CLONE_UPSTREAM); fi
# These are entirely new directory structures
cp -R sig-scheduler-plugins/pkg/fluence $(CLONE_UPSTREAM)/pkg/fluence
cp -R sig-scheduler-plugins/manifests/fluence $(CLONE_UPSTREAM)/manifests/fluence
# These are files with subtle changes to add fluence
cp sig-scheduler-plugins/cmd/scheduler/main.go ./upstream/cmd/scheduler/main.go
cp sig-scheduler-plugins/manifests/install/charts/as-a-second-scheduler/templates/deployment.yaml $(CLONE_UPSTREAM)/manifests/install/charts/as-a-second-scheduler/templates/deployment.yaml
cp sig-scheduler-plugins/manifests/install/charts/as-a-second-scheduler/values.yaml $(CLONE_UPSTREAM)/manifests/install/charts/as-a-second-scheduler/values.yaml

build:
REGISTRY=${REGISTRY} IMAGE=${SCHEDULER_IMAGE} CONTROLLER_IMAGE=${CONTROLLER_IMAGE} $(BASH) $(CLONE_UPSTREAM)/hack/build-images.sh

push-sidecar:
$(DOCKER) push $(REGISTRY)/$(SIDECAR_IMAGE):$(TAG) --all-tags

push-controller:
$(DOCKER) push $(REGISTRY)/$(CONTROLLER_IMAGE):$(TAG) --all-tags

push: push-sidecar push-controller
Loading

0 comments on commit 9bfabef

Please sign in to comment.