-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: RealAnna <[email protected]> scheduler fix Signed-off-by: RealAnna <[email protected]> changed make file Signed-off-by: RealAnna <[email protected]> changed make file Signed-off-by: RealAnna <[email protected]> changed make file Signed-off-by: RealAnna <[email protected]> changed make file Signed-off-by: RealAnna <[email protected]> mit Signed-off-by: RealAnna <[email protected]> mit Signed-off-by: RealAnna <[email protected]> mit Signed-off-by: RealAnna <[email protected]> mit Signed-off-by: RealAnna <[email protected]> sched fin Signed-off-by: RealAnna <[email protected]> sched fin Signed-off-by: RealAnna <[email protected]> sched fin Signed-off-by: RealAnna <[email protected]>
- Loading branch information
Showing
42 changed files
with
3,223 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# Copyright 2020 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. | ||
|
||
ARCHS = amd64 arm64 | ||
COMMONENVVAR=GOOS=$(shell uname -s | tr A-Z a-z) | ||
BUILDENVVAR=CGO_ENABLED=0 | ||
|
||
LOCAL_REGISTRY=localhost:5000/scheduler-plugins | ||
LOCAL_IMAGE=kube-scheduler:latest | ||
LOCAL_CONTROLLER_IMAGE=controller: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?=docker.io/annadreal | ||
RELEASE_VERSION?=$(shell date +%Y%m%d%s)-v0.24.3#$(shell git describe --tags --match "v*") | ||
RELEASE_IMAGE:=kube-scheduler:$(RELEASE_VERSION) | ||
RELEASE_CONTROLLER_IMAGE:=controller:$(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}') | ||
|
||
.PHONY: all | ||
all: build | ||
|
||
.PHONY: build | ||
build: build-scheduler | ||
|
||
.PHONY: build.amd64 | ||
build.amd64: build-controller.amd64 build-scheduler.amd64 | ||
|
||
.PHONY: build.arm64v8 | ||
build.arm64v8: build-controller.arm64v8 build-scheduler.arm64v8 | ||
|
||
.PHONY: build-controller | ||
build-controller: | ||
$(COMMONENVVAR) $(BUILDENVVAR) go build -ldflags '-w' -o bin/controller cmd/controller/controller.go | ||
|
||
.PHONY: build-controller.amd64 | ||
build-controller.amd64: | ||
$(COMMONENVVAR) $(BUILDENVVAR) GOARCH=amd64 go build -ldflags '-w' -o bin/controller cmd/controller/controller.go | ||
|
||
.PHONY: build-controller.arm64v8 | ||
build-controller.arm64v8: | ||
GOOS=linux $(BUILDENVVAR) GOARCH=arm64 go build -ldflags '-w' -o bin/controller cmd/controller/controller.go | ||
|
||
.PHONY: build-scheduler | ||
build-scheduler: | ||
$(COMMONENVVAR) $(BUILDENVVAR) go build -ldflags '-X k8s.io/component-base/version.gitVersion=$(VERSION) -w' -o bin/kube-scheduler cmd/scheduler/main.go | ||
|
||
.PHONY: build-scheduler.amd64 | ||
build-scheduler.amd64: | ||
$(COMMONENVVAR) $(BUILDENVVAR) GOARCH=amd64 go build -ldflags '-X k8s.io/component-base/version.gitVersion=$(VERSION) -w' -o bin/kube-scheduler cmd/scheduler/main.go | ||
#go build -ldflags '-X k8s.io/component-base/version.gitVersion=$(VERSION) -w' -o bin/kube-scheduler cmd/scheduler/main.go | ||
|
||
.PHONY: build-scheduler.arm64v8 | ||
build-scheduler.arm64v8: | ||
GOOS=linux $(BUILDENVVAR) GOARCH=arm64 go build -ldflags '-X k8s.io/component-base/version.gitVersion=$(VERSION) -w' -o bin/kube-scheduler cmd/scheduler/main.go | ||
|
||
.PHONY: local-image | ||
local-image: clean | ||
docker build -f ./build/scheduler/Dockerfile --build-arg ARCH="amd64" --build-arg RELEASE_VERSION="$(RELEASE_VERSION)" -t $(LOCAL_REGISTRY)/$(LOCAL_IMAGE) . | ||
#docker build -f ./build/controller/Dockerfile --build-arg ARCH="amd64" -t $(LOCAL_REGISTRY)/$(LOCAL_CONTROLLER_IMAGE) . | ||
|
||
.PHONY: release-image.amd64 | ||
release-image.amd64: clean | ||
docker build --no-cache -f ./build/scheduler/Dockerfile --build-arg ARCH="amd64" --build-arg RELEASE_VERSION="$(RELEASE_VERSION)" -t $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-amd64 . | ||
#docker build -f ./build/controller/Dockerfile --build-arg ARCH="amd64" -t $(RELEASE_REGISTRY)/$(RELEASE_CONTROLLER_IMAGE)-amd64 . | ||
|
||
.PHONY: release-image.arm64v8 | ||
release-image.arm64v8: clean | ||
docker build --no-cache -f ./build/scheduler/Dockerfile --build-arg ARCH="arm64v8" --build-arg RELEASE_VERSION="$(RELEASE_VERSION)" -t $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-arm64 . | ||
#docker build -f ./build/controller/Dockerfile --build-arg ARCH="arm64v8" -t $(RELEASE_REGISTRY)/$(RELEASE_CONTROLLER_IMAGE)-arm64 . | ||
|
||
.PHONY: push-release-images | ||
push-release-images: release-image.amd64 release-image.arm64v8 | ||
#gcloud auth configure-docker | ||
for arch in $(ARCHS); do \ | ||
docker push $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-$${arch} ;\ | ||
#docker push $(RELEASE_REGISTRY)/$(RELEASE_CONTROLLER_IMAGE)-$${arch} ;\ | ||
done | ||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(RELEASE_REGISTRY)/$(RELEASE_IMAGE) $(addprefix --amend $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-, $(ARCHS)) | ||
#DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create $(RELEASE_REGISTRY)/$(RELEASE_CONTROLLER_IMAGE) $(addprefix --amend $(RELEASE_REGISTRY)/$(RELEASE_CONTROLLER_IMAGE)-, $(ARCHS)) | ||
for arch in $(ARCHS); do \ | ||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest annotate --arch $${arch} $(RELEASE_REGISTRY)/$(RELEASE_IMAGE) $(RELEASE_REGISTRY)/$(RELEASE_IMAGE)-$${arch} ;\ | ||
#DOCKER_CLI_EXPERIMENTAL=enabled docker manifest annotate --arch $${arch} $(RELEASE_REGISTRY)/$(RELEASE_CONTROLLER_IMAGE) $(RELEASE_REGISTRY)/$(RELEASE_CONTROLLER_IMAGE)-$${arch} ;\ | ||
done | ||
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(RELEASE_REGISTRY)/$(RELEASE_IMAGE) ;\ | ||
#DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push $(RELEASE_REGISTRY)/$(RELEASE_CONTROLLER_IMAGE) ;\ | ||
|
||
.PHONY: update-vendor | ||
update-vendor: | ||
hack/update-vendor.sh | ||
|
||
.PHONY: unit-test | ||
unit-test: | ||
hack/unit-test.sh | ||
|
||
.PHONY: install-envtest | ||
install-envtest: | ||
hack/install-envtest.sh | ||
|
||
.PHONY: integration-test | ||
integration-test: install-envtest | ||
hack/integration-test.sh | ||
|
||
.PHONY: verify | ||
verify: | ||
hack/verify-gofmt.sh | ||
hack/verify-crdgen.sh | ||
hack/verify-structured-logging.sh | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf ./bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
# Ignore build and test binaries. | ||
bin/ | ||
testbin/ | ||
hack/tools/bin/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2020 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. | ||
ARG ARCH | ||
FROM golang:1.18.0 | ||
|
||
WORKDIR /lfc-scheduler | ||
COPY . . | ||
ARG ARCH | ||
ARG RELEASE_VERSION | ||
RUN RELEASE_VERSION=${RELEASE_VERSION} make build-scheduler.$ARCH | ||
|
||
FROM $ARCH/alpine:3.16 | ||
|
||
COPY --from=0 /lfc-scheduler/bin/kube-scheduler /bin/kube-scheduler | ||
|
||
WORKDIR /bin | ||
CMD ["kube-scheduler"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright 2020 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. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/keptn-sandbox/lifecycle-controller/lfc-scheduler/pkg/klcpermit" | ||
"k8s.io/apimachinery/pkg/util/rand" | ||
"k8s.io/component-base/cli" | ||
"k8s.io/kubernetes/cmd/kube-scheduler/app" | ||
"os" | ||
"time" | ||
) | ||
|
||
func main() { | ||
|
||
rand.Seed(time.Now().UnixNano()) | ||
command := app.NewSchedulerCommand( | ||
app.WithPlugin(klcpermit.Name, klcpermit.New), | ||
) | ||
|
||
code := cli.Run(command) | ||
os.Exit(code) | ||
} |
Oops, something went wrong.