Skip to content

Commit

Permalink
Merge pull request #208 from flux-framework/test-refactor-modular
Browse files Browse the repository at this point in the history
[WIP] refactor: flux provisioned from init container
  • Loading branch information
vsoch authored Mar 15, 2024
2 parents 76c4754 + e3cd944 commit 3caf65c
Show file tree
Hide file tree
Showing 395 changed files with 12,220 additions and 12,162 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.20
- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.20
- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.20
- name: GHCR Login
if: (github.event_name != 'pull_request')
uses: docker/login-action@v2
Expand Down Expand Up @@ -44,4 +44,4 @@ jobs:
PKG_RESPONSE=$(helm package ./chart)
echo "$PKG_RESPONSE"
CHART_TAR_GZ=$(basename "$PKG_RESPONSE")
helm push "$CHART_TAR_GZ" oci://ghcr.io/flux-framework/flux-operator-helm
helm push "$CHART_TAR_GZ" oci://ghcr.io/flux-framework/flux-operator-helm
52 changes: 26 additions & 26 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@ jobs:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup black linter
run: conda create --quiet --name black pyflakes

- name: Check Spelling
uses: crate-ci/typos@7ad296c72fa8265059cc03d1eda562fbdfcd6df2 # v1.9.0
with:
files: ./docs/*/*.md ./docs/*/*/*.md ./docs/*.md ./README.md ./config/samples ./docs/*.md
files: ./docs/*/*.md ./docs/*/*/*.md ./docs/*.md ./README.md ./docs/*.md

unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ^1.18
go-version: ^1.20
- name: fmt check
run: make fmt

Expand Down Expand Up @@ -62,22 +61,23 @@ jobs:
strategy:
fail-fast: false
matrix:
test: [["hello-world", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["custom-config", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["minimal-service", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["post", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["batch", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["singularity", "ghcr.io/rse-ops/singularity:tag-mamba", 60],
["nginx-sidecar-service", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["nginx-service", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["lammps", "ghcr.io/rse-ops/lammps:flux-sched-focal-v0.24.0", 60],
["pokemon", "ghcr.io/rse-ops/pokemon:app-latest", 60],
["timed", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["debug", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["flux-resource-list", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["existing-volumes", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["volumes", "ghcr.io/flux-framework/flux-restful-api:latest", 60],
["snakemake", "ghcr.io/rse-ops/atacseq:app-latest", 60]]
test: [["post", "", 100],
["batch", "", 100],
["timed", "", 100],
["debug", "", 100],
["volumes", "", 100],
["hello-world", "", 100],
["nginx-service", "", 100],
["custom-config", "", 100],
["minimal-service", "", 100],
["existing-volumes", "", 100],
["flux-resource-list", "", 100],
["nginx-sidecar-service", "", 100],
["pokemon", "ghcr.io/rse-ops/pokemon:app-latest", 100],
["snakemake", "ghcr.io/rse-ops/atacseq:app-latest", 100],
["singularity", "ghcr.io/rse-ops/singularity:tag-mamba", 100],
["lammps", "ghcr.io/converged-computing/metric-lammps:latest", 100],
["disable-view", "ghcr.io/rse-ops/lammps:flux-sched-focal", 100]]

steps:
- name: Clone the code
Expand All @@ -86,17 +86,14 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ^1.18
go-version: ^1.20

- name: Install zeromq
run: sudo apt-get update && sudo apt-get install -y libsodium-dev libzmq3-dev libczmq-dev

- name: Start minikube
uses: medyagh/setup-minikube@697f2b7aaed5f70bf2a94ee21a4ec3dde7b12f92 # v0.0.9

- name: Create the namespace
run: kubectl create namespace flux-operator

- name: Pull Docker Containers to MiniKube
env:
container: ${{ matrix.test[1] }}
Expand All @@ -105,10 +102,13 @@ jobs:
run: |
export SHELL=/bin/bash
eval $(minikube -p minikube docker-env)
minikube ssh docker pull ${container}
if [[ "${container}" != "" ]]; then
minikube ssh docker pull ${container}
fi
if [[ "${test}" == "nginx-service" ]]; then
minikube ssh docker pull nginx
fi
minikube ssh docker pull ghcr.io/converged-computing/flux-view-rocky:tag-9
make deploy-local
minikube image load ghcr.io/flux-framework/flux-operator:test
kubectl apply -f examples/dist/flux-operator-local.yaml
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
echo "tag=${{ inputs.release_tag }}" >> ${GITHUB_ENV}
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.20
- name: GHCR Login
uses: docker/login-action@v2
with:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.20
- name: Set tag
run: |
echo "Tag for release is ${{ inputs.release_tag }}"
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ^1.18.1
go-version: ^1.20
- name: Set tag
run: |
echo "Tag for release is ${{ inputs.release_tag }}"
Expand All @@ -106,7 +106,7 @@ jobs:
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate fo
cd sdk/python/v1alpha1/
cd sdk/python/v1alpha2/
pip install -e .
python setup.py sdist bdist_wheel
cd dist
Expand Down
83 changes: 0 additions & 83 deletions .github/workflows/test-python.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pip. Only major versions will be released as tags on Github.

## [0.0.x](https://github.com/flux-framework/flux-operator/tree/main) (0.0.x)
- refactor design to allow for any base image, v1alpha2 release (0.2.0)
- control of volumes removed (only support for existing volumes)
- fluxoperator-gen command added and restructure for more modular generation (0.1.1)
- First release supporting experimenting bursting / scaling and customization (0.1.0)
- Support for automated testing of examples/tests (0.0.x)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.18 as builder
FROM golang:1.20 as builder

WORKDIR /workspace

Expand Down
37 changes: 20 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.1.1
API_VERSION ?= v1alpha1
VERSION ?= 0.2.0
API_VERSION ?= v1alpha2

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down Expand Up @@ -107,7 +107,8 @@ manifests: controller-gen
.PHONY: generate
generate: controller-gen openapi-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
${OPENAPI_GEN} --logtostderr=true -i ./api/${API_VERSION}/ -o "" -O zz_generated.openapi -p ./api/${API_VERSION}/ -h ./hack/boilerplate.go.txt -r "-"
rm -rf ./api/${API_VERSION}/zz_generated.openapi.go
${OPENAPI_GEN} --logtostderr=true --output-file zz_generated.openapi.go --output-pkg "github.com/flux-framework/flux-operator/api/${API_VERSION}" --output-dir ./api/${API_VERSION}/ --go-header-file ./hack/boilerplate.go.txt -r "-" ./api/${API_VERSION}/

.PHONY: api
api: generate api
Expand Down Expand Up @@ -145,7 +146,7 @@ test: manifests generate fmt vet envtest ## Run tests.

.PHONY: list
list:
kubectl get -n flux-operator pods
kubectl get pods

.PHONY: reset
reset:
Expand All @@ -162,11 +163,11 @@ clean:
# kubectl delete -n flux-operator secret --all --grace-period=0 --force
kubectl delete -n flux-operator cm --all --grace-period=0 --force
# pods, pvc, and pv need to be deleted in this order
kubectl delete -n flux-operator pods --all --grace-period=0 --force
kubectl delete pods --all --grace-period=0 --force
kubectl delete -n flux-operator pvc --all --grace-period=0 --force
kubectl delete -n flux-operator pv --all --grace-period=0 --force
kubectl delete -n flux-operator jobs --all --grace-period=0 --force
kubectl delete -n flux-operator MiniCluster --all --grace-period=0 --force
kubectl delete jobs --all --grace-period=0 --force
kubectl delete MiniCluster --all --grace-period=0 --force

# This applies the basic minicluster (and not extended examples)
apply:
Expand All @@ -186,9 +187,6 @@ redo: clean apply run
redo_example: clean example run
redo_test: clean applytest run

log:
kubectl logs -n flux-operator job.batch/flux-sample $@

##@ Test
# NOTE these are not fully developed yet

Expand Down Expand Up @@ -222,20 +220,20 @@ images:

.PHONY: build
build: generate fmt vet ## Build manager binary.
mv ./controllers/flux/keygen.go ./controllers/flux/keygen.go.backup
cp ./controllers/flux/keygen.go.template ./controllers/flux/keygen.go
mv ./pkg/flux/keygen.go ./pkg/flux/keygen.go.backup
cp ./pkg/flux/keygen.go.template ./pkg/flux/keygen.go
$(BUILDENVVAR) go build -o bin/manager main.go
mv ./controllers/flux/keygen.go.backup ./controllers/flux/keygen.go
mv ./pkg/flux/keygen.go.backup ./pkg/flux/keygen.go

.PHONY: build-container
build-container: generate fmt vet
cp ./controllers/flux/keygen.go.template ./controllers/flux/keygen.go
cp ./pkg/flux/keygen.go.template ./pkg/flux/keygen.go
$(BUILDENVVAR) go build -a -o ./manager main.go
$(BUILDENVVAR) go build -o ./bin/fluxoperator-gen cmd/gen/gen.go

.PHONY: helpers
helpers: $(LOCALBIN)
cp ./controllers/flux/keygen.go.template ./controllers/flux/keygen.go
cp ./pkg/flux/keygen.go.template ./pkg/flux/keygen.go
$(BUILDENVVAR) go build -o ./bin/fluxoperator-gen cmd/gen/gen.go

.PHONY: run
Expand Down Expand Up @@ -291,6 +289,11 @@ test-deploy: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image controller=${DEVIMG}
$(KUSTOMIZE) build config/default > examples/dist/flux-operator-dev.yaml

.PHONY: test-deploy-recreate
test-deploy-recreate: test-deploy
kubectl delete -f ./examples/dist/flux-operator-dev.yaml || echo "Already deleted"
kubectl apply -f ./examples/dist/flux-operator-dev.yaml

.PHONY: arm-deploy
arm-deploy: manifests kustomize
docker buildx build --platform linux/arm64 --push -t ${ARMIMG} .
Expand Down Expand Up @@ -328,7 +331,7 @@ SWAGGER_API_JSON ?= ./api/${API_VERSION}/swagger.json

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.9.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand All @@ -345,7 +348,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
.PHONY: openapi-gen
openapi-gen: $(OPENAPI_GEN) ## Download controller-gen locally if necessary.
$(OPENAPI_GEN): $(LOCALBIN)
which ${OPENAPI_GEN} > /dev/null || (git clone --depth 1 https://github.com/kubernetes/kube-openapi /tmp/kube-openapi && cd /tmp/kube-openapi && go build -o ${OPENAPI_GEN} ./cmd/openapi-gen)
which ${OPENAPI_GEN} > /dev/null || (git clone https://github.com/kubernetes/kube-openapi /tmp/kube-openapi && cd /tmp/kube-openapi && go build -o ${OPENAPI_GEN} ./cmd/openapi-gen)

.PHONY: swagger-jar
swagger-jar: $(SWAGGER_JAR) ## Download controller-gen locally if necessary.
Expand Down
Loading

0 comments on commit 3caf65c

Please sign in to comment.