Commit c650e6bd authored by Darren Shepherd's avatar Darren Shepherd Committed by Erik Wilson

Delete supporting files

parent 9efef1cd
build/root/.bazelrc
\ No newline at end of file
# Files that should be ignored by tools which do not want to consider generated
# code.
#
# https://github.com/kubernetes/contrib/blob/master/mungegithub/mungers/size.go
#
# This file is a series of lines, each of the form:
# <type> <name>
#
# Type can be:
# path - an exact path to a single file
# file-name - an exact leaf filename, regardless of path
# path-prefix - a prefix match on the file path
# file-prefix - a prefix match of the leaf filename (no path)
# paths-from-repo - read a file from the repo and load file paths
#
file-prefix zz_generated.
file-name BUILD
file-name types.generated.go
file-name generated.pb.go
file-name generated.proto
file-name types_swagger_doc_generated.go
path-prefix Godeps/
path-prefix vendor/
path-prefix pkg/generated/
---
name: Bug Report
about: Report a bug encountered while operating Kubernetes
labels: kind/bug
---
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
If the matter is security related, please disclose it privately via https://kubernetes.io/security/
-->
**What happened**:
**What you expected to happen**:
**How to reproduce it (as minimally and precisely as possible)**:
**Anything else we need to know?**:
**Environment**:
- Kubernetes version (use `kubectl version`):
- Cloud provider or hardware configuration:
- OS (e.g: `cat /etc/os-release`):
- Kernel (e.g. `uname -a`):
- Install tools:
- Others:
---
name: Enhancement Request
about: Suggest an enhancement to the Kubernetes project
labels: kind/feature
---
<!-- Please only use this template for submitting enhancement requests -->
**What would you like to be added**:
**Why is this needed**:
---
name: Failing Test
about: Report test failures in Kubernetes CI jobs
labels: kind/failing-test
---
<!-- Please only use this template for submitting reports about failing tests in Kubernetes CI jobs -->
**Which jobs are failing**:
**Which test(s) are failing**:
**Since when has it been failing**:
**Testgrid link**:
**Reason for failure**:
**Anything else we need to know**:
---
name: Support Request
about: Support request or question relating to Kubernetes
labels: triage/support
---
<!--
STOP -- PLEASE READ!
GitHub is not the right place for support requests.
If you're looking for help, check [Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes) and the [troubleshooting guide](https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/).
You can also post your question on the [Kubernetes Slack](http://slack.k8s.io/) or the [Discuss Kubernetes](https://discuss.kubernetes.io/) forum.
If the matter is security related, please disclose it privately via https://kubernetes.io/security/.
-->
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- castrojo
- cblecker
- grodrigues3
- nikhita
- parispittman
- Phillels
approvers:
- castrojo
- cblecker
- grodrigues3
- parispittman
- Phillels
labels:
- sig/contributor-experience
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request. For reference on required PR/issue labels, read here:
https://git.k8s.io/community/contributors/devel/release.md#issue-kind-label
3. Ensure you have added or ran the appropriate tests for your PR: https://git.k8s.io/community/contributors/devel/testing.md
4. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
5. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/release-notes.md
6. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->
**What type of PR is this?**
> Uncomment only one ` /kind <>` line, hit enter to put that in a new line, and remove leading whitespaces from that line:
>
> /kind api-change
> /kind bug
> /kind cleanup
> /kind design
> /kind documentation
> /kind failing-test
> /kind feature
> /kind flake
**What this PR does / why we need it**:
**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #
**Special notes for your reviewer**:
**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->
```release-note
```
build/root/.kazelcfg.json
\ No newline at end of file
build/root/BUILD.root
\ No newline at end of file
## Development release:
## Current release:
- [CHANGELOG-1.13.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.13.md)
## Older releases:
- [CHANGELOG-1.12.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.12.md)
- [CHANGELOG-1.11.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.11.md)
- [CHANGELOG-1.10.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.10.md)
- [CHANGELOG-1.9.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.9.md)
- [CHANGELOG-1.8.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.8.md)
- [CHANGELOG-1.7.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.7.md)
- [CHANGELOG-1.6.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.6.md)
- [CHANGELOG-1.5.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.5.md)
- [CHANGELOG-1.4.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.4.md)
- [CHANGELOG-1.3.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.3.md)
- [CHANGELOG-1.2.md](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.2.md)
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/CHANGELOG.md?pixel)]()
# Contributing
Welcome to Kubernetes! If you are interested in contributing to the [Kubernetes code repo](README.md) then checkout the [Contributor's Guide](https://git.k8s.io/community/contributors/guide/)
The [Kubernetes community repo](https://github.com/kubernetes/community) contains information on how the community is organized and other information that is pertinent to contributing.
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/CONTRIBUTING.md?pixel)]()
build/root/Makefile
\ No newline at end of file
build/root/Makefile.generated_files
\ No newline at end of file
# See the OWNERS docs at https://go.k8s.io/owners
filters:
".*":
reviewers:
- brendandburns
- dchen1107
- jbeda
- lavalamp
- smarterclayton
- thockin
- liggitt
approvers:
- bgrant0607
- brendandburns
- dchen1107
- jbeda
- monopole # To move code per kubernetes/community#598
- lavalamp
- smarterclayton
- thockin
- wojtek-t
- liggitt
# Bazel build infrastructure changes often touch files throughout the tree
"\\.bzl$":
reviewers:
- ixdy
approvers:
- ixdy
"BUILD(\\.bazel)?$":
approvers:
- ixdy
aliases:
# sig-auth subproject aliases
sig-auth-audit-approvers:
- sttts
- tallclair
sig-auth-audit-reviewers:
- CaoShuFeng
- hzxuzhonghu
- lavalamp
- sttts
- tallclair
sig-auth-authenticators-approvers:
- deads2k
- liggitt
- mikedanese
sig-auth-authenticators-reviewers:
- deads2k
- enj
- jianhuiz
- lavalamp
- liggitt
- mbohlool
- mikedanese
- sttts
- wojtek-t
sig-auth-authorizers-approvers:
- deads2k
- liggitt
- mikedanese
sig-auth-authorizers-reviewers:
- david-mcmahon
- deads2k
- dims
- enj
- erictune
- jianhuiz
- krousey
- lavalamp
- liggitt
- mbohlool
- mikedanese
- mml
- ncdc
- nikhiljindal
- smarterclayton
- sttts
- thockin
- wojtek-t
sig-auth-certificates-approvers:
- liggitt
- mikedanese
- smarterclayton
sig-auth-certificates-reviewers:
- awly
- caesarxuchao
- david-mcmahon
- deads2k
- dims
- enj
- errordeveloper
- hongchaodeng
- jianhuiz
- lavalamp
- liggitt
- mbohlool
- mikedanese
- smarterclayton
- sttts
- thockin
- timothysc
- wojtek-t
sig-auth-encryption-at-rest-approvers:
- immutableT
- smarterclayton
sig-auth-encryption-at-rest-reviewers:
- enj
- immutableT
- lavalamp
- liggitt
- sakshamsharma
- smarterclayton
- wojtek-t
sig-auth-node-isolation-approvers:
- deads2k
- liggitt
- mikedanese
- tallclair
sig-auth-node-isolation-reviewers:
- deads2k
- liggitt
- mikedanese
- tallclair
sig-auth-policy-approvers:
- deads2k
- liggitt
- tallclair
sig-auth-policy-reviewers:
- deads2k
- hongchaodeng
- jianhuiz
- liggitt
- mbohlool
- pweil-
- tallclair
- krmayankk
sig-auth-serviceaccounts-approvers:
- deads2k
- liggitt
- mikedanese
sig-auth-serviceaccounts-reviewers:
- awly
- deads2k
- enj
- liggitt
- mikedanese
- WanLinghao
sig-storage-reviewers:
- saad-ali
- childsb
sig-scheduling-maintainers:
- bsalamat
- k82cn
- wojtek-t
- ravisantoshgudimetla
- Huang-Wei
sig-scheduling:
- bsalamat
- k82cn
- resouer
- ravisantoshgudimetla
- misterikkit
- Huang-Wei
- wgliang
sig-cli-maintainers:
- adohe
- brendandburns
- deads2k
- janetkuo
- liggitt
- seans3
- monopole
- droot
- apelisse
- mengqiy
- smarterclayton
- soltysh
sig-cli:
- adohe
- deads2k
- derekwaynecarr
- dixudx
- dims
- dshulyak
- eparis
- ghodss
- juanvallejo
- mengqiy
- rootfs
- seans3
- shiywang
- smarterclayton
- soltysh
sig-testing-reviewers:
- bentheelder
- cblecker
- fejta
- krzyzacy
- ixdy
- spiffxp
sig-testing-approvers:
- bentheelder
- cblecker
- fejta
- krzyzacy
- ixdy
- spiffxp
sig-node-reviewers:
- Random-Liu
- dashpole
- dchen1107
- derekwaynecarr
- dims
- feiskyer
- mtaufen
- pmorie
- resouer
- sjenning
- sjpotter
- tallclair
- tmrts
- vishh
- yifan-gu
- yujuhong
- krmayankk
sig-network-approvers:
- bowei
- caseydavenport
- danwinship
- dcbw
- dnardo
- freehan
- mrhohn
- nicksardo
- thockin
sig-network-reviewers:
- bowei
- caseydavenport
- danwinship
- dcbw
- dnardo
- freehan
- mrhohn
- nicksardo
- thockin
- rramkumar1
sig-apps-reviewers:
- enisoc
- erictune
- foxish
- janetkuo
- kow3ns
- lukaszo
- mfojtik
- smarterclayton
- soltysh
- tnozicka
sig-apps-api-approvers:
- erictune
- smarterclayton
sig-autoscaling-maintainers:
- aleksandra-malinowska
- bskiba
- DirectXMan12
- MaciekPytel
- mwielgus
api-approvers:
- erictune
- lavalamp
- smarterclayton
- thockin
- liggitt
# - bgrant0607 # manual escalations only
api-reviewers:
- erictune
- lavalamp
- smarterclayton
- thockin
- liggitt
- wojtek-t
- deads2k
- yujuhong
- brendandburns
- derekwaynecarr
- caesarxuchao
- vishh
- mikedanese
- nikhiljindal
- gmarek
- davidopp
- pmorie
- sttts
- dchen1107
- saad-ali
- zmerlynn
- luxas
- janetkuo
- justinsb
- pwittrock
- roberthbailey
- ncdc
- tallclair
- yifan-gu
- eparis
- mwielgus
- timothysc
- soltysh
- piosz
- jsafrane
- jbeda
dep-approvers:
- apelisse
- BenTheElder
- cblecker
- dims
- thockin
- sttts
- soltysh
feature-approvers:
- bgrant0607 # Architecture
- brancz # Instrumentation
- bsalamat # Scheduling
- calebamiles # Release
- caseydavenport # Network
- childsb # Storage
- countspongebob # Scalability
- csbell # Multicluster
- dcbw # Network
- dchen1107 # Node
- deads2k # API Machinery
- derekwaynecarr # Node
- dghubble # On Premise
- directxman12 # Autoscaling
- jdumars # Architecture, Cluster Ops, Release
- kow3ns # Apps
- lavalamp # API Machinery
- liggitt # Auth
- lukemarsden # Cluster Lifecycle
- luxas # Cluster Lifecycle
- marcoceppi # On Premise
- mattfarina # Apps
- michmike # Windows
- mwielgus # Autoscaling
- piosz # Instrumentation
- prydonius # Apps
- pwittrock # CLI
- quinton-hoole # Multicluster
- roberthbailey # Cluster Lifecycle
- saad-ali # Storage
- seans3 # CLI
- soltysh # CLI
- tallclair # Auth
- thockin # Network
- timothysc # Cluster Lifecycle, Scheduling
- wojtek-t # Scalability
- zehicle # Cluster Ops
# Defined below are the security contacts for this repo.
#
# They are the contact point for the Product Security Committee to reach out
# to for triaging and handling of incoming issues.
#
# The below names agree to abide by the
# [Embargo Policy](https://git.k8s.io/security/private-distributors-list.md#embargo-policy)
# and will be removed and replaced if they violate that agreement.
#
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
# INSTRUCTIONS AT https://kubernetes.io/security/
cjcullen
jessfraz
liggitt
philips
tallclair
## Support for deploying and using Kubernetes
Welcome to Kubernetes! We use GitHub for tracking bugs and feature requests.
This isn't the right place to get support for using Kubernetes, but the following
resources are available below, thanks for understanding.
### Stack Overflow
The Kubernetes Community is active on Stack Overflow, you can post your questions there:
* [Kubernetes on Stack Overflow](https://stackoverflow.com/questions/tagged/kubernetes)
* Here are some tips for [about how to ask good questions](https://stackoverflow.com/help/how-to-ask).
* Don't forget to check to see [what's on topic](http://stackoverflow.com/help/on-topic).
### Documentation
* [User Documentation](https://kubernetes.io/docs/)
* [Troubleshooting Guide](https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/)
### Real-time Chat
* [Slack](https://kubernetes.slack.com) ([registration](http://slack.k8s.io)):
The `#kubernetes-users` and `#kubernetes-novice` channels are usual places where
people offer support.
### Forum
* [Kubernetes Official Forum](https://discuss.kubernetes.io)
\ No newline at end of file
build/root/WORKSPACE
\ No newline at end of file
# See the OWNERS docs at https://go.k8s.io/owners
# Disable inheritance as this is an api owners file
options:
no_parent_owners: true
approvers:
- api-approvers
reviewers:
- api-reviewers
# Existing API Rule Violations
This folder contains the checked-in report file of known API rule violations.
The file violation\_exceptions.list is used by Make rule during OpenAPI spec generation to make
sure that no new API rule violation is introduced into our code base.
## API Rule Violation Format
The report file [violation\_exceptions.list](./violation_exceptions.list) is in format of:
* ***API rule violation: \<RULE\>,\<PACKAGE\>,\<TYPE\>,\<FIELD\>***
e.g.
* ***API rule violation: names_match,k8s.io/api/core/v1,Event,ReportingController***
And the violation list is sorted alphabetically in each of the \<RULE\>, \<PACKAGE\>, \<TYPE\>, \<FIELD\> levels.
## How to resolve API Rule Check Failure
Make rule returns an error when the newly generated violation report differs from this
checked-in violation report.
Our goal is that exceptions should never be added to this list, only fixed and removed.
For new APIs, this is a hard requirement. For APIs that are e.g. being moved between
versions or groups without other changes, it is OK for your API reviewer to make an
exception.
If you're removing violations from the exception list, or if you have good
reasons to add new violations to this list, please update the file using:
- `make generated_files UPDATE_API_KNOWN_VIOLATIONS=true`
It is up to API reviewers to review the list and make sure new APIs follow our API conventions.
**NOTE**: please don't hide changes to this file in a "generated changes" commit, treat it as
source code instead.
## API Rules Being Enforced
For more information about the API rules being checked, please refer to
https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators/rules
package(default_visibility = ["//visibility:public"])
filegroup(
name = "openapi-spec",
srcs = glob([
"**/*.json",
]),
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
# Kubernetes's OpenAPI Specification
This folder contains an [OpenAPI specification](https://github.com/OAI/OpenAPI-Specification) for Kubernetes API.
## Vendor Extensions
Kubernetes extends OpenAPI using these extensions. Note the version that
extensions has been added.
### `x-kubernetes-group-version-kind`
Operations and Definitions may have `x-kubernetes-group-version-kind` if they
are associated with a [kubernetes resource](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources).
For example:
``` json
"paths": {
...
"/api/v1/namespaces/{namespace}/pods/{name}": {
...
"get": {
...
"x-kubernetes-group-version-kind": {
"group": "",
"version": "v1",
"kind": "Pod"
}
}
}
}
```
### `x-kubernetes-action`
Operations and Definitions may have `x-kubernetes-action` if they
are associated with a [kubernetes resource](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources).
Action can be one of `get`, `list`, `put`, `patch`, `post`, `delete`, `deletecollection`, `watch`, `watchlist`, `proxy`, or `connect`.
For example:
``` json
"paths": {
...
"/api/v1/namespaces/{namespace}/pods/{name}": {
...
"get": {
...
"x-kubernetes-action": "list"
}
}
}
```
### `x-kubernetes-patch-strategy` and `x-kubernetes-patch-merge-key`
Some of the definitions may have these extensions. For more information about PatchStrategy and PatchMergeKey see
[strategic-merge-patch](https://git.k8s.io/community/contributors/devel/sig-api-machinery/strategic-merge-patch.md).
This source diff could not be displayed because it is too large. You can view the blob instead.
package(default_visibility = ["//visibility:public"])
load("@io_k8s_repo_infra//defs:build.bzl", "release_filegroup")
load(":code_generation_test.bzl", "code_generation_test_suite")
load(":container.bzl", "multi_arch_container", "multi_arch_container_push")
load(":platforms.bzl", "SERVER_PLATFORMS", "for_platforms")
code_generation_test_suite(
name = "code_generation_tests",
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//build/debs:all-srcs",
"//build/release-tars:all-srcs",
"//build/rpms:all-srcs",
"//build/visible_to:all-srcs",
],
tags = ["automanaged"],
)
# This list should roughly match kube::build::get_docker_wrapped_binaries()
# in build/common.sh.
DOCKERIZED_BINARIES = {
"cloud-controller-manager": {
"base": "@debian-base-{ARCH}//image",
"target": "//cmd/cloud-controller-manager:cloud-controller-manager",
},
"kube-apiserver": {
"base": "@debian-base-{ARCH}//image",
"target": "//cmd/kube-apiserver:kube-apiserver",
},
"kube-controller-manager": {
"base": "@debian-base-{ARCH}//image",
"target": "//cmd/kube-controller-manager:kube-controller-manager",
},
"kube-scheduler": {
"base": "@debian-base-{ARCH}//image",
"target": "//cmd/kube-scheduler:kube-scheduler",
},
"kube-proxy": {
"base": "@debian-iptables-{ARCH}//image",
"target": "//cmd/kube-proxy:kube-proxy",
},
}
# In the bash-based build (build/lib/release.sh), the images built for amd64 do not use
# an arch in their name (but other arches do), and the GCE cluster scripts
# (which sideload the images via tarfiles) expect there not to be an arch.
# When pushing to gcr.io, we want to use an arch, since the archless name is now used for a
# manifest list. Bazel doesn't support manifest lists (yet), so we can't do that either.
# For now, we use the archless name for the image tars saved in the server tarball,
# to satisfy GCE and other similar providers. (If one were to pull the images via the manifest
# list, the arch wouldn't appear in the name either.)
[multi_arch_container(
name = binary,
architectures = SERVER_PLATFORMS["linux"],
base = meta["base"],
cmd = ["/usr/bin/" + binary],
debs = select(for_platforms(
for_server = ["//build/debs:%s-{ARCH}.deb" % binary],
only_os = "linux",
)),
# Since the multi_arch_container macro replaces the {ARCH} format string,
# we need to escape the stamping vars.
# Also see comment above about why the push tags use ARCH while the
# non-push tags do not.
docker_push_tags = ["{{STABLE_DOCKER_PUSH_REGISTRY}}/%s-{ARCH}:{{STABLE_DOCKER_TAG}}" % binary],
docker_tags = ["{{STABLE_DOCKER_REGISTRY}}/%s:{{STABLE_DOCKER_TAG}}" % binary],
stamp = True,
symlinks = {
# Some cluster startup scripts expect to find the binaries in /usr/local/bin,
# but the debs install the binaries into /usr/bin.
"/usr/local/bin/" + binary: "/usr/bin/" + binary,
},
tags = ["manual"],
visibility = ["//visibility:private"],
) for binary, meta in DOCKERIZED_BINARIES.items()]
# Also roll up all images into a single bundle to push with one target.
multi_arch_container_push(
name = "server-images",
architectures = SERVER_PLATFORMS["linux"],
docker_tags_images = {
"{{STABLE_DOCKER_PUSH_REGISTRY}}/%s-{ARCH}:{{STABLE_DOCKER_TAG}}" % binary: "%s-internal" % binary
for binary in DOCKERIZED_BINARIES.keys()
},
tags = ["manual"],
)
[genrule(
name = binary + "_docker_tag",
srcs = [meta["target"]],
outs = [binary + ".docker_tag"],
cmd = "grep ^STABLE_DOCKER_TAG bazel-out/stable-status.txt | awk '{print $$2}' >$@",
stamp = 1,
) for binary, meta in DOCKERIZED_BINARIES.items()]
genrule(
name = "os_package_version",
outs = ["version"],
cmd = """
grep ^STABLE_BUILD_SCM_REVISION bazel-out/stable-status.txt \
| awk '{print $$2}' \
| sed -e 's/^v//' -Ee 's/-([a-z]+)/~\\1/' -e 's/-/+/g' \
>$@
""",
stamp = 1,
)
release_filegroup(
name = "docker-artifacts",
srcs = [":%s.tar" % binary for binary in DOCKERIZED_BINARIES.keys()] +
[":%s.docker_tag" % binary for binary in DOCKERIZED_BINARIES.keys()],
)
# KUBE_CLIENT_TARGETS
release_filegroup(
name = "client-targets",
conditioned_srcs = for_platforms(for_client = [
"//cmd/kubectl",
]),
)
# KUBE_NODE_TARGETS
release_filegroup(
name = "node-targets",
conditioned_srcs = for_platforms(for_node = [
"//cmd/kube-proxy",
"//cmd/kubeadm",
"//cmd/kubelet",
]),
)
# KUBE_SERVER_TARGETS
# No need to duplicate CLIENT_TARGETS or NODE_TARGETS here,
# since we include them in the actual build rule.
release_filegroup(
name = "server-targets",
conditioned_srcs = for_platforms(for_server = [
"//cluster/gce/gci/mounter",
"//cmd/cloud-controller-manager",
"//cmd/hyperkube",
"//cmd/kube-apiserver",
"//cmd/kube-controller-manager",
"//cmd/kube-scheduler",
]),
)
# kube::golang::test_targets
filegroup(
name = "test-targets",
srcs = select(for_platforms(
for_server = [
"//cmd/kubemark",
"//test/e2e_node:e2e_node.test_binary",
],
for_test = [
"//cmd/gendocs",
"//cmd/genkubedocs",
"//cmd/genman",
"//cmd/genswaggertypedocs",
"//cmd/genyaml",
"//cmd/linkcheck",
"//test/e2e:e2e.test_binary",
"//vendor/github.com/onsi/ginkgo/ginkgo",
],
)),
)
# KUBE_TEST_PORTABLE
filegroup(
name = "test-portable-targets",
srcs = [
"//hack:e2e.go",
"//hack:get-build.sh",
"//hack:ginkgo-e2e.sh",
"//hack/e2e-internal:all-srcs",
"//hack/lib:all-srcs",
"//test/e2e/testing-manifests:all-srcs",
"//test/kubemark:all-srcs",
],
)
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- bentheelder
- cblecker
- ixdy
- jbeda
- lavalamp
- spiffxp
- zmerlynn
approvers:
- cblecker
- ixdy
- jbeda
- lavalamp
- zmerlynn
- mikedanese
# Building Kubernetes
Building Kubernetes is easy if you take advantage of the containerized build environment. This document will help guide you through understanding this build process.
## Requirements
1. Docker, using one of the following configurations:
* **macOS** You can either use Docker for Mac or docker-machine. See installation instructions [here](https://docs.docker.com/docker-for-mac/).
**Note**: You will want to set the Docker VM to have at least 4.5GB of initial memory or building will likely fail. (See: [#11852]( http://issue.k8s.io/11852)).
* **Linux with local Docker** Install Docker according to the [instructions](https://docs.docker.com/installation/#installation) for your OS.
* **Remote Docker engine** Use a big machine in the cloud to build faster. This is a little trickier so look at the section later on.
2. **Optional** [Google Cloud SDK](https://developers.google.com/cloud/sdk/)
You must install and configure Google Cloud SDK if you want to upload your release to Google Cloud Storage and may safely omit this otherwise.
## Overview
While it is possible to build Kubernetes using a local golang installation, we have a build process that runs in a Docker container. This simplifies initial set up and provides for a very consistent build and test environment.
## Key scripts
The following scripts are found in the `build/` directory. Note that all scripts must be run from the Kubernetes root directory.
* `build/run.sh`: Run a command in a build docker container. Common invocations:
* `build/run.sh make`: Build just linux binaries in the container. Pass options and packages as necessary.
* `build/run.sh make cross`: Build all binaries for all platforms
* `build/run.sh make kubectl KUBE_BUILD_PLATFORMS=darwin/amd64`: Build the specific binary for the specific platform (`kubectl` and `darwin/amd64` respectively in this example)
* `build/run.sh make test`: Run all unit tests
* `build/run.sh make test-integration`: Run integration test
* `build/run.sh make test-cmd`: Run CLI tests
* `build/copy-output.sh`: This will copy the contents of `_output/dockerized/bin` from the Docker container to the local `_output/dockerized/bin`. It will also copy out specific file patterns that are generated as part of the build process. This is run automatically as part of `build/run.sh`.
* `build/make-clean.sh`: Clean out the contents of `_output`, remove any locally built container images and remove the data container.
* `build/shell.sh`: Drop into a `bash` shell in a build container with a snapshot of the current repo code.
## Basic Flow
The scripts directly under `build/` are used to build and test. They will ensure that the `kube-build` Docker image is built (based on `build/build-image/Dockerfile`) and then execute the appropriate command in that container. These scripts will both ensure that the right data is cached from run to run for incremental builds and will copy the results back out of the container.
The `kube-build` container image is built by first creating a "context" directory in `_output/images/build-image`. It is done there instead of at the root of the Kubernetes repo to minimize the amount of data we need to package up when building the image.
There are 3 different containers instances that are run from this image. The first is a "data" container to store all data that needs to persist across to support incremental builds. Next there is an "rsync" container that is used to transfer data in and out to the data container. Lastly there is a "build" container that is used for actually doing build actions. The data container persists across runs while the rsync and build containers are deleted after each use.
`rsync` is used transparently behind the scenes to efficiently move data in and out of the container. This will use an ephemeral port picked by Docker. You can modify this by setting the `KUBE_RSYNC_PORT` env variable.
All Docker names are suffixed with a hash derived from the file path (to allow concurrent usage on things like CI machines) and a version number. When the version number changes all state is cleared and clean build is started. This allows the build infrastructure to be changed and signal to CI systems that old artifacts need to be deleted.
## Proxy Settings
If you are behind a proxy and you are letting these scripts use `docker-machine` to set up your local VM for you on macOS, you need to export proxy settings for Kubernetes build, the following environment variables should be defined.
```
export KUBERNETES_HTTP_PROXY=http://username:password@proxyaddr:proxyport
export KUBERNETES_HTTPS_PROXY=https://username:password@proxyaddr:proxyport
```
Optionally, you can specify addresses of no proxy for Kubernetes build, for example
```
export KUBERNETES_NO_PROXY=127.0.0.1
```
If you are using sudo to make Kubernetes build for example make quick-release, you need run `sudo -E make quick-release` to pass the environment variables.
## Really Remote Docker Engine
It is possible to use a Docker Engine that is running remotely (under your desk or in the cloud). Docker must be configured to connect to that machine and the local rsync port must be forwarded (via SSH or nc) from localhost to the remote machine.
To do this easily with GCE and `docker-machine`, do something like this:
```
# Create the remote docker machine on GCE. This is a pretty beefy machine with SSD disk.
KUBE_BUILD_VM=k8s-build
KUBE_BUILD_GCE_PROJECT=<project>
docker-machine create \
--driver=google \
--google-project=${KUBE_BUILD_GCE_PROJECT} \
--google-zone=us-west1-a \
--google-machine-type=n1-standard-8 \
--google-disk-size=50 \
--google-disk-type=pd-ssd \
${KUBE_BUILD_VM}
# Set up local docker to talk to that machine
eval $(docker-machine env ${KUBE_BUILD_VM})
# Pin down the port that rsync will be exposed on the remote machine
export KUBE_RSYNC_PORT=8730
# forward local 8730 to that machine so that rsync works
docker-machine ssh ${KUBE_BUILD_VM} -L ${KUBE_RSYNC_PORT}:localhost:${KUBE_RSYNC_PORT} -N &
```
Look at `docker-machine stop`, `docker-machine start` and `docker-machine rm` to manage this VM.
## Releasing
The `build/release.sh` script will build a release. It will build binaries, run tests, (optionally) build runtime Docker images.
The main output is a tar file: `kubernetes.tar.gz`. This includes:
* Cross compiled client utilities.
* Script (`kubectl`) for picking and running the right client binary based on platform.
* Examples
* Cluster deployment scripts for various clouds
* Tar file containing all server binaries
In addition, there are some other tar files that are created:
* `kubernetes-client-*.tar.gz` Client binaries for a specific platform.
* `kubernetes-server-*.tar.gz` Server binaries for a specific platform.
When building final release tars, they are first staged into `_output/release-stage` before being tar'd up and put into `_output/release-tars`.
## Reproducibility
`make release`, its variant `make quick-release`, and Bazel all provide a
hermetic build environment which should provide some level of reproducibility
for builds. `make` itself is **not** hermetic.
The Kubernetes build environment supports the [`SOURCE_DATE_EPOCH` environment
variable](https://reproducible-builds.org/specs/source-date-epoch/) specified by
the Reproducible Builds project, which can be set to a UNIX epoch timestamp.
This will be used for the build timestamps embedded in compiled Go binaries,
and maybe someday also Docker images.
One reasonable setting for this variable is to use the commit timestamp from the
tip of the tree being built; this is what the Kubernetes CI system uses. For
example, you could use the following one-liner:
```bash
SOURCE_DATE_EPOCH=$(git show -s --format=format:%ct HEAD)
```
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/build/README.md?pixel)]()
# Copyright 2018 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.
# Genrule wrapper around the go-bindata utility.
# IMPORTANT: Any changes to this rule may also require changes to hack/generate-bindata.sh.
def go_bindata(
name, srcs, outs,
compress=True,
include_metadata=True,
pkg="generated",
ignores=["\.jpg", "\.png", "\.md", "BUILD(\.bazel)?"],
**kw):
args = []
for ignore in ignores:
args.extend(["-ignore", "'%s'" % ignore])
if not include_metadata:
args.append("-nometadata")
if not compress:
args.append("-nocompress")
native.genrule(
name = name,
srcs = srcs,
outs = outs,
cmd = """
$(location //vendor/github.com/jteeuwen/go-bindata/go-bindata:go-bindata) \
-o "$@" -pkg %s -prefix $$(pwd) %s $(SRCS)
""" % (pkg, " ".join(args)),
tools = [
"//vendor/github.com/jteeuwen/go-bindata/go-bindata",
],
**kw
)
# Copyright 2016 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.
# This file creates a standard build environment for building Kubernetes
FROM k8s.gcr.io/kube-cross:KUBE_BUILD_IMAGE_CROSS_TAG
# Mark this as a kube-build container
RUN touch /kube-build-image
# To run as non-root we sometimes need to rebuild go stdlib packages.
RUN chmod -R a+rwx /usr/local/go/pkg
# For running integration tests /var/run/kubernetes is required
# and should be writable by user
RUN mkdir /var/run/kubernetes && chmod a+rwx /var/run/kubernetes
# The kubernetes source is expected to be mounted here. This will be the base
# of operations.
ENV HOME /go/src/k8s.io/kubernetes
WORKDIR ${HOME}
# Make output from the dockerized build go someplace else
ENV KUBE_OUTPUT_SUBPATH _output/dockerized
# Pick up version stuff here as we don't copy our .git over.
ENV KUBE_GIT_VERSION_FILE ${HOME}/.dockerized-kube-version-defs
# Add system-wide git user information
RUN git config --system user.email "nobody@k8s.io" \
&& git config --system user.name "kube-build-image"
# Fix permissions on gopath
RUN chmod -R a+rwx $GOPATH
# Make log messages use the right timezone
ADD localtime /etc/localtime
RUN chmod a+r /etc/localtime
# Set up rsyncd
ADD rsyncd.password /
RUN chmod a+r /rsyncd.password
ADD rsyncd.sh /
RUN chmod a+rx /rsyncd.sh
# Copyright 2016 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.
# This file creates a standard build environment for building cross
# platform go binary for the architecture kubernetes cares about.
FROM golang:1.12.9
ENV GOARM 7
ENV KUBE_DYNAMIC_CROSSPLATFORMS \
armhf \
arm64 \
s390x \
ppc64el
ENV KUBE_CROSSPLATFORMS \
linux/386 \
linux/arm linux/arm64 \
linux/ppc64le \
linux/s390x \
darwin/amd64 darwin/386 \
windows/amd64 windows/386
# Pre-compile the standard go library when cross-compiling. This is much easier now when we have go1.5+
RUN for platform in ${KUBE_CROSSPLATFORMS}; do GOOS=${platform%/*} GOARCH=${platform##*/} go install std; done \
&& go clean -cache
# Install g++, then download and install protoc for generating protobuf output
RUN apt-get update \
&& apt-get install -y rsync jq apt-utils file patch unzip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Use dynamic cgo linking for architectures other than amd64 for the server platforms
# To install crossbuild essential for other architectures add the following repository.
RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe" > /etc/apt/sources.list.d/cgocrosscompiling.list \
&& apt-key adv --no-tty --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 3B4FE6ACC0B21F32 \
&& apt-get update \
&& apt-get install -y build-essential \
&& for platform in ${KUBE_DYNAMIC_CROSSPLATFORMS}; do apt-get install -y crossbuild-essential-${platform}; done \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN PROTOBUF_VERSION=3.0.2; ZIPNAME="protoc-${PROTOBUF_VERSION}-linux-x86_64.zip"; \
mkdir /tmp/protoc && cd /tmp/protoc \
&& wget "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/${ZIPNAME}" \
&& unzip "${ZIPNAME}" \
&& chmod -R +rX /tmp/protoc \
&& cp -pr bin /usr/local \
&& cp -pr include /usr/local \
&& rm -rf /tmp/protoc \
&& protoc --version
# work around 64MB tmpfs size in Docker 1.6
ENV TMPDIR /tmp.k8s
RUN mkdir $TMPDIR \
&& chmod a+rwx $TMPDIR \
&& chmod o+t $TMPDIR
# Get the code coverage tool and goimports
RUN go get golang.org/x/tools/cmd/cover \
golang.org/x/tools/cmd/goimports \
&& go clean -cache
# Download and symlink etcd. We need this for our integration tests.
RUN export ETCD_VERSION=v3.2.24; \
mkdir -p /usr/local/src/etcd \
&& cd /usr/local/src/etcd \
&& curl -fsSL https://github.com/coreos/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz | tar -xz \
&& ln -s ../src/etcd/etcd-${ETCD_VERSION}-linux-amd64/etcd /usr/local/bin/
# Copyright 2016 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.
.PHONY: build push
IMAGE=kube-cross
TAG=$(shell cat VERSION)
all: push
build:
docker build --pull -t staging-k8s.gcr.io/$(IMAGE):$(TAG) .
push: build
docker push staging-k8s.gcr.io/$(IMAGE):$(TAG)
#!/usr/bin/env bash
# Copyright 2016 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.
# This script will set up and run rsyncd to allow data to move into and out of
# our dockerized build system. This is used for syncing sources and changes of
# sources into the docker-build-container. It is also used to transfer built binaries
# and generated files back out.
#
# When run as root (rare) it'll preserve the file ids as sent from the client.
# Usually it'll be run as non-dockerized UID/GID and end up translating all file
# ownership to that.
set -o errexit
set -o nounset
set -o pipefail
# The directory that gets sync'd
VOLUME=${HOME}
# Assume that this is running in Docker on a bridge. Allow connections from
# anything on the local subnet.
ALLOW=$(ip route | awk '/^default via/ { reg = "^[0-9./]+ dev "$5 } ; $0 ~ reg { print $1 }')
CONFDIR="/tmp/rsync.k8s"
PIDFILE="${CONFDIR}/rsyncd.pid"
CONFFILE="${CONFDIR}/rsyncd.conf"
SECRETS="${CONFDIR}/rsyncd.secrets"
mkdir -p "${CONFDIR}"
if [[ -f "${PIDFILE}" ]]; then
PID=$(cat "${PIDFILE}")
echo "Cleaning up old PID file: ${PIDFILE}"
kill "${PID}" &> /dev/null || true
rm "${PIDFILE}"
fi
PASSWORD=$(</rsyncd.password)
cat <<EOF >"${SECRETS}"
k8s:${PASSWORD}
EOF
chmod go= "${SECRETS}"
USER_CONFIG=
if [[ "$(id -u)" == "0" ]]; then
USER_CONFIG=" uid = 0"$'\n'" gid = 0"
fi
cat <<EOF >"${CONFFILE}"
pid file = ${PIDFILE}
use chroot = no
log file = /dev/stdout
reverse lookup = no
munge symlinks = no
port = 8730
[k8s]
numeric ids = true
$USER_CONFIG
hosts deny = *
hosts allow = ${ALLOW} ${ALLOW_HOST-}
auth users = k8s
secrets file = ${SECRETS}
read only = false
path = ${VOLUME}
filter = - /.make/ - /_tmp/
EOF
exec /usr/bin/rsync --no-detach --daemon --config="${CONFFILE}" "$@"
# Copyright 2018 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.
load("//build:kazel_generated.bzl", "go_prefix", "tags_values_pkgs")
load("//build:openapi.bzl", "openapi_vendor_prefix")
load("@io_k8s_repo_infra//defs:go.bzl", "go_genrule")
def bazel_go_library(pkg):
"""Returns the Bazel label for the Go library for the provided package.
This is intended to be used with the //build:kazel_generated.bzl tag dictionaries; for example:
load("//build:kazel_generated.bzl", "tags_values_pkgs")
some_rule(
...
deps = [bazel_go_library(pkg) for pkg in tags_values_pkgs["openapi-gen"]["true"]],
...
)
"""
return "//%s:go_default_library" % pkg
def go_pkg(pkg):
"""Returns the full Go package name for the provided workspace-relative package.
This is suitable to pass to tools depending on the Go build library.
If any packages are in staging/src, they are remapped to their intended path in vendor/.
This is intended to be used with the //build:kazel_generated.bzl tag dictionaries.
For example:
load("//build:kazel_generated.bzl", "tags_values_pkgs")
genrule(
...
cmd = "do something --pkgs=%s" % ",".join([go_pkg(pkg) for pkg in tags_values_pkgs["openapi-gen"]["true"]]),
...
)
"""
return go_prefix + "/" + pkg.replace("staging/src/", "vendor/", maxsplit = 1)
def openapi_deps():
deps = [
"//vendor/github.com/go-openapi/spec:go_default_library",
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
]
deps.extend([bazel_go_library(pkg) for pkg in tags_values_pkgs["openapi-gen"]["true"]])
return deps
def gen_openapi(outs, output_pkg):
"""Calls openapi-gen to produce the zz_generated.openapi.go file,
which should be provided in outs.
output_pkg should be set to the full go package name for this generated file.
"""
go_genrule(
name = "zz_generated.openapi",
srcs = ["//" + openapi_vendor_prefix + "hack/boilerplate:boilerplate.generatego.txt"],
outs = outs,
# In order for vendored dependencies to be imported correctly,
# the generator must run from the repo root inside the generated GOPATH.
# All of bazel's $(location)s are relative to the original working directory, however.
cmd = " ".join([
"cd $$GOPATH/src/" + go_prefix + ";",
"$$GO_GENRULE_EXECROOT/$(location //vendor/k8s.io/kube-openapi/cmd/openapi-gen)",
"--v 1",
"--logtostderr",
"--go-header-file $$GO_GENRULE_EXECROOT/$(location //" + openapi_vendor_prefix + "hack/boilerplate:boilerplate.generatego.txt)",
"--output-file-base zz_generated.openapi",
"--output-package " + output_pkg,
"--report-filename tmp_api_violations.report",
"--input-dirs " + ",".join([go_pkg(pkg) for pkg in tags_values_pkgs["openapi-gen"]["true"]]),
"&& cp $$GOPATH/src/" + output_pkg + "/zz_generated.openapi.go $$GO_GENRULE_EXECROOT/$(location :zz_generated.openapi.go)",
"&& rm tmp_api_violations.report",
]),
go_deps = openapi_deps(),
tools = ["//vendor/k8s.io/kube-openapi/cmd/openapi-gen"],
)
# Copyright 2018 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.
load(":code_generation.bzl", "bazel_go_library", "go_pkg")
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
def _bazel_go_library_test_impl(ctx):
env = unittest.begin(ctx)
test_cases = [
("pkg/kubectl/util", "//pkg/kubectl/util:go_default_library"),
("vendor/some/third/party", "//vendor/some/third/party:go_default_library"),
("staging/src/k8s.io/apimachinery/api", "//staging/src/k8s.io/apimachinery/api:go_default_library"),
]
for input, expected in test_cases:
asserts.equals(env, expected, bazel_go_library(input))
unittest.end(env)
bazel_go_library_test = unittest.make(_bazel_go_library_test_impl)
def _go_pkg_test_impl(ctx):
env = unittest.begin(ctx)
test_cases = [
("pkg/kubectl/util", "k8s.io/kubernetes/pkg/kubectl/util"),
("vendor/some/third/party", "k8s.io/kubernetes/vendor/some/third/party"),
("staging/src/k8s.io/apimachinery/api", "k8s.io/kubernetes/vendor/k8s.io/apimachinery/api"),
]
for input, expected in test_cases:
asserts.equals(env, expected, go_pkg(input))
unittest.end(env)
go_pkg_test = unittest.make(_go_pkg_test_impl)
def code_generation_test_suite(name):
unittest.suite(
name,
bazel_go_library_test,
go_pkg_test,
)
# Copyright 2019 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.
load("@io_bazel_rules_docker//container:container.bzl", "container_bundle", "container_image")
load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push")
load("//build:platforms.bzl", "go_platform_constraint")
# multi_arch_container produces a private internal container_image, multiple
# arch-specific tagged container_bundles (named NAME-ARCH), an alias
# from NAME to the appropriately NAME-ARCH container_bundle target, and a
# genrule for NAME.tar copying the appropriate NAME-ARCH container bundle
# tarball output for the currently-configured architecture.
# Additionally, if docker_push_tags is provided, uses multi_arch_container_push
# to create container_bundles named push-NAME-ARCH with the provided push tags,
# along with a push-NAME docker_push target.
# Args:
# name: name used for the alias; the internal container_image and
# container_bundles are based on this name
# architectures: list of architectures (in GOARCH naming parlance) to
# configure
# base: base image to use for the containers. The format string {ARCH} will
# be replaced with the configured GOARCH.
# docker_tags: list of docker tags to apply to the image. The format string
# {ARCH} will be replaced with the configured GOARCH; any stamping variables
# should be escaped, e.g. {{STABLE_MY_VAR}}.
# docker_push_tags: list of docker tags to apply to the image for pushing.
# The format string {ARCH} will be replaced with the configured GOARCH;
# any stamping variables should be escaped, e.g. {{STABLE_MY_VAR}}.
# tags: will be applied to all targets
# visiblity: will be applied only to the container_bundles; the internal
# container_image is private
# All other args will be applied to the internal container_image.
def multi_arch_container(
name,
architectures,
base,
docker_tags,
docker_push_tags = None,
tags = None,
visibility = None,
**kwargs):
container_image(
name = "%s-internal" % name,
base = select({
go_platform_constraint(os = "linux", arch = arch): base.format(ARCH = arch)
for arch in architectures
}),
tags = tags,
visibility = ["//visibility:private"],
**kwargs
)
for arch in architectures:
container_bundle(
name = "%s-%s" % (name, arch),
images = {
docker_tag.format(ARCH = arch): ":%s-internal" % name
for docker_tag in docker_tags
},
tags = tags,
visibility = visibility,
)
native.alias(
name = name,
actual = select({
go_platform_constraint(os = "linux", arch = arch): "%s-%s" % (name, arch)
for arch in architectures
}),
)
native.genrule(
name = "gen_%s.tar" % name,
outs = ["%s.tar" % name],
srcs = select({
go_platform_constraint(os = "linux", arch = arch): ["%s-%s.tar" % (name, arch)]
for arch in architectures
}),
cmd = "cp $< $@",
output_to_bindir = True,
)
if docker_push_tags:
multi_arch_container_push(
name = name,
architectures = architectures,
docker_tags_images = {docker_push_tag: ":%s-internal" % name for docker_push_tag in docker_push_tags},
tags = tags,
)
# multi_arch_container_push creates container_bundles named push-NAME-ARCH for
# the provided architectures, populating them with the images directory.
# It additionally creates a push-NAME docker_push rule which can be run to
# push the images to a Docker repository.
# Args:
# name: name used for targets created by this macro; the internal
# container_bundles are based on this name
# architectures: list of architectures (in GOARCH naming parlance) to
# configure
# docker_tags_images: dictionary mapping docker tag to the corresponding
# container_image target. The format string {ARCH} will be replaced
# in tags with the configured GOARCH; any stamping variables should be
# escaped, e.g. {{STABLE_MY_VAR}}.
# tags: applied to container_bundle targets
def multi_arch_container_push(
name,
architectures,
docker_tags_images,
tags = None):
for arch in architectures:
container_bundle(
name = "push-%s-%s" % (name, arch),
images = {tag.format(ARCH = arch): image for tag, image in docker_tags_images.items()},
tags = tags,
visibility = ["//visibility:private"],
)
docker_push(
name = "push-%s" % name,
bundle = select({
go_platform_constraint(os = "linux", arch = arch): "push-%s-%s" % (name, arch)
for arch in architectures
}),
)
#!/usr/bin/env bash
# Copyright 2014 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.
# Copies any built binaries (and other generated files) out of the Docker build container.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/build/common.sh"
kube::build::verify_prereqs
kube::build::copy_output
# Copyright 2017 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.
FROM scratch
ADD rootfs.tar /
CMD ["/bin/sh"]
# Copyright 2017 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.
FROM BASEIMAGE
# If we're building for another architecture than amd64, the CROSS_BUILD_ placeholder is removed so
# e.g. CROSS_BUILD_COPY turns into COPY
# If we're building normally, for amd64, CROSS_BUILD lines are removed
CROSS_BUILD_COPY qemu-ARCH-static /usr/bin/
ENV DEBIAN_FRONTEND=noninteractive
# Smaller package install size.
COPY excludes /etc/dpkg/dpkg.cfg.d/excludes
# Convenience script for building on this base image.
COPY clean-install /usr/local/bin/clean-install
# Update system packages.
RUN apt-get update \
&& apt-get dist-upgrade -y
# Hold required packages to avoid breaking the installation of packages
RUN apt-mark hold apt gnupg adduser passwd libsemanage1 libcap2
# Remove unnecessary packages.
# This list was generated manually by listing the installed packages (`apt list --installed`),
# then running `apt-cache rdepends --installed --no-recommends` to find the "root" packages.
# The root packages were evaluated based on whether they were needed in the container image.
# Several utilities (e.g. ping) were kept for usefulness, but may be removed in later versions.
RUN echo "Yes, do as I say!" | apt-get purge \
bash \
debconf-i18n \
e2fslibs \
e2fsprogs \
init \
initscripts \
libcap2-bin \
libkmod2 \
libmount1 \
libsmartcols1 \
libudev1 \
libblkid1 \
libncursesw5 \
libprocps6 \
libslang2 \
libss2 \
libsystemd0 \
libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl \
ncurses-base \
ncurses-bin \
systemd \
systemd-sysv \
sysv-rc \
tzdata
# No-op stubs replace some unnecessary binaries that may be depended on in the install process (in
# particular we don't run an init process).
WORKDIR /usr/local/bin
RUN touch noop && \
chmod 555 noop && \
ln -s noop runlevel && \
ln -s noop invoke-rc.d && \
ln -s noop update-rc.d
WORKDIR /
# Cleanup cached and unnecessary files.
RUN apt-get autoremove -y && \
apt-get clean -y && \
tar -czf /usr/share/copyrights.tar.gz /usr/share/common-licenses /usr/share/doc/*/copyright && \
rm -rf \
/usr/share/doc \
/usr/share/man \
/usr/share/info \
/usr/share/locale \
/var/lib/apt/lists/* \
/var/log/* \
/var/cache/debconf/* \
/usr/share/common-licenses* \
/usr/share/bash-completion \
~/.bashrc \
~/.profile \
/etc/systemd \
/lib/lsb \
/lib/udev \
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
mkdir -p /usr/share/man/man1 /usr/share/man/man2 \
/usr/share/man/man3 /usr/share/man/man4 \
/usr/share/man/man5 /usr/share/man/man6 \
/usr/share/man/man7 /usr/share/man/man8
# Copyright 2017 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.
all: all-build
REGISTRY ?= staging-k8s.gcr.io
IMAGE ?= $(REGISTRY)/debian-base
BUILD_IMAGE ?= debian-build
TAG ?= v1.0.0
TAR_FILE ?= rootfs.tar
ARCH?=amd64
ALL_ARCH = amd64 arm arm64 ppc64le s390x
TEMP_DIR:=$(shell mktemp -d)
QEMUVERSION=v2.9.1
SUDO=$(if $(filter 0,$(shell id -u)),,sudo)
# This option is for running docker manifest command
export DOCKER_CLI_EXPERIMENTAL := enabled
ifeq ($(ARCH),amd64)
BASEIMAGE?=debian:stretch
endif
ifeq ($(ARCH),arm)
BASEIMAGE?=arm32v7/debian:stretch
QEMUARCH=arm
endif
ifeq ($(ARCH),arm64)
BASEIMAGE?=arm64v8/debian:stretch
QEMUARCH=aarch64
endif
ifeq ($(ARCH),ppc64le)
BASEIMAGE?=ppc64le/debian:stretch
QEMUARCH=ppc64le
endif
ifeq ($(ARCH),s390x)
BASEIMAGE?=s390x/debian:stretch
QEMUARCH=s390x
endif
sub-build-%:
$(MAKE) ARCH=$* build
all-build: $(addprefix sub-build-,$(ALL_ARCH))
sub-push-image-%:
$(MAKE) ARCH=$* push
all-push-images: $(addprefix sub-push-image-,$(ALL_ARCH))
all-push: all-push-images push-manifest
push-manifest:
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(IMAGE)\-&:$(TAG)~g")
@for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}-$${arch}:${TAG}; done
docker manifest push --purge ${IMAGE}:${TAG}
build: clean
cp ./* $(TEMP_DIR)
cat Dockerfile.build \
| sed "s|BASEIMAGE|$(BASEIMAGE)|g" \
| sed "s|ARCH|$(QEMUARCH)|g" \
> $(TEMP_DIR)/Dockerfile.build
ifeq ($(ARCH),amd64)
# When building "normally" for amd64, remove the whole line, it has no part in the amd64 image
sed "/CROSS_BUILD_/d" $(TEMP_DIR)/Dockerfile.build > $(TEMP_DIR)/Dockerfile.build.tmp
else
# When cross-building, only the placeholder "CROSS_BUILD_" should be removed
# Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel
$(SUDO) ../../third_party/multiarch/qemu-user-static/register/register.sh --reset
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/$(QEMUVERSION)/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C $(TEMP_DIR)
# Ensure we don't get surprised by umask settings
chmod 0755 $(TEMP_DIR)/qemu-$(QEMUARCH)-static
sed "s/CROSS_BUILD_//g" $(TEMP_DIR)/Dockerfile.build > $(TEMP_DIR)/Dockerfile.build.tmp
endif
mv $(TEMP_DIR)/Dockerfile.build.tmp $(TEMP_DIR)/Dockerfile.build
docker build --pull -t $(BUILD_IMAGE) -f $(TEMP_DIR)/Dockerfile.build $(TEMP_DIR)
docker create --name $(BUILD_IMAGE) $(BUILD_IMAGE)
docker export $(BUILD_IMAGE) > $(TEMP_DIR)/$(TAR_FILE)
docker build -t $(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
rm -rf $(TEMP_DIR)
push: build
docker push $(IMAGE)-$(ARCH):$(TAG)
clean:
docker rmi -f $(IMAGE)-$(ARCH):$(TAG) || true
docker rmi -f $(BUILD_IMAGE) || true
docker rm -f $(BUILD_IMAGE) || true
# Kubernetes Debian Base
The Kubernetes debian-base image provides a common base for Kubernetes system images that require
external dependencies (such as `iptables`, `sh`, or anything that is more than a static go-binary).
This image differs from the standard debian image by removing a lot of packages and files that are
generally not necessary in containers. The end result is an image that is just over 40 MB, down from
123 MB.
The image also provides a convenience script `/usr/local/bin/clean-install` that encapsulates the
process of updating apt repositories, installing the packages, and then cleaning up unnecessary
caches & logs.
#!/bin/sh
# Copyright 2017 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.
# A script encapsulating a common Dockerimage pattern for installing packages
# and then cleaning up the unnecessary install artifacts.
# e.g. clean-install iptables ebtables conntrack
set -o errexit
if [ $# = 0 ]; then
echo >&2 "No packages specified"
exit 1
fi
apt-get update
apt-get install -y --no-install-recommends $@
apt-get clean -y
rm -rf \
/var/cache/debconf/* \
/var/lib/apt/lists/* \
/var/log/* \
/tmp/* \
/var/tmp/*
path-exclude /usr/share/doc/*
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/groff/*
path-exclude /usr/share/i18n/locales/*
path-include /usr/share/i18n/locales/en_US*
path-exclude /usr/share/info/*
path-exclude /usr/share/locale/*
path-include /usr/share/locale/en_US*
path-include /usr/share/locale/locale.alias
path-exclude /usr/share/man/*
# Copyright 2017 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.
FROM BASEIMAGE
# TODO(#69896): deprecate the shortened aliases in /
RUN ln -s /hyperkube /apiserver \
&& ln -s /hyperkube /cloud-controller-manager \
&& ln -s /hyperkube /controller-manager \
&& ln -s /hyperkube /kubectl \
&& ln -s /hyperkube /kubelet \
&& ln -s /hyperkube /proxy \
&& ln -s /hyperkube /scheduler \
&& ln -s /hyperkube /usr/local/bin/cloud-controller-manager \
&& ln -s /hyperkube /usr/local/bin/kube-apiserver \
&& ln -s /hyperkube /usr/local/bin/kube-controller-manager \
&& ln -s /hyperkube /usr/local/bin/kube-proxy \
&& ln -s /hyperkube /usr/local/bin/kube-scheduler \
&& ln -s /hyperkube /usr/local/bin/kubectl \
&& ln -s /hyperkube /usr/local/bin/kubelet
RUN echo CACHEBUST>/dev/null && clean-install \
bash
# The samba-common, cifs-utils, and nfs-common packages depend on
# ucf, which itself depends on /bin/bash.
RUN echo "dash dash/sh boolean false" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
RUN echo CACHEBUST>/dev/null && clean-install \
ca-certificates \
ceph-common \
cifs-utils \
conntrack \
e2fsprogs \
xfsprogs \
ebtables \
ethtool \
git \
glusterfs-client \
iptables \
ipset \
jq \
kmod \
openssh-client \
netbase \
nfs-common \
socat \
udev \
util-linux
COPY cni-bin/bin /opt/cni/bin
# Copyright 2017 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.
# Build the hyperkube base image. This image is used to build the hyperkube image.
#
# Usage:
# [ARCH=amd64] [REGISTRY="staging-k8s.gcr.io"] make (build|push)
REGISTRY?=staging-k8s.gcr.io
IMAGE?=$(REGISTRY)/debian-hyperkube-base
TAG=0.12.1
ARCH?=amd64
ALL_ARCH = amd64 arm arm64 ppc64le s390x
CACHEBUST?=1
BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):0.4.1
CNI_VERSION=v0.7.5
TEMP_DIR:=$(shell mktemp -d)
CNI_TARBALL=cni-plugins-$(ARCH)-$(CNI_VERSION).tgz
# This option is for running docker manifest command
export DOCKER_CLI_EXPERIMENTAL := enabled
SUDO=$(if $(filter 0,$(shell id -u)),,sudo)
.PHONY: all build push clean all-build all-push-images all-push push-manifest
all: all-push
sub-build-%:
$(MAKE) ARCH=$* build
all-build: $(addprefix sub-build-,$(ALL_ARCH))
sub-push-image-%:
$(MAKE) ARCH=$* push
all-push-images: $(addprefix sub-push-image-,$(ALL_ARCH))
all-push: all-push-images push-manifest
push-manifest:
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(IMAGE)\-&:$(TAG)~g")
@for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}-$${arch}:${TAG}; done
docker manifest push --purge ${IMAGE}:${TAG}
cni-tars/$(CNI_TARBALL):
mkdir -p cni-tars/
cd cni-tars/ && curl -sSLO --retry 5 https://storage.googleapis.com/kubernetes-release/network-plugins/${CNI_TARBALL}
clean:
rm -rf cni-tars/
build: cni-tars/$(CNI_TARBALL)
cp Dockerfile $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile
ifeq ($(CACHEBUST),1)
cd ${TEMP_DIR} && sed -i.back "s|CACHEBUST|$(shell uuidgen)|g" Dockerfile
endif
mkdir -p ${TEMP_DIR}/cni-bin/bin
tar -xz -C ${TEMP_DIR}/cni-bin/bin -f "cni-tars/${CNI_TARBALL}"
ifneq ($(ARCH),amd64)
# Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel
$(SUDO) ../../third_party/multiarch/qemu-user-static/register/register.sh --reset
endif
docker build --pull -t $(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
rm -rf $(TEMP_DIR)
push: build
docker push $(IMAGE)-$(ARCH):$(TAG)
# See the OWNERS docs at https://go.k8s.io/owners
labels:
- sig/release
### debian-hyperkube-base
Serves as the base image for `k8s.gcr.io/hyperkube-${ARCH}`
images.
This image is compiled for multiple architectures.
#### How to release
If you're editing the Dockerfile or some other thing, please bump the `TAG` in the Makefile.
```console
# Build and push images for all the architectures
$ make all-push
# ---> staging-k8s.gcr.io/debian-hyperkube-base-amd64:TAG
# ---> staging-k8s.gcr.io/debian-hyperkube-base-arm:TAG
# ---> staging-k8s.gcr.io/debian-hyperkube-base-arm64:TAG
# ---> staging-k8s.gcr.io/debian-hyperkube-base-ppc64le:TAG
# ---> staging-k8s.gcr.io/debian-hyperkube-base-s390x:TAG
```
If you don't want to push the images, run `make all-build` instead
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/build/debian-hyperkube-base/README.md?pixel)]()
# Copyright 2016 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.
FROM BASEIMAGE
RUN clean-install \
conntrack \
ebtables \
ipset \
iptables \
kmod \
netbase
# Copyright 2016 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.
.PHONY: build push all all-build all-push-images all-push push-manifest
REGISTRY?="staging-k8s.gcr.io"
IMAGE=$(REGISTRY)/debian-iptables
TAG?=v11.0.2
ARCH?=amd64
ALL_ARCH = amd64 arm arm64 ppc64le s390x
TEMP_DIR:=$(shell mktemp -d)
BASEIMAGE?=k8s.gcr.io/debian-base-$(ARCH):v1.0.0
# This option is for running docker manifest command
export DOCKER_CLI_EXPERIMENTAL := enabled
SUDO=$(if $(filter 0,$(shell id -u)),,sudo)
build:
cp ./* $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile
ifneq ($(ARCH),amd64)
# Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel
$(SUDO) ../../third_party/multiarch/qemu-user-static/register/register.sh --reset
endif
docker build --pull -t $(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
push: build
docker push $(IMAGE)-$(ARCH):$(TAG)
sub-build-%:
$(MAKE) ARCH=$* build
all-build: $(addprefix sub-build-,$(ALL_ARCH))
sub-push-image-%:
$(MAKE) ARCH=$* push
all-push-images: $(addprefix sub-push-image-,$(ALL_ARCH))
all-push: all-push-images push-manifest
push-manifest:
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(IMAGE)\-&:$(TAG)~g")
@for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}-$${arch}:${TAG}; done
docker manifest push --purge ${IMAGE}:${TAG}
all: all-push
### debian-iptables
Serves as the base image for `k8s.gcr.io/kube-proxy-${ARCH}` and multiarch (not `amd64`) `k8s.gcr.io/flannel-${ARCH}` images.
This image is compiled for multiple architectures.
#### How to release
If you're editing the Dockerfile or some other thing, please bump the `TAG` in the Makefile.
```console
Build and push images for all the architectures
$ make all-push
# ---> staging-k8s.gcr.io/debian-iptables-amd64:TAG
# ---> staging-k8s.gcr.io/debian-iptables-arm:TAG
# ---> staging-k8s.gcr.io/debian-iptables-arm64:TAG
# ---> staging-k8s.gcr.io/debian-iptables-ppc64le:TAG
# ---> staging-k8s.gcr.io/debian-iptables-s390x:TAG
```
If you don't want to push the images, run `make build ARCH={target_arch}` or `make all-build` instead
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/build/debian-iptables/README.md?pixel)]()
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/default/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
# The file is provided as part of the kubeadm package
net.ipv4.ip_forward = 1
package(default_visibility = ["//visibility:public"])
load("@io_k8s_repo_infra//defs:deb.bzl", "deb_data", "k8s_deb")
load("@io_k8s_repo_infra//defs:build.bzl", "release_filegroup")
load("@io_k8s_repo_infra//defs:pkg.bzl", "pkg_tar")
load(
"//build:platforms.bzl",
"CLIENT_PLATFORMS",
"NODE_PLATFORMS",
"SERVER_PLATFORMS",
"for_platforms",
)
load("//build:workspace.bzl", "CNI_VERSION", "CRI_TOOLS_VERSION")
# We do not include kube-scheduler, kube-controller-manager,
# kube-apiserver, and kube-proxy in this list even though we
# produce debs for them. We recommend that they be run in docker
# images. We use the debs that we produce here to build those
# images.
release_filegroup(
name = "debs",
conditioned_srcs = for_platforms(
default = [],
for_client = [":kubectl.deb"],
for_node = [
":cri-tools.deb",
":kubeadm.deb",
":kubelet.deb",
":kubernetes-cni.deb",
],
only_os = "linux",
),
)
# Create genrules to copy the arch-specific debs to debs without the arch in their filename.
genrule(
name = "kubectl",
srcs = select(for_platforms(
for_client = [":kubectl-{ARCH}.deb"],
only_os = "linux",
)),
outs = ["kubectl.deb"],
cmd = "cp $< $@",
output_to_bindir = True,
)
[genrule(
name = pkg,
srcs = select(for_platforms(
for_node = [":%s-{ARCH}.deb" % pkg],
only_os = "linux",
)),
outs = ["%s.deb" % pkg],
cmd = "cp $< $@",
output_to_bindir = True,
) for pkg in [
"cri-tools",
"kubeadm",
"kubelet",
"kubernetes-cni",
]]
[deb_data(
name = "kubectl",
data = [
{
"files": ["//cmd/kubectl"],
"mode": "0755",
"dir": "/usr/bin",
},
],
goarch = arch,
tags = ["manual"],
) for arch in CLIENT_PLATFORMS["linux"]]
[[deb_data(
name = binary,
data = [
{
"files": ["//cmd/" + binary],
"mode": "0755",
"dir": "/usr/bin",
},
],
goarch = arch,
tags = ["manual"],
) for binary in [
"cloud-controller-manager",
"kube-apiserver",
"kube-controller-manager",
"kube-proxy",
"kube-scheduler",
]] for arch in SERVER_PLATFORMS["linux"]]
[deb_data(
name = "kubelet",
data = [
{
"files": ["//cmd/kubelet"],
"mode": "0755",
"dir": "/usr/bin",
},
{
"files": ["kubelet.service"],
"mode": "644",
"dir": "/lib/systemd/system",
},
],
goarch = arch,
tags = ["manual"],
) for arch in NODE_PLATFORMS["linux"]]
[deb_data(
name = "kubeadm",
data = [
{
"files": ["//cmd/kubeadm"],
"mode": "0755",
"dir": "/usr/bin",
},
{
"files": ["10-kubeadm.conf"],
"mode": "644",
"dir": "/etc/systemd/system/kubelet.service.d",
},
{
"files": ["kubeadm.conf"],
"mode": "644",
"dir": "/usr/lib/modules-load.d",
},
{
"files": ["50-kubeadm.conf"],
"mode": "644",
"dir": "/etc/sysctl.d",
},
],
goarch = arch,
tags = ["manual"],
) for arch in NODE_PLATFORMS["linux"]]
[pkg_tar(
name = "kubernetes-cni-data-%s" % goarch,
package_dir = "/opt/cni/bin",
tags = ["manual"],
deps = ["@kubernetes_cni_%s//file" % goarch],
) for goarch in NODE_PLATFORMS["linux"]]
[pkg_tar(
name = "cri-tools-data-%s" % goarch,
package_dir = "/usr/bin",
tags = ["manual"],
deps = ["@cri_tools_%s//file" % goarch],
) for goarch in NODE_PLATFORMS["linux"]]
[k8s_deb(
name = "cloud-controller-manager",
description = "Kubernetes Cloud Controller Manager",
goarch = arch,
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in SERVER_PLATFORMS["linux"]]
[k8s_deb(
name = "kubectl",
description = """Kubernetes Command Line Tool
The Kubernetes command line tool for interacting with the Kubernetes API.
""",
goarch = arch,
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in CLIENT_PLATFORMS["linux"]]
[k8s_deb(
name = "kube-apiserver",
description = "Kubernetes API Server",
goarch = arch,
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in SERVER_PLATFORMS["linux"]]
[k8s_deb(
name = "kube-controller-manager",
description = "Kubernetes Controller Manager",
goarch = arch,
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in SERVER_PLATFORMS["linux"]]
[k8s_deb(
name = "kube-scheduler",
description = "Kubernetes Scheduler",
goarch = arch,
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in SERVER_PLATFORMS["linux"]]
[k8s_deb(
name = "kube-proxy",
depends = [
"iptables (>= 1.4.21)",
"iproute2",
],
description = "Kubernetes Service Proxy",
goarch = arch,
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in NODE_PLATFORMS["linux"]]
[k8s_deb(
name = "kubelet",
depends = [
"conntrack",
"ebtables",
"ethtool",
"iproute2",
"iptables (>= 1.4.21)",
"kubernetes-cni (>= %s)" % CNI_VERSION,
"mount",
"socat",
"util-linux",
],
description = """Kubernetes Node Agent
The node agent of Kubernetes, the container cluster manager
""",
goarch = arch,
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in NODE_PLATFORMS["linux"]]
[k8s_deb(
name = "kubeadm",
depends = [
"kubelet (>= 1.8.0)",
"kubectl (>= 1.8.0)",
"kubernetes-cni (>= %s)" % CNI_VERSION,
"cri-tools (>= 1.11.0)",
],
description = """Kubernetes Cluster Bootstrapping Tool
The Kubernetes command line tool for bootstrapping a Kubernetes cluster.
""",
goarch = arch,
postinst = "postinst",
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in NODE_PLATFORMS["linux"]]
[k8s_deb(
name = "kubernetes-cni",
description = """Kubernetes Packaging of CNI
The Container Networking Interface tools for provisioning container networks.
""",
goarch = arch,
tags = ["manual"],
version = CNI_VERSION,
) for arch in NODE_PLATFORMS["linux"]]
[k8s_deb(
name = "cri-tools",
description = """Container Runtime Interface tools (crictl)""",
goarch = arch,
tags = ["manual"],
version = CRI_TOOLS_VERSION,
) for arch in NODE_PLATFORMS["linux"]]
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- luxas
- jbeda
- mikedanese
- pipejakob
- chuckha
- timothysc
approvers:
- luxas
- jbeda
- mikedanese
- pipejakob
- timothysc
# Load br_netfilter module at boot
br_netfilter
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=http://kubernetes.io/docs/
[Service]
ExecStart=/usr/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target
#!/bin/sh
# see: dh_installdeb(1)
set -o errexit
set -o nounset
case "$1" in
configure)
# because kubeadm package adds kubelet drop-ins, we must daemon-reload
# and restart kubelet now. restarting kubelet is ok because kubelet
# postinst configure step auto-starts it.
systemctl daemon-reload 2>/dev/null || true
systemctl restart kubelet 2>/dev/null || true
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
\ No newline at end of file
# Copyright 2019 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.
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test")
# Defines several go_binary rules to work around a Bazel issue which makes
# the pure attribute on go_binary not configurable.
# The name provided will have cgo enabled if targeting Linux, and will
# be a pure go binary otherwise. Additionally, if targeting Windows, the
# output filename will have a .exe suffix.
def go_binary_conditional_pure(name, tags = None, **kwargs):
tags = tags or []
tags.append("manual")
go_binary(
name = "_%s-cgo" % name,
out = name,
pure = "off",
tags = tags,
**kwargs
)
# Define a rule for both Unix and Windows exe suffixes.
[go_binary(
name = "_%s-pure" % out,
out = out,
pure = "on",
tags = tags,
**kwargs
) for out in [name, name + ".exe"]]
# The real magic, where we work around the pure attribute not being
# configurable: select the appropriate go_binary rule above based on the
# configured platform.
native.alias(
name = name,
actual = select({
"@io_bazel_rules_go//go/platform:linux": ":_%s-cgo" % name,
"@io_bazel_rules_go//go/platform:windows": ":_%s.exe-pure" % name,
"//conditions:default": ":_%s-pure" % name,
}),
)
# Defines several go_test rules to work around a Bazel issue which makes
# the pure attribute on go_test not configurable.
# This also defines genrules to produce test binaries named ${out} and
# ${out}.exe, and an alias named ${out}_binary which automatically selects
# the correct filename suffix (i.e. with a .exe on Windows).
def go_test_conditional_pure(name, out, tags = None, **kwargs):
tags = tags or []
tags.append("manual")
go_test(
name = "_%s-cgo" % name,
pure = "off",
testonly = False,
tags = tags,
**kwargs
)
go_test(
name = "_%s-pure" % name,
pure = "on",
testonly = False,
tags = tags,
**kwargs
)
native.alias(
name = name,
actual = select({
"@io_bazel_rules_go//go/platform:linux": ":_%s-cgo" % name,
"//conditions:default": ":_%s-pure" % name,
}),
)
[native.genrule(
name = "gen_%s" % o,
srcs = [name],
outs = [o],
cmd = "cp $< $@;",
output_to_bindir = True,
executable = True,
tags = tags,
) for o in [out, out + ".exe"]]
native.alias(
name = "%s_binary" % out,
actual = select({
"@io_bazel_rules_go//go/platform:windows": ":gen_%s.exe" % out,
"//conditions:default": ":gen_%s" % out,
}),
)
# Copyright 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.
# #################################################
# # # # # # # # # # # # # # # # # # # # # # # # # #
# This file is autogenerated by kazel. DO NOT EDIT.
# # # # # # # # # # # # # # # # # # # # # # # # # #
# #################################################
#
# The go prefix passed to kazel
go_prefix = "k8s.io/kubernetes"
# The list of codegen tags kazel is configured to find
kazel_configured_tags = ["openapi-gen"]
# tags_values_pkgs is a dictionary mapping {k8s build tag: {tag value: [pkgs including that tag:value]}}
tags_values_pkgs = {"openapi-gen": {
"false": [
"staging/src/k8s.io/api/admission/v1beta1",
"staging/src/k8s.io/api/core/v1",
"staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1",
"staging/src/k8s.io/apiserver/pkg/apis/example/v1",
"staging/src/k8s.io/apiserver/pkg/apis/example2/v1",
],
"true": [
"cmd/cloud-controller-manager/app/apis/config/v1alpha1",
"pkg/apis/abac/v0",
"pkg/apis/abac/v1beta1",
"pkg/apis/auditregistration",
"pkg/version",
"staging/src/k8s.io/api/admissionregistration/v1beta1",
"staging/src/k8s.io/api/apps/v1",
"staging/src/k8s.io/api/apps/v1beta1",
"staging/src/k8s.io/api/apps/v1beta2",
"staging/src/k8s.io/api/auditregistration/v1alpha1",
"staging/src/k8s.io/api/authentication/v1",
"staging/src/k8s.io/api/authentication/v1beta1",
"staging/src/k8s.io/api/authorization/v1",
"staging/src/k8s.io/api/authorization/v1beta1",
"staging/src/k8s.io/api/autoscaling/v1",
"staging/src/k8s.io/api/autoscaling/v2beta1",
"staging/src/k8s.io/api/autoscaling/v2beta2",
"staging/src/k8s.io/api/batch/v1",
"staging/src/k8s.io/api/batch/v1beta1",
"staging/src/k8s.io/api/batch/v2alpha1",
"staging/src/k8s.io/api/certificates/v1beta1",
"staging/src/k8s.io/api/coordination/v1",
"staging/src/k8s.io/api/coordination/v1beta1",
"staging/src/k8s.io/api/core/v1",
"staging/src/k8s.io/api/events/v1beta1",
"staging/src/k8s.io/api/extensions/v1beta1",
"staging/src/k8s.io/api/imagepolicy/v1alpha1",
"staging/src/k8s.io/api/networking/v1",
"staging/src/k8s.io/api/networking/v1beta1",
"staging/src/k8s.io/api/node/v1alpha1",
"staging/src/k8s.io/api/node/v1beta1",
"staging/src/k8s.io/api/policy/v1beta1",
"staging/src/k8s.io/api/rbac/v1",
"staging/src/k8s.io/api/rbac/v1alpha1",
"staging/src/k8s.io/api/rbac/v1beta1",
"staging/src/k8s.io/api/scheduling/v1",
"staging/src/k8s.io/api/scheduling/v1alpha1",
"staging/src/k8s.io/api/scheduling/v1beta1",
"staging/src/k8s.io/api/settings/v1alpha1",
"staging/src/k8s.io/api/storage/v1",
"staging/src/k8s.io/api/storage/v1alpha1",
"staging/src/k8s.io/api/storage/v1beta1",
"staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1",
"staging/src/k8s.io/apimachinery/pkg/api/resource",
"staging/src/k8s.io/apimachinery/pkg/apis/meta/v1",
"staging/src/k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"staging/src/k8s.io/apimachinery/pkg/runtime",
"staging/src/k8s.io/apimachinery/pkg/util/intstr",
"staging/src/k8s.io/apimachinery/pkg/version",
"staging/src/k8s.io/apiserver/pkg/apis/audit/v1",
"staging/src/k8s.io/apiserver/pkg/apis/audit/v1alpha1",
"staging/src/k8s.io/apiserver/pkg/apis/audit/v1beta1",
"staging/src/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1",
"staging/src/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1",
"staging/src/k8s.io/client-go/pkg/version",
"staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1",
"staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1",
"staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1",
"staging/src/k8s.io/kube-controller-manager/config/v1alpha1",
"staging/src/k8s.io/kube-proxy/config/v1alpha1",
"staging/src/k8s.io/kube-scheduler/config/v1alpha1",
"staging/src/k8s.io/kubelet/config/v1beta1",
"staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1",
"staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta2",
"staging/src/k8s.io/metrics/pkg/apis/external_metrics/v1beta1",
"staging/src/k8s.io/metrics/pkg/apis/metrics/v1alpha1",
"staging/src/k8s.io/metrics/pkg/apis/metrics/v1beta1",
"staging/src/k8s.io/node-api/pkg/apis/node/v1alpha1",
],
}}
# tags_pkgs_values is a dictionary mapping {k8s build tag: {pkg: [tag values in pkg]}}
tags_pkgs_values = {"openapi-gen": {
"cmd/cloud-controller-manager/app/apis/config/v1alpha1": ["true"],
"pkg/apis/abac/v0": ["true"],
"pkg/apis/abac/v1beta1": ["true"],
"pkg/apis/auditregistration": ["true"],
"pkg/version": ["true"],
"staging/src/k8s.io/api/admission/v1beta1": ["false"],
"staging/src/k8s.io/api/admissionregistration/v1beta1": ["true"],
"staging/src/k8s.io/api/apps/v1": ["true"],
"staging/src/k8s.io/api/apps/v1beta1": ["true"],
"staging/src/k8s.io/api/apps/v1beta2": ["true"],
"staging/src/k8s.io/api/auditregistration/v1alpha1": ["true"],
"staging/src/k8s.io/api/authentication/v1": ["true"],
"staging/src/k8s.io/api/authentication/v1beta1": ["true"],
"staging/src/k8s.io/api/authorization/v1": ["true"],
"staging/src/k8s.io/api/authorization/v1beta1": ["true"],
"staging/src/k8s.io/api/autoscaling/v1": ["true"],
"staging/src/k8s.io/api/autoscaling/v2beta1": ["true"],
"staging/src/k8s.io/api/autoscaling/v2beta2": ["true"],
"staging/src/k8s.io/api/batch/v1": ["true"],
"staging/src/k8s.io/api/batch/v1beta1": ["true"],
"staging/src/k8s.io/api/batch/v2alpha1": ["true"],
"staging/src/k8s.io/api/certificates/v1beta1": ["true"],
"staging/src/k8s.io/api/coordination/v1": ["true"],
"staging/src/k8s.io/api/coordination/v1beta1": ["true"],
"staging/src/k8s.io/api/core/v1": [
"false",
"true",
],
"staging/src/k8s.io/api/events/v1beta1": ["true"],
"staging/src/k8s.io/api/extensions/v1beta1": ["true"],
"staging/src/k8s.io/api/imagepolicy/v1alpha1": ["true"],
"staging/src/k8s.io/api/networking/v1": ["true"],
"staging/src/k8s.io/api/networking/v1beta1": ["true"],
"staging/src/k8s.io/api/node/v1alpha1": ["true"],
"staging/src/k8s.io/api/node/v1beta1": ["true"],
"staging/src/k8s.io/api/policy/v1beta1": ["true"],
"staging/src/k8s.io/api/rbac/v1": ["true"],
"staging/src/k8s.io/api/rbac/v1alpha1": ["true"],
"staging/src/k8s.io/api/rbac/v1beta1": ["true"],
"staging/src/k8s.io/api/scheduling/v1": ["true"],
"staging/src/k8s.io/api/scheduling/v1alpha1": ["true"],
"staging/src/k8s.io/api/scheduling/v1beta1": ["true"],
"staging/src/k8s.io/api/settings/v1alpha1": ["true"],
"staging/src/k8s.io/api/storage/v1": ["true"],
"staging/src/k8s.io/api/storage/v1alpha1": ["true"],
"staging/src/k8s.io/api/storage/v1beta1": ["true"],
"staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1": ["true"],
"staging/src/k8s.io/apimachinery/pkg/api/resource": ["true"],
"staging/src/k8s.io/apimachinery/pkg/apis/meta/v1": ["true"],
"staging/src/k8s.io/apimachinery/pkg/apis/meta/v1beta1": ["true"],
"staging/src/k8s.io/apimachinery/pkg/apis/testapigroup/v1": ["false"],
"staging/src/k8s.io/apimachinery/pkg/runtime": ["true"],
"staging/src/k8s.io/apimachinery/pkg/util/intstr": ["true"],
"staging/src/k8s.io/apimachinery/pkg/version": ["true"],
"staging/src/k8s.io/apiserver/pkg/apis/audit/v1": ["true"],
"staging/src/k8s.io/apiserver/pkg/apis/audit/v1alpha1": ["true"],
"staging/src/k8s.io/apiserver/pkg/apis/audit/v1beta1": ["true"],
"staging/src/k8s.io/apiserver/pkg/apis/example/v1": ["false"],
"staging/src/k8s.io/apiserver/pkg/apis/example2/v1": ["false"],
"staging/src/k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1": ["true"],
"staging/src/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1": ["true"],
"staging/src/k8s.io/client-go/pkg/version": ["true"],
"staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1": ["true"],
"staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1": ["true"],
"staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1": ["true"],
"staging/src/k8s.io/kube-controller-manager/config/v1alpha1": ["true"],
"staging/src/k8s.io/kube-proxy/config/v1alpha1": ["true"],
"staging/src/k8s.io/kube-scheduler/config/v1alpha1": ["true"],
"staging/src/k8s.io/kubelet/config/v1beta1": ["true"],
"staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta1": ["true"],
"staging/src/k8s.io/metrics/pkg/apis/custom_metrics/v1beta2": ["true"],
"staging/src/k8s.io/metrics/pkg/apis/external_metrics/v1beta1": ["true"],
"staging/src/k8s.io/metrics/pkg/apis/metrics/v1alpha1": ["true"],
"staging/src/k8s.io/metrics/pkg/apis/metrics/v1beta1": ["true"],
"staging/src/k8s.io/node-api/pkg/apis/node/v1alpha1": ["true"],
}}
#!/usr/bin/env bash
# Copyright 2014 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.
# Build the docker image necessary for building Kubernetes
#
# This script will package the parts of the repo that we need to build
# Kubernetes into a tar file and put it in the right place in the output
# directory. It will then copy over the Dockerfile and build the kube-build
# image.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT="$(dirname "${BASH_SOURCE[0]}")/.."
source "${KUBE_ROOT}/build/common.sh"
kube::build::verify_prereqs
kube::build::build_image
#!/usr/bin/env bash
# Copyright 2014 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.
# Clean out the output directory on the docker host.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/build/common.sh"
kube::build::verify_prereqs false
kube::build::clean
# ensure go's non-cgo resolver respects /etc/hosts
hosts: files dns
# Copyright 2017 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.
# A project wanting to generate openapi code for vendored
# k8s.io/kubernetes will need to set the following variables in
# //build/openapi.bzl in their project and customize the go prefix:
#
# openapi_vendor_prefix = "vendor/k8s.io/kubernetes/"
openapi_vendor_prefix = ""
#!/usr/bin/env bash
# Copyright 2017 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.
set -o errexit
set -o nounset
set -o pipefail
# Complete the release with the standard env
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/build/common.sh"
source "${KUBE_ROOT}/build/lib/release.sh"
kube::build::ensure_tar
kube::version::get_version_vars
kube::release::package_tarballs
/.container-*
/.push-*
/bin
# 3.1
* The pause container gains a signal handler to clean up orphaned zombie processes. ([#36853](https://prs.k8s.io/36853), [@verb](https://github.com/verb))
* `pause -v` will return build information for the pause binary. ([#56762](https://prs.k8s.io/56762), [@verb](https://github.com/verb))
# 3.0
* The pause container was rewritten entirely in C. ([#23009](https://prs.k8s.io/23009), [@uluyol](https://github.com/uluyol))
# Copyright 2016 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.
FROM scratch
ARG ARCH
ADD bin/pause-${ARCH} /pause
ENTRYPOINT ["/pause"]
# Copyright 2016 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.
.PHONY: all push container clean orphan all-push push-manifest
include ../../hack/make-rules/Makefile.manifest
REGISTRY ?= staging-k8s.gcr.io
IMAGE = $(REGISTRY)/pause
IMAGE_WITH_ARCH = $(IMAGE)-$(ARCH)
TAG = 3.1
REV = $(shell git describe --contains --always --match='v*')
# Architectures supported: amd64, arm, arm64, ppc64le and s390x
ARCH ?= amd64
ALL_ARCH = amd64 arm arm64 ppc64le s390x
CFLAGS = -Os -Wall -Werror -static -DVERSION=v$(TAG)-$(REV)
KUBE_CROSS_IMAGE ?= k8s.gcr.io/kube-cross
KUBE_CROSS_VERSION ?= $(shell cat ../build-image/cross/VERSION)
BIN = pause
SRCS = pause.c
ifeq ($(ARCH),amd64)
TRIPLE ?= x86_64-linux-gnu
endif
ifeq ($(ARCH),arm)
TRIPLE ?= arm-linux-gnueabihf
endif
ifeq ($(ARCH),arm64)
TRIPLE ?= aarch64-linux-gnu
endif
ifeq ($(ARCH),ppc64le)
TRIPLE ?= powerpc64le-linux-gnu
endif
ifeq ($(ARCH),s390x)
TRIPLE ?= s390x-linux-gnu
endif
# If you want to build AND push all containers, see the 'all-push' rule.
all: all-container
all-push: all-push-images push-manifest
push-manifest: manifest-tool
manifest-tool push from-args --platforms $(call join_platforms,$(ALL_ARCH)) --template $(IMAGE)-ARCH:$(TAG) --target $(IMAGE):$(TAG)
sub-container-%:
$(MAKE) ARCH=$* container
sub-push-%:
$(MAKE) ARCH=$* push
all-container: $(addprefix sub-container-,$(ALL_ARCH))
all-push-images: $(addprefix sub-push-,$(ALL_ARCH))
build: bin/$(BIN)-$(ARCH)
bin/$(BIN)-$(ARCH): $(SRCS)
mkdir -p bin
docker run --rm -u $$(id -u):$$(id -g) -v $$(pwd):/build \
$(KUBE_CROSS_IMAGE):$(KUBE_CROSS_VERSION) \
/bin/bash -c "\
cd /build && \
$(TRIPLE)-gcc $(CFLAGS) -o $@ $^ && \
$(TRIPLE)-strip $@"
container: .container-$(ARCH)
.container-$(ARCH): bin/$(BIN)-$(ARCH)
docker build --pull -t $(IMAGE_WITH_ARCH):$(TAG) --build-arg ARCH=$(ARCH) .
touch $@
push: .push-$(ARCH)
.push-$(ARCH): .container-$(ARCH)
docker push $(IMAGE_WITH_ARCH):$(TAG)
touch $@
# Useful for testing, not automatically included in container image
orphan: bin/orphan-$(ARCH)
bin/orphan-$(ARCH): orphan.c
mkdir -p bin
docker run -u $$(id -u):$$(id -g) -v $$(pwd):/build \
$(KUBE_CROSS_IMAGE):$(KUBE_CROSS_VERSION) \
/bin/bash -c "\
cd /build && \
$(TRIPLE)-gcc $(CFLAGS) -o $@ $^ && \
$(TRIPLE)-strip $@"
clean:
rm -rf .container-* .push-* bin/
/*
Copyright 2016 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.
*/
/* Creates a zombie to be reaped by init. Useful for testing. */
#include <stdio.h>
#include <unistd.h>
int main() {
pid_t pid;
pid = fork();
if (pid == 0) {
while (getppid() > 1)
;
printf("Child exiting: pid=%d ppid=%d\n", getpid(), getppid());
return 0;
} else if (pid > 0) {
printf("Parent exiting: pid=%d ppid=%d\n", getpid(), getppid());
return 0;
}
perror("Could not create child");
return 1;
}
/*
Copyright 2016 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.
*/
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#define STRINGIFY(x) #x
#define VERSION_STRING(x) STRINGIFY(x)
#ifndef VERSION
#define VERSION HEAD
#endif
static void sigdown(int signo) {
psignal(signo, "Shutting down, got signal");
exit(0);
}
static void sigreap(int signo) {
while (waitpid(-1, NULL, WNOHANG) > 0)
;
}
int main(int argc, char **argv) {
int i;
for (i = 1; i < argc; ++i) {
if (!strcasecmp(argv[i], "-v")) {
printf("pause.c %s\n", VERSION_STRING(VERSION));
return 0;
}
}
if (getpid() != 1)
/* Not an error because pause sees use outside of infra containers. */
fprintf(stderr, "Warning: pause should be the first process\n");
if (sigaction(SIGINT, &(struct sigaction){.sa_handler = sigdown}, NULL) < 0)
return 1;
if (sigaction(SIGTERM, &(struct sigaction){.sa_handler = sigdown}, NULL) < 0)
return 2;
if (sigaction(SIGCHLD, &(struct sigaction){.sa_handler = sigreap,
.sa_flags = SA_NOCLDSTOP},
NULL) < 0)
return 3;
for (;;)
pause();
fprintf(stderr, "Error: infinite loop terminated\n");
return 42;
}
# Copyright 2019 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.
load("@bazel_skylib//lib:new_sets.bzl", "sets")
load("@bazel_skylib//lib:types.bzl", "types")
# KUBE_SERVER_PLATFORMS in hack/lib/golang.sh
SERVER_PLATFORMS = {
"linux": [
"amd64",
"arm",
"arm64",
"ppc64le",
"s390x",
],
}
# KUBE_NODE_PLATFORMS in hack/lib/golang.sh
NODE_PLATFORMS = {
"linux": [
"amd64",
"arm",
"arm64",
"ppc64le",
"s390x",
],
"windows": [
"amd64",
],
}
# KUBE_CLIENT_PLATFORMS in hack/lib/golang.sh
CLIENT_PLATFORMS = {
"linux": [
"386",
"amd64",
"arm",
"arm64",
"ppc64le",
"s390x",
],
"darwin": [
"386",
"amd64",
],
"windows": [
"386",
"amd64",
],
}
# KUBE_TEST_PLATFORMS in hack/lib/golang.sh
TEST_PLATFORMS = {
"linux": [
"amd64",
"arm",
"arm64",
"s390x",
"ppc64le",
],
"darwin": [
"amd64",
],
"windows": [
"amd64",
],
}
# Helper which produces the ALL_PLATFORMS dictionary, composed of the union of
# CLIENT, NODE, SERVER, and TEST platforms
def _all_platforms():
all_platforms = {}
for platforms in [CLIENT_PLATFORMS, NODE_PLATFORMS, SERVER_PLATFORMS, TEST_PLATFORMS]:
for os, archs in platforms.items():
all_platforms[os] = sets.union(
all_platforms.setdefault(os, sets.make()),
sets.make(archs),
)
for os, archs in all_platforms.items():
all_platforms[os] = sets.to_list(archs)
return all_platforms
ALL_PLATFORMS = _all_platforms()
def go_platform_constraint(os, arch):
return "@io_bazel_rules_go//go/platform:%s_%s" % (os, arch)
# Helper to for_platforms which updates the select() dictionary.
# d is the dictionary being updated.
# value is the value to set for each item of platforms, which should
# be a single platform category dictionary (e.g. SERVER_PLATFORMS).
# only_os selects one of the OSes in platforms.
def _update_dict_for_platform_category(d, value, platforms, only_os = None):
if not value:
return
for os, arches in platforms.items():
if only_os and os != only_os:
continue
for arch in arches:
constraint = go_platform_constraint(os, arch)
fmt_args = {"OS": os, "ARCH": arch}
if types.is_list(value):
# Format all items in the list, and hope there are no duplicates
d.setdefault(constraint, []).extend(
[v.format(**fmt_args) for v in value],
)
else:
# Don't overwrite existing value
if constraint in d:
fail("duplicate entry for constraint %s", constraint)
if types.is_dict(value):
# Format dictionary values only
d[constraint] = {
dict_key: dict_value.format(**fmt_args)
for dict_key, dict_value in value.items()
}
else:
# Hopefully this is just a string
d[constraint] = value.format(**fmt_args)
# for_platforms returns a dictionary to be used with select().
# select() is used for configurable attributes (most attributes, notably
# excluding output filenames), and takes a dictionary mapping a condition
# to a value for that attribute.
# select() is described in more detail in the Bazel documentation:
# https://docs.bazel.build/versions/master/be/functions.html#select
#
# One notable condition is the target platform (os and arch).
# Kubernetes binaries generally target particular platform categories,
# such as client binaries like kubectl, or node binaries like kubelet.
# Additionally, some build artifacts need specific configurations such as
# the appropriate arch-specific base image.
#
# This macro produces a dictionary where each of the platform categories
# (client, node, server, test, all) is enumerated and filled in
# the the provided arguments as the values.
#
# For example, a filegroup might want to include one binary for all client
# platforms and another binary for server platforms. The client and server
# platform lists have some shared items but also some disjoint items.
# The client binary can be provided in for_client and the server binary provided
# in for_server; this macro will then return a select() dictionary that
# includes the appropriate binaries based on the configured platform.
#
# Another example selecting the appropriate base image for a docker container.
# One can use select(for_platforms(for_server="base-image-{ARCH}//image"))
# to have the appropriate arch-specific image selected.
#
# The for_platform arguments can be lists, dictionaries, or strings, but
# they should all be the same type for a given call.
# The tokens {OS} and {ARCH} will be substituted with the corresponding values,
# but if a dictionary is provided, only the dictionary values will be formatted.
#
# If default is provided, a default condition will be added with the provided
# value.
# only_os can be used to select a single OS from a platform category that lists
# multiple OSes. For example, it doesn't make sense to build debs or RPMs for
# anything besides Linux, so you might supply only_os="linux" for those rules.
#
# For a complete example, consult something like the release-tars target in
# build/release-tars/BUILD.
def for_platforms(
for_client = None,
for_node = None,
for_server = None,
for_test = None,
for_all = None,
default = None,
only_os = None):
d = {}
if default != None:
d["//conditions:default"] = default
_update_dict_for_platform_category(d, for_client, CLIENT_PLATFORMS, only_os)
_update_dict_for_platform_category(d, for_node, NODE_PLATFORMS, only_os)
_update_dict_for_platform_category(d, for_server, SERVER_PLATFORMS, only_os)
_update_dict_for_platform_category(d, for_test, TEST_PLATFORMS, only_os)
_update_dict_for_platform_category(d, for_all, ALL_PLATFORMS, only_os)
return d
#!/usr/bin/env bash
# Copyright 2018 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.
# Build Kubernetes release images. This will build the server target binaries,
# and create wrap them in Docker images, see `make release` for full releases
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/build/common.sh"
source "${KUBE_ROOT}/build/lib/release.sh"
CMD_TARGETS="${KUBE_SERVER_IMAGE_TARGETS[*]}"
if [[ "${KUBE_BUILD_HYPERKUBE}" =~ [yY] ]]; then
CMD_TARGETS="${CMD_TARGETS} cmd/hyperkube"
fi
if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then
CMD_TARGETS="${CMD_TARGETS} ${KUBE_CONFORMANCE_IMAGE_TARGETS[*]}"
fi
kube::build::verify_prereqs
kube::build::build_image
kube::build::run_build_command make all WHAT="${CMD_TARGETS}" KUBE_BUILD_PLATFORMS="${KUBE_SERVER_PLATFORMS[*]}"
kube::build::copy_output
kube::release::build_server_images
#!/usr/bin/env bash
# Copyright 2017 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.
set -o errexit
set -o nounset
set -o pipefail
# Complete the release with the standard env
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
# Check and error if not "in-a-container"
if [[ ! -f /.dockerenv ]]; then
echo
echo "'make release-in-a-container' can only be used from a docker container."
echo
exit 1
fi
# Other dependencies: Your container should contain docker
if ! type -p docker >/dev/null 2>&1; then
echo
echo "'make release-in-a-container' requires a container with" \
"docker installed."
echo
exit 1
fi
# First run make cross-in-a-container
make cross-in-a-container
# at the moment only make test is supported.
if [[ $KUBE_RELEASE_RUN_TESTS =~ ^[yY]$ ]]; then
make test
fi
"${KUBE_ROOT}/build/package-tarballs.sh"
package(default_visibility = ["//visibility:public"])
load(
"//build:platforms.bzl",
"CLIENT_PLATFORMS",
"NODE_PLATFORMS",
"SERVER_PLATFORMS",
"TEST_PLATFORMS",
"for_platforms",
"go_platform_constraint",
)
load("@io_k8s_repo_infra//defs:build.bzl", "release_filegroup")
load("@io_k8s_repo_infra//defs:pkg.bzl", "pkg_tar")
load("//staging:repos_generated.bzl", "staging_repos")
# Bazel doesn't make the output filename
# (such as kubernetes-server-{OS}-{ARCH}.tar.gz) configurable, so we instead
# create rules for all platforms and tag them manual.
# We then select the correct set of platform-specific tarballs in this filegroup
# using a select() statement.
# Thus the release-tars target always selects the correct set of tarballs
# for the configured platform being built.
release_filegroup(
name = "release-tars",
conditioned_srcs = for_platforms(
for_all = [
":kubernetes.tar.gz",
":kubernetes-src.tar.gz",
],
for_client = [":kubernetes-client-{OS}-{ARCH}.tar.gz"],
for_node = [":kubernetes-node-{OS}-{ARCH}.tar.gz"],
for_server = [
":kubernetes-server-{OS}-{ARCH}.tar.gz",
":kubernetes-manifests.tar.gz",
],
for_test = [
":kubernetes-test-portable.tar.gz",
":kubernetes-test-{OS}-{ARCH}.tar.gz",
# TODO(ixdy): remove once the "mondo-test" tarball is deprecated.
# It isn't really mondo under Bazel anyway.
":kubernetes-test.tar.gz",
],
),
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
pkg_tar(
name = "kubernetes-src",
srcs = ["//:all-srcs"],
extension = "tar.gz",
package_dir = "kubernetes",
strip_prefix = "//",
symlinks = {
"kubernetes/vendor/%s" % repo: "../../staging/src/%s" % repo
for repo in staging_repos
},
tags = [
"manual",
"no-cache",
],
)
# Included in node and server tarballs.
filegroup(
name = "license-targets",
srcs = [
":kubernetes-src.tar.gz",
"//:Godeps/LICENSES",
],
visibility = ["//visibility:private"],
)
pkg_tar(
name = "_client-bin",
srcs = ["//build:client-targets"],
mode = "0755",
package_dir = "client/bin",
tags = [
"manual",
"no-cache",
],
visibility = ["//visibility:private"],
)
[[pkg_tar(
name = "kubernetes-client-%s-%s" % (os, arch),
extension = "tar.gz",
package_dir = "kubernetes",
tags = [
"manual",
"no-cache",
],
deps = select({go_platform_constraint(os, arch): [":_client-bin"]}),
) for arch in archs] for os, archs in CLIENT_PLATFORMS.items()]
pkg_tar(
name = "_node-bin",
srcs = [
"//build:client-targets",
"//build:node-targets",
],
mode = "0755",
package_dir = "node/bin",
tags = [
"manual",
"no-cache",
],
visibility = ["//visibility:private"],
)
[[pkg_tar(
name = "kubernetes-node-%s-%s" % (os, arch),
srcs = [":license-targets"],
extension = "tar.gz",
mode = "0644",
package_dir = "kubernetes",
tags = [
"manual",
"no-cache",
],
deps = select({go_platform_constraint(os, arch): [":_node-bin"]}),
) for arch in archs] for os, archs in NODE_PLATFORMS.items()]
pkg_tar(
name = "_server-bin",
srcs = [
"//build:client-targets",
"//build:docker-artifacts",
"//build:node-targets",
"//build:server-targets",
],
mode = "0755",
package_dir = "server/bin",
tags = [
"manual",
"no-cache",
],
visibility = ["//visibility:private"],
)
genrule(
name = "dummy",
outs = [".dummy"],
cmd = "touch $@",
visibility = ["//visibility:private"],
)
# Some of the startup scripts fail if there isn't an addons/ directory in the server tarball.
pkg_tar(
name = "_server-addons",
srcs = [
":.dummy",
],
package_dir = "addons",
tags = [
"manual",
"no-cache",
],
visibility = ["//visibility:private"],
)
[[pkg_tar(
name = "kubernetes-server-%s-%s" % (os, arch),
srcs = [":license-targets"],
extension = "tar.gz",
mode = "0644",
package_dir = "kubernetes",
tags = [
"manual",
"no-cache",
],
deps = select({
go_platform_constraint(os, arch): [
":_server-addons",
":_server-bin",
],
}),
) for arch in archs] for os, archs in SERVER_PLATFORMS.items()]
# The mondo test tarball is deprecated.
pkg_tar(
name = "_test-mondo-bin",
srcs = ["//build:test-targets"],
mode = "0755",
package_dir = select(for_platforms(
for_test = "platforms/{OS}/{ARCH}",
)),
tags = [
"manual",
"no-cache",
],
visibility = ["//visibility:private"],
)
genrule(
name = "kubernetes-test-mondo-deprecation",
outs = ["DEPRECATION_NOTICE"],
cmd = """cat <<EOF >$@
The mondo test tarball containing binaries for all platforms is
DEPRECATED as of Kubernetes 1.14.
Users of this tarball should migrate to using the platform-specific
tarballs in combination with the "portable" tarball which contains
scripts, test images, and other manifests.
For more details, please see KEP
sig-testing/20190118-breaking-apart-the-kubernetes-test-tarball.
EOF
""",
visibility = ["//visibility:private"],
)
# The mondo test tarball is deprecated.
# This one was never really correct, anyway, since we can't include
# binaries from multiple platforms in a single tarball.
pkg_tar(
name = "kubernetes-test",
srcs = [
":kubernetes-test-mondo-deprecation",
"//build:test-portable-targets",
],
extension = "tar.gz",
package_dir = "kubernetes",
remap_paths = {
"build/release-tars/DEPRECATION_NOTICE": "DEPRECATION_NOTICE",
},
strip_prefix = "//",
tags = [
"manual",
"no-cache",
],
deps = select(for_platforms(
for_test = [":_test-mondo-bin"],
)),
)
pkg_tar(
name = "kubernetes-test-portable",
srcs = ["//build:test-portable-targets"],
extension = "tar.gz",
package_dir = "kubernetes",
strip_prefix = "//",
tags = ["no-cache"],
)
pkg_tar(
name = "_test-bin",
srcs = ["//build:test-targets"],
mode = "0755",
package_dir = "test/bin",
tags = [
"manual",
"no-cache",
],
visibility = ["//visibility:private"],
)
[[pkg_tar(
name = "kubernetes-test-%s-%s" % (os, arch),
extension = "tar.gz",
package_dir = "kubernetes",
strip_prefix = "//",
tags = [
"manual",
"no-cache",
],
deps = select({go_platform_constraint(os, arch): [":_test-bin"]}),
) for arch in archs] for os, archs in TEST_PLATFORMS.items()]
pkg_tar(
name = "_full_server",
srcs = [
":kubernetes-manifests.tar.gz",
],
package_dir = "server",
tags = [
"manual",
"no-cache",
],
visibility = ["//visibility:private"],
)
pkg_tar(
name = "kubernetes",
srcs = [
"//:Godeps/LICENSES",
"//:README.md",
"//:version",
"//cluster:all-srcs",
"//docs:all-srcs",
"//hack/lib:all-srcs",
],
extension = "tar.gz",
package_dir = "kubernetes",
strip_prefix = "//",
tags = ["no-cache"],
deps = [
":_full_server",
],
)
pkg_tar(
name = "kubernetes-manifests",
extension = "tar.gz",
tags = ["no-cache"],
deps = [
"//cluster:manifests",
],
)
#!/usr/bin/env bash
# Copyright 2014 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.
# Build a Kubernetes release. This will build the binaries, create the Docker
# images and other build artifacts.
#
# For pushing these artifacts publicly to Google Cloud Storage or to a registry
# please refer to the kubernetes/release repo at
# https://github.com/kubernetes/release.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/build/common.sh"
source "${KUBE_ROOT}/build/lib/release.sh"
KUBE_RELEASE_RUN_TESTS=${KUBE_RELEASE_RUN_TESTS-y}
kube::build::verify_prereqs
kube::build::build_image
kube::build::run_build_command make cross
if [[ $KUBE_RELEASE_RUN_TESTS =~ ^[yY]$ ]]; then
kube::build::run_build_command make test
kube::build::run_build_command make test-integration
fi
kube::build::copy_output
kube::release::package_tarballs
startup --expand_configs_in_place
# Show us information about failures.
build --verbose_failures
test --test_output=errors
# Include git version info
build --workspace_status_command hack/print-workspace-status.sh
# Make /tmp hermetic
build --sandbox_tmpfs_path=/tmp
# Ensure that Bazel never runs as root, which can cause unit tests to fail.
# This flag requires Bazel 0.5.0+
build --sandbox_fake_username
# Enable go race detection.
build:unit --features=race
test:unit --features=race
test:unit --build_tests_only
test:unit --test_tag_filters=-e2e,-integration
test:unit --flaky_test_attempts=3
test:integration --local_test_jobs 4
test:integration --test_tag_filters=integration
# Darwin and Windows only cross-compile pure Go
build:cross:darwin_386 --platforms=@io_bazel_rules_go//go/toolchain:darwin_386
build:cross:darwin_amd64 --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64
build:cross:windows_386 --platforms=@io_bazel_rules_go//go/toolchain:windows_386
build:cross:windows_amd64 --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64
# We enable cgo cross-compilation for Linux, but need to use our custom crosstool.
build:repo_infra_crosstool --crosstool_top=@io_k8s_repo_infra//tools:toolchain --compiler=gcc
build:cross:linux_386 --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_386
build:cross:linux_amd64 --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 --cpu=amd64
build:cross:linux_arm --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_arm --cpu=arm
build:cross:linux_arm64 --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 --cpu=arm64
build:cross:linux_ppc64le --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_ppc64le --cpu=ppc64le
build:cross:linux_s390x --config=repo_infra_crosstool --platforms=@io_bazel_rules_go//go/toolchain:linux_s390x --cpu=s390x
{
"GoPrefix": "k8s.io/kubernetes",
"SkippedPaths": [
"^_.*",
"/_",
"^third_party/etcd.*"
],
"AddSourcesRules": true,
"K8sCodegenBzlFile": "build/kazel_generated.bzl",
"K8sCodegenBoilerplateFile": "hack/boilerplate/boilerplate.generatebzl.txt",
"K8sCodegenTags": [
"openapi-gen"
]
}
# gazelle:build_file_name BUILD,BUILD.bazel
# gazelle:exclude _artifacts
# gazelle:exclude _gopath
# gazelle:exclude _output
# gazelle:exclude _tmp
# gazelle:prefix k8s.io/kubernetes
# Disable proto rules, since the Go sources are currently generated by
# hack/update-generated-protobuf.sh and checked into the repo.
# gazelle:proto disable_global
package(default_visibility = ["//visibility:public"])
load("@io_k8s_repo_infra//defs:build.bzl", "gcs_upload")
load("//build:platforms.bzl", "for_platforms")
filegroup(
name = "_binary-artifacts-and-hashes",
srcs = select(for_platforms(
for_client = ["//build:client-targets-and-hashes"],
for_node = [
"//build:node-targets-and-hashes",
"//build/debs:debs-and-hashes",
],
for_server = [
"//build:docker-artifacts-and-hashes",
"//build:server-targets-and-hashes",
],
)),
visibility = ["//visibility:private"],
)
# TODO: collect all relevant docker_push targets into one target that can be run:
# //build:push-server-images
# //cluster/images/conformance:push-conformance
# //cluster/images/hyperkube:push-hyperkube
gcs_upload(
name = "push-build",
data = [
":_binary-artifacts-and-hashes",
"//build/release-tars:release-tars-and-hashes",
"//cluster/gce/gci:gcs-release-artifacts-and-hashes",
"//cluster/gce/windows:gcs-release-artifacts-and-hashes",
],
tags = ["manual"],
# Use for_platforms to format the upload path based on the configured
# platform (os/arch).
# For example, this will turn into something like
# upload_paths = select({
# "@io_bazel_rules_go//go/platform:windows_386": {
# ...,"//:binary-artifacts-and-hashes": "bin/windows/386"},
# "@io_bazel_rules_go//go/platform:linux_ppc64le": {
# ...,"//:binary-artifacts-and-hashes": "bin/linux/ppc64le"},
#})
# and bazel will select the correct entry.
upload_paths = select(for_platforms(for_all = {
"//build/release-tars:release-tars-and-hashes": "",
"//cluster/gce/gci:gcs-release-artifacts-and-hashes": "extra/gce",
"//cluster/gce/windows:gcs-release-artifacts-and-hashes": "extra/gce/windows",
"//:_binary-artifacts-and-hashes": "bin/{OS}/{ARCH}",
})),
)
filegroup(
name = "package-srcs",
srcs = glob(
["**"],
exclude = [
"bazel-*/**",
"_*/**",
".config/**",
".git/**",
".gsutil/**",
".make/**",
],
),
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//api/openapi-spec:all-srcs",
"//build:all-srcs",
"//cluster:all-srcs",
"//cmd:all-srcs",
"//docs:all-srcs",
"//hack:all-srcs",
"//pkg:all-srcs",
"//plugin:all-srcs",
"//staging:all-srcs",
"//test:all-srcs",
"//third_party:all-srcs",
"//translations:all-srcs",
"//vendor:all-srcs",
],
tags = ["automanaged"],
)
genrule(
name = "save_git_version",
outs = ["version"],
cmd = "grep ^STABLE_BUILD_SCM_REVISION bazel-out/stable-status.txt | awk '{print $$2}' >$@",
stamp = 1,
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("//build:workspace_mirror.bzl", "mirror")
http_archive(
name = "bazel_skylib",
sha256 = "eb5c57e4c12e68c0c20bc774bfbc60a568e800d025557bc4ea022c6479acc867",
strip_prefix = "bazel-skylib-0.6.0",
urls = mirror("https://github.com/bazelbuild/bazel-skylib/archive/0.6.0.tar.gz"),
)
load("@bazel_skylib//lib:versions.bzl", "versions")
versions.check(minimum_bazel_version = "0.18.0")
http_archive(
name = "io_k8s_repo_infra",
sha256 = "2cc74219eafebb0af1e0cf80b9c2b78aac9aa570de762bfb82b83e9164be9da2",
strip_prefix = "repo-infra-b461270ab6ccfb94ff2d78df96d26f669376d660",
urls = mirror("https://github.com/kubernetes/repo-infra/archive/b461270ab6ccfb94ff2d78df96d26f669376d660.tar.gz"),
)
http_archive(
name = "io_bazel_rules_go",
sha256 = "f635b285d7e902ac7327637edbba98a4f110e8202c8f4fb49d2f6ecd837f704a",
urls = mirror("https://github.com/bazelbuild/rules_go/releases/download/0.18.9/rules_go-0.18.9.tar.gz"),
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(
go_version = "1.12.9",
)
http_archive(
name = "io_bazel_rules_docker",
sha256 = "aed1c249d4ec8f703edddf35cbe9dfaca0b5f5ea6e4cd9e83e99f3b0d1136c3d",
strip_prefix = "rules_docker-0.7.0",
urls = mirror("https://github.com/bazelbuild/rules_docker/archive/v0.7.0.tar.gz"),
)
load(
"@io_bazel_rules_docker//repositories:repositories.bzl",
container_repositories = "repositories",
)
container_repositories()
load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
container_pull(
name = "official_busybox",
digest = "sha256:cb63aa0641a885f54de20f61d152187419e8f6b159ed11a251a09d115fdff9bd",
registry = "index.docker.io",
repository = "library/busybox",
tag = "latest", # ignored, but kept here for documentation
)
load("//build:workspace.bzl", "release_dependencies")
release_dependencies()
load("//build:workspace_mirror.bzl", "export_urls")
export_urls("workspace_urls")
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/sysconfig/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
# The file is provided as part of the kubeadm package
net.ipv4.ip_forward = 1
package(default_visibility = ["//visibility:public"])
load("//build:platforms.bzl", "CLIENT_PLATFORMS", "NODE_PLATFORMS", "for_platforms")
load("//build:workspace.bzl", "CNI_VERSION", "CRI_TOOLS_VERSION")
load("@io_k8s_repo_infra//defs:build.bzl", "release_filegroup")
load("@io_k8s_repo_infra//defs:rpm.bzl", "pkg_rpm_for_goarch")
release_filegroup(
name = "rpms",
conditioned_srcs = for_platforms(
default = [],
for_client = [":kubectl.rpm"],
for_node = [
":cri-tools.rpm",
":kubeadm.rpm",
":kubelet.rpm",
":kubernetes-cni.rpm",
],
only_os = "linux",
),
tags = ["manual"],
visibility = ["//visibility:public"],
)
# Create genrules to copy the arch-specific RPMs to RPMs without the arch in their filename.
genrule(
name = "kubectl",
srcs = select(for_platforms(
for_client = [":kubectl-{ARCH}.rpm"],
only_os = "linux",
)),
outs = ["kubectl.rpm"],
cmd = "cp $< $@",
output_to_bindir = True,
)
[genrule(
name = pkg,
srcs = select(for_platforms(
for_client = [":%s-{ARCH}.rpm" % pkg],
only_os = "linux",
)),
outs = ["%s.rpm" % pkg],
cmd = "cp $< $@",
output_to_bindir = True,
) for pkg in [
"cri-tools",
"kubeadm",
"kubelet",
"kubernetes-cni",
]]
[pkg_rpm_for_goarch(
name = "kubectl",
changelog = "//:CHANGELOG.md",
data = [
"//cmd/kubectl",
],
goarch = arch,
spec_file = "kubectl.spec",
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in CLIENT_PLATFORMS["linux"]]
[pkg_rpm_for_goarch(
name = "kubelet",
changelog = "//:CHANGELOG.md",
data = [
"kubelet.service",
"//cmd/kubelet",
],
goarch = arch,
spec_file = "kubelet.spec",
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in NODE_PLATFORMS["linux"]]
[pkg_rpm_for_goarch(
name = "kubeadm",
changelog = "//:CHANGELOG.md",
data = [
"10-kubeadm.conf",
"50-kubeadm.conf",
"kubeadm.conf",
"kubelet.env",
"//cmd/kubeadm",
],
goarch = arch,
spec_file = "kubeadm.spec",
tags = ["manual"],
version_file = "//build:os_package_version",
) for arch in NODE_PLATFORMS["linux"]]
[pkg_rpm_for_goarch(
name = "kubernetes-cni",
changelog = "//:CHANGELOG.md",
data = [
"@kubernetes_cni_{GOARCH}//file",
],
goarch = arch,
spec_file = "kubernetes-cni.spec",
tags = ["manual"],
version = CNI_VERSION,
) for arch in NODE_PLATFORMS["linux"]]
[pkg_rpm_for_goarch(
name = "cri-tools",
data = [
"@cri_tools_{GOARCH}//file",
],
goarch = arch,
spec_file = "cri-tools.spec",
tags = ["manual"],
version = CRI_TOOLS_VERSION,
) for arch in NODE_PLATFORMS["linux"]]
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- luxas
- jbeda
- mikedanese
- pipejakob
- chuckha
- timothysc
approvers:
- luxas
- jbeda
- mikedanese
- pipejakob
- timothysc
Name: cri-tools
Version: OVERRIDE_THIS
Release: 00
License: ASL 2.0
Summary: Container Runtime Interface tools
URL: https://kubernetes.io
%description
Binaries to interface with the container runtime.
%prep
# This has to be hard coded because bazel does a path substitution before rpm's %{version} is substituted.
tar -xzf {cri_tools.tgz}
%install
install -m 755 -d %{buildroot}%{_bindir}
install -p -m 755 -t %{buildroot}%{_bindir} crictl
%files
%{_bindir}/crictl
# Load br_netfilter module at boot
br_netfilter
Name: kubeadm
Version: OVERRIDE_THIS
Release: 00
License: ASL 2.0
Summary: Container Cluster Manager - Kubernetes Cluster Bootstrapping Tool
Requires: kubelet >= 1.8.0
Requires: kubectl >= 1.8.0
Requires: kubernetes-cni >= 0.7.5
Requires: cri-tools >= 1.11.0
URL: https://kubernetes.io
%description
Command-line utility for deploying a Kubernetes cluster.
%install
install -m 755 -d %{buildroot}%{_bindir}
install -m 755 -d %{buildroot}%{_sysconfdir}/systemd/system/
install -m 755 -d %{buildroot}%{_sysconfdir}/systemd/system/kubelet.service.d/
install -m 755 -d %{buildroot}%{_sysconfdir}/sysconfig/
install -p -m 755 -t %{buildroot}%{_bindir} {kubeadm}
install -p -m 644 -t %{buildroot}%{_sysconfdir}/systemd/system/kubelet.service.d/ {10-kubeadm.conf}
install -p -m 644 -T {kubelet.env} %{buildroot}%{_sysconfdir}/sysconfig/kubelet
mkdir -p %{buildroot}%{_libexecdir}/modules-load.d
mkdir -p %{buildroot}/usr/lib/sysctl.d/
install -p -m 0644 -t %{buildroot}%{_libexecdir}/modules-load.d/ {kubeadm.conf}
install -p -m 0644 -t %{buildroot}/usr/lib/sysctl.d/ {50-kubeadm.conf}
%files
%{_bindir}/kubeadm
%{_sysconfdir}/systemd/system/kubelet.service.d/10-kubeadm.conf
%{_sysconfdir}/sysconfig/kubelet
%dir %{_libexecdir}/modules-load.d
%{_libexecdir}/modules-load.d/kubeadm.conf
/usr/lib/sysctl.d/50-kubeadm.conf
Name: kubectl
Version: OVERRIDE_THIS
Release: 00
License: ASL 2.0
Summary: Container Cluster Manager - Kubernetes client tools
URL: https://kubernetes.io
%description
Command-line utility for interacting with a Kubernetes cluster.
%install
install -m 755 -d %{buildroot}%{_bindir}
install -p -m 755 -t %{buildroot}%{_bindir} {kubectl}
%files
%{_bindir}/kubectl
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=http://kubernetes.io/docs/
[Service]
ExecStart=/usr/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target
Name: kubelet
Version: OVERRIDE_THIS
Release: 00
License: ASL 2.0
Summary: Container Cluster Manager - Kubernetes Node Agent
URL: https://kubernetes.io
Requires: conntrack
Requires: ebtables
Requires: ethtool
Requires: iproute
Requires: iptables >= 1.4.21
Requires: kubernetes-cni >= 0.7.5
Requires: socat
Requires: util-linux
%description
The node agent of Kubernetes, the container cluster manager.
%install
install -m 755 -d %{buildroot}%{_bindir}
install -m 755 -d %{buildroot}%{_sysconfdir}/systemd/system/
install -m 755 -d %{buildroot}%{_sysconfdir}/kubernetes/manifests/
install -p -m 755 -t %{buildroot}%{_bindir} {kubelet}
install -p -m 644 -t %{buildroot}%{_sysconfdir}/systemd/system/ {kubelet.service}
%files
%{_bindir}/kubelet
%attr(644,-,-) %{_sysconfdir}/systemd/system/kubelet.service
%{_sysconfdir}/kubernetes/manifests/
Name: kubernetes-cni
Version: OVERRIDE_THIS
Release: 00
License: ASL 2.0
Summary: Container Cluster Manager - CNI plugins
URL: https://kubernetes.io
%description
Binaries required to provision container networking.
%prep
mkdir -p ./bin
tar -C ./bin -xz -f {kubernetes_cni.tgz}
%install
install -m 755 -d %{buildroot}%{_sysconfdir}/cni/net.d/
install -m 755 -d %{buildroot}/opt/cni
mv bin/ %{buildroot}/opt/cni/
%files
/opt/cni
%{_sysconfdir}/cni/net.d/
#!/usr/bin/env bash
# Copyright 2014 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.
# Run a command in the docker build container. Typically this will be one of
# the commands in `hack/`. When running in the build container the user is sure
# to have a consistent reproducible build environment.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "$KUBE_ROOT/build/common.sh"
KUBE_RUN_COPY_OUTPUT="${KUBE_RUN_COPY_OUTPUT:-y}"
kube::build::verify_prereqs
kube::build::build_image
if [[ ${KUBE_RUN_COPY_OUTPUT} =~ ^[yY]$ ]]; then
kube::log::status "Output from this container will be rsynced out upon completion. Set KUBE_RUN_COPY_OUTPUT=n to disable."
else
kube::log::status "Output from this container will NOT be rsynced out upon completion. Set KUBE_RUN_COPY_OUTPUT=y to enable."
fi
kube::build::run_build_command "$@"
if [[ ${KUBE_RUN_COPY_OUTPUT} =~ ^[yY]$ ]]; then
kube::build::copy_output
fi
#!/usr/bin/env bash
# Copyright 2014 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.
# Run a bash script in the Docker build image.
#
# This container will have a snapshot of the current sources.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/build/common.sh"
KUBE_RUN_COPY_OUTPUT="${KUBE_RUN_COPY_OUTPUT:-n}" "${KUBE_ROOT}/build/run.sh" bash "$@"
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment