mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #53681 from krzyzacy/kubemark-bazel
Automatic merge from submit-queue (batch tested with PRs 47039, 53681, 53303, 53181, 53781). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Use bazel to build/push kubemark image try to get some proof of concept, kubemark image is probably simple enough to get converted to bazel. (me bazel noob still trying it out locally) cc @BenTheElder @ixdy @shyamjvs /release-note-none
This commit is contained in:
commit
f4d95b3f6d
@ -19,6 +19,7 @@ filegroup(
|
|||||||
"//cluster/images/etcd/attachlease:all-srcs",
|
"//cluster/images/etcd/attachlease:all-srcs",
|
||||||
"//cluster/images/etcd/rollback:all-srcs",
|
"//cluster/images/etcd/rollback:all-srcs",
|
||||||
"//cluster/images/hyperkube:all-srcs",
|
"//cluster/images/hyperkube:all-srcs",
|
||||||
|
"//cluster/images/kubemark:all-srcs",
|
||||||
"//cluster/lib:all-srcs",
|
"//cluster/lib:all-srcs",
|
||||||
"//cluster/saltbase:all-srcs",
|
"//cluster/saltbase:all-srcs",
|
||||||
],
|
],
|
||||||
|
33
cluster/images/kubemark/BUILD
Normal file
33
cluster/images/kubemark/BUILD
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
load("@io_bazel_rules_docker//docker:docker.bzl", "docker_build", "docker_push")
|
||||||
|
|
||||||
|
docker_build(
|
||||||
|
name = "image",
|
||||||
|
base = "@official_busybox//image",
|
||||||
|
entrypoint = ["/kubemark"],
|
||||||
|
files = ["//cmd/kubemark"],
|
||||||
|
)
|
||||||
|
|
||||||
|
docker_push(
|
||||||
|
name = "push",
|
||||||
|
image = ":image",
|
||||||
|
registry = "gcr.io",
|
||||||
|
repository = "$(PROJECT)/kubemark",
|
||||||
|
stamp = True,
|
||||||
|
tag = "latest",
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "package-srcs",
|
||||||
|
srcs = glob(["**"]),
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "all-srcs",
|
||||||
|
srcs = [":package-srcs"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
@ -214,6 +214,25 @@ function create-and-upload-hollow-node-image {
|
|||||||
echo "Created and uploaded the kubemark hollow-node image to docker registry."
|
echo "Created and uploaded the kubemark hollow-node image to docker registry."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Use bazel rule to create a docker image for hollow-node and upload
|
||||||
|
# it to the appropriate docker container registry for the cloud provider.
|
||||||
|
function create-and-upload-hollow-node-image-bazel {
|
||||||
|
RETRIES=3
|
||||||
|
for attempt in $(seq 1 ${RETRIES}); do
|
||||||
|
if ! bazel run //cluster/images/kubemark:push --define PROJECT="${PROJECT}"; then
|
||||||
|
if [[ $((attempt)) -eq "${RETRIES}" ]]; then
|
||||||
|
echo "${color_red}Image push failed. Exiting.${color_norm}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "${color_yellow}Make attempt $(($attempt)) failed. Retrying.${color_norm}" >& 2
|
||||||
|
sleep $(($attempt * 5))
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Created and uploaded the kubemark hollow-node image to docker registry."
|
||||||
|
}
|
||||||
|
|
||||||
# Generate secret and configMap for the hollow-node pods to work, prepare
|
# Generate secret and configMap for the hollow-node pods to work, prepare
|
||||||
# manifests of the hollow-node and heapster replication controllers from
|
# manifests of the hollow-node and heapster replication controllers from
|
||||||
# templates, and finally create these resources through kubectl.
|
# templates, and finally create these resources through kubectl.
|
||||||
@ -439,7 +458,11 @@ start-master-components
|
|||||||
# Setup for hollow-nodes.
|
# Setup for hollow-nodes.
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${color_yellow}STARTING SETUP FOR HOLLOW-NODES${color_norm}"
|
echo -e "${color_yellow}STARTING SETUP FOR HOLLOW-NODES${color_norm}"
|
||||||
create-and-upload-hollow-node-image
|
if [[ "${KUBEMARK_BAZEL_BUILD:-}" =~ ^[yY]$ ]]; then
|
||||||
|
create-and-upload-hollow-node-image-bazel
|
||||||
|
else
|
||||||
|
create-and-upload-hollow-node-image
|
||||||
|
fi
|
||||||
create-kube-hollow-node-resources
|
create-kube-hollow-node-resources
|
||||||
wait-for-hollow-nodes-to-run-or-timeout
|
wait-for-hollow-nodes-to-run-or-timeout
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user