diff --git a/.gitignore b/.gitignore index 1d07f51..8dc5801 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,11 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. +# build and test outputs +bin/ +_output/ +_artifacts/ +junit-report.xml + # IDEs and editors **/.idea .project diff --git a/go/Makefile b/go/Makefile new file mode 100644 index 0000000..8b4190f --- /dev/null +++ b/go/Makefile @@ -0,0 +1,73 @@ +# Copyright 2022 Polaris SLO Cloud Project. +# Based on the Makefile from https://github.com/kubernetes-sigs/scheduler-plugins +# created by the Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +COMMONENVVAR=GOOS=$(shell uname -s | tr A-Z a-z) GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) +BUILDENVVAR=CGO_ENABLED=0 + +PROJECT_VERSION=2.0.0-beta.0 + +LOCAL_REGISTRY=localhost:5000/polarissloc +LOCAL_IMAGE=polaris-scheduler:latest + +# RELEASE_REGISTRY is the container registry to push +# into. The default is to push to the staging +# registry, not production(k8s.gcr.io). +RELEASE_REGISTRY?=polarissloc +RELEASE_VERSION?=$(shell date +%Y%m%d%H%M)-v$(PROJECT_VERSION) +# RELEASE_VERSION?=v$(shell date +%Y%m%d)-$(shell git describe --tags --match "v*") +RELEASE_IMAGE:=polaris-scheduler:$(RELEASE_VERSION) + +# VERSION is the scheduler's version +# +# The RELEASE_VERSION variable can have one of two formats: +# v20201009-v0.18.800-46-g939c1c0 - automated build for a commit(not a tag) and also a local build +# v20200521-v0.18.800 - automated build for a tag +VERSION=$(shell echo $(RELEASE_VERSION) | awk -F - '{print $$2}') + +DEBUG_CONFIG=bin/config/kubernetes/scheduler.conf +DEBUG_CONFIG_PATH=$(shell echo "$(shell pwd)/$(DEBUG_CONFIG)" | sed -e "s|\/|\\\/|g" -) + +.PHONY: all +all: build + +.PHONY: build +build: build-scheduler + +.PHONY: build-scheduler +build-scheduler: + $(COMMONENVVAR) $(BUILDENVVAR) go build -ldflags '-X k8s.io/component-base/version.gitVersion=$(VERSION) -w' -o bin/polaris-scheduler scheduler/main.go + +.PHONY: build-scheduler-debug +build-scheduler-debug: debug-config + $(COMMONENVVAR) $(BUILDENVVAR) go build -gcflags="all=-N -l" -ldflags '-X k8s.io/component-base/version.gitVersion=$(VERSION)' -o bin/polaris-scheduler scheduler/main.go + +.PHONY: local-image +local-image: + docker build -f ./build/scheduler/Dockerfile --build-arg RELEASE_VERSION="$(RELEASE_VERSION)" -t $(LOCAL_REGISTRY)/$(LOCAL_IMAGE) .. + +.PHONY: release-image +release-image: + docker build -f ./build/scheduler/Dockerfile --build-arg RELEASE_VERSION="$(RELEASE_VERSION)" -t $(RELEASE_REGISTRY)/$(RELEASE_IMAGE) .. + +# .PHONY: debug-config +# debug-config: +# mkdir -p ./bin +# sed -e "s/kubeconfig:.*/kubeconfig: '$(DEBUG_CONFIG_PATH)'/" manifests/polaris-scheduler/default-polaris-scheduler-config.yaml > bin/default-polaris-scheduler-config.yaml + +.PHONY: clean +clean: + rm -rf ./bin + rm -rf ./vendor diff --git a/go/README.md b/go/README.md index 869c08b..41e9ba2 100644 --- a/go/README.md +++ b/go/README.md @@ -1,6 +1,6 @@ -# RAINBOW Kubernetes Controllers +# Polaris Scheduler Workspace Organization -This directory contains RAINBOW's Kubernetes controllers and CRDs written in Go, which can be found in the subfolders of this directory: +This directory contains the modules that comprise the Polaris Scheduler workspace: -* [orchestrator](./orchestration): All shared CRDs and data structures and the controller for the RAINBOW CRDs. -* [scheduler](./scheduler): Fog-aware Kubernetes scheduler, based on kube-scheduler. +* [framework](./framework): The orchestrator-independent Polaris Scheduler framework library that defines the scheduling pipeline and plugin structures. +* [scheduler](./scheduler): Kubernetes implementation of the Polaris Scheduler.