mirror of https://github.com/kubernetes/kops.git
Remove remaining bazel references
This commit is contained in:
parent
275264ac06
commit
5368c55567
|
@ -1,5 +1,4 @@
|
|||
**/zz_generated.*.go linguist-generated=true
|
||||
BUILD.bazel linguist-generated=true
|
||||
/docs/cli/** linguist-generated=true
|
||||
/protokube/pkg/gossip/mesh/mesh.pb.go linguist-generated=true
|
||||
/protokube/pkg/gossip/mesh/mesh.proto linguist-generated=true
|
||||
|
|
|
@ -62,24 +62,11 @@ network_closure.sh
|
|||
|
||||
# build stuff
|
||||
.build
|
||||
.bazelbuild
|
||||
|
||||
# Ignore all Exhuberant Ctags files
|
||||
# Removed for now - we have a package named tags
|
||||
# tags
|
||||
|
||||
# Bazel output directories
|
||||
# bazel-bin is now a symlink to .bazel-bin
|
||||
bazel-genfiles
|
||||
bazel-kops
|
||||
bazel-out
|
||||
bazel-testlogs
|
||||
.bazel-bin
|
||||
.bazel-genfiles
|
||||
.bazel-kops
|
||||
.bazel-out
|
||||
.bazel-testlogs
|
||||
|
||||
# Ignore default apiserver config
|
||||
apiserver.local.config
|
||||
|
||||
|
|
3
Makefile
3
Makefile
|
@ -250,7 +250,6 @@ gcs-upload-and-tag: gsutil gcs-upload
|
|||
|
||||
# gcs-publish-ci is the entry point for CI testing
|
||||
# In CI testing, always upload the CI version.
|
||||
# The last copy part is to satisfy kubetest2 path expectations
|
||||
.PHONY: gcs-publish-ci
|
||||
gcs-publish-ci: VERSION := ${KOPS_CI_VERSION}+${GITSHA}
|
||||
gcs-publish-ci: gsutil version-dist-ci
|
||||
|
@ -259,8 +258,6 @@ gcs-publish-ci: gsutil version-dist-ci
|
|||
echo "VERSION: ${VERSION}"
|
||||
echo "${GCS_URL}/${VERSION}" > ${UPLOAD}/${LATEST_FILE}
|
||||
gsutil -h "Cache-Control:private, max-age=0, no-transform" cp ${UPLOAD}/${LATEST_FILE} ${GCS_LOCATION}
|
||||
mkdir -p .bazel-bin/cmd/kops/linux-amd64/
|
||||
cp ${DIST}/linux/amd64/kops .bazel-bin/cmd/kops/linux-amd64/
|
||||
|
||||
.PHONY: gen-cli-docs
|
||||
gen-cli-docs: kops # Regenerate CLI docs
|
||||
|
|
126
WORKSPACE
126
WORKSPACE
|
@ -1,126 +0,0 @@
|
|||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
|
||||
#=============================================================================
|
||||
# Go rules
|
||||
|
||||
http_archive(
|
||||
name = "io_bazel_rules_go",
|
||||
sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
|
||||
"https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
|
||||
],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "bazel_gazelle",
|
||||
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
|
||||
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.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.17.5",
|
||||
)
|
||||
|
||||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
|
||||
|
||||
gazelle_dependencies()
|
||||
|
||||
#=============================================================================
|
||||
# Docker rules
|
||||
|
||||
http_archive(
|
||||
name = "io_bazel_rules_docker",
|
||||
sha256 = "92779d3445e7bdc79b961030b996cb0c91820ade7ffa7edca69273f404b085d5",
|
||||
strip_prefix = "rules_docker-0.20.0",
|
||||
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.20.0/rules_docker-v0.20.0.tar.gz"],
|
||||
)
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_docker//repositories:repositories.bzl",
|
||||
container_repositories = "repositories",
|
||||
)
|
||||
|
||||
container_repositories()
|
||||
|
||||
load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")
|
||||
|
||||
container_deps()
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_docker//repositories:go_repositories.bzl",
|
||||
docker_go_deps = "go_deps",
|
||||
)
|
||||
|
||||
docker_go_deps()
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_docker//container:container.bzl",
|
||||
"container_pull",
|
||||
)
|
||||
|
||||
# TODO(fejta): use load.bzl, repos.bzl from repo-infra
|
||||
git_repository(
|
||||
name = "io_k8s_repo_infra",
|
||||
commit = "db6ceb5f992254db76af7c25db2edc5469b5ea82",
|
||||
remote = "https://github.com/kubernetes/repo-infra.git",
|
||||
shallow_since = "1570128715 -0700",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "bazel_toolchains",
|
||||
sha256 = "179ec02f809e86abf56356d8898c8bd74069f1bd7c56044050c2cd3d79d0e024",
|
||||
strip_prefix = "bazel-toolchains-4.1.0",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz",
|
||||
"https://github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz",
|
||||
],
|
||||
)
|
||||
|
||||
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
|
||||
|
||||
rbe_autoconfig(name = "rbe_default")
|
||||
|
||||
go_repository(
|
||||
name = "com_github_google_go_containerregistry",
|
||||
importpath = "github.com/google/go-containerregistry",
|
||||
sum = "h1:PTrxTL8TNRbZts4KqdJMsqRlrdjoiKFDq6MVitj8mPk=",
|
||||
version = "v0.0.0-20190829181151-21b2e01cec04",
|
||||
)
|
||||
|
||||
# Start using distroless base
|
||||
container_pull(
|
||||
name = "distroless_base_amd64",
|
||||
digest = "sha256:ba7a315f86771332e76fa9c3d423ecfdbb8265879c6f1c264d6fff7d4fa460a4",
|
||||
registry = "gcr.io",
|
||||
repository = "distroless/base",
|
||||
)
|
||||
|
||||
container_pull(
|
||||
name = "distroless_base_arm64",
|
||||
digest = "sha256:4f8aa0aba190e375a5a53bb71a303c89d9734c817714aeaca9bb23b82135ed91",
|
||||
registry = "gcr.io",
|
||||
repository = "distroless/base",
|
||||
)
|
||||
|
||||
container_pull(
|
||||
name = "distroless_base_debug_amd64",
|
||||
digest = "sha256:efd8711717d9e9b5d0dbb20ea10876dab0609c923bc05321b912f9239090ca80",
|
||||
registry = "gcr.io",
|
||||
repository = "distroless/base",
|
||||
)
|
||||
|
||||
container_pull(
|
||||
name = "distroless_base_debug_arm64",
|
||||
digest = "sha256:3aaeedaad3046eb02e90108150f3f754785d7baf635d263268328d64662df919",
|
||||
registry = "gcr.io",
|
||||
repository = "distroless/base",
|
||||
)
|
|
@ -237,7 +237,7 @@ and then push nodeup using:
|
|||
export S3_BUCKET_NAME=<yourbucketname>
|
||||
make kops-install dev-upload UPLOAD_DEST=s3://${S3_BUCKET_NAME}
|
||||
|
||||
KOPS_VERSION=`bazelisk run //cmd/kops version -- --short`
|
||||
KOPS_VERSION=`.build/dist/$(go env GOOS)/$(go env GOARCH)/kops version -- --short`
|
||||
export KOPS_BASE_URL=https://${S3_BUCKET_NAME}.s3.amazonaws.com/kops/${KOPS_VERSION}/
|
||||
export KOPS_ARCH=amd64
|
||||
kops create cluster <clustername> --zones us-east-1b
|
||||
|
@ -249,7 +249,7 @@ If you have changed the dns or kOps controllers, you would want to test them as
|
|||
For dns-controller:
|
||||
|
||||
```bash
|
||||
KOPS_VERSION=`bazelisk run //cmd/kops version -- --short`
|
||||
KOPS_VERSION=`.build/dist/$(go env GOOS)/$(go env GOARCH)/kops version -- --short`
|
||||
export DOCKER_IMAGE_PREFIX=${USER}/
|
||||
export DOCKER_REGISTRY=
|
||||
make dns-controller-push
|
||||
|
@ -259,7 +259,7 @@ export DNSCONTROLLER_IMAGE=${DOCKER_IMAGE_PREFIX}dns-controller:${KOPS_VERSION}
|
|||
For kops-controller:
|
||||
|
||||
```bash
|
||||
KOPS_VERSION=`bazelisk run //cmd/kops version -- --short`
|
||||
KOPS_VERSION=`.build/dist/$(go env GOOS)/$(go env GOARCH)/kops version -- --short`
|
||||
export DOCKER_IMAGE_PREFIX=${USER}/
|
||||
export DOCKER_REGISTRY=
|
||||
make kops-controller-push
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
# Bazel builds
|
||||
|
||||
## Overview
|
||||
|
||||
Building with Bazel offers a deterministic, faster build, including creating smaller container images.
|
||||
|
||||
While bazel works well for small projects, building with kubernetes still has a few challenges. We take the following approach:
|
||||
|
||||
* We use [Bazelisk](https://github.com/bazelbuild/bazelisk), which automatically picks the correct version of Bazel for a branch
|
||||
* We don't yet generate files in bazel - we use external scripts (for now)
|
||||
* We vendor our dependencies, rather than relying on gazelle (although actually gazelle works, the issue is when external dependencies like apimachinery include bazel files that confuse gazelle)
|
||||
* We strip bazel files from external dependencies, so we don't confuse gazelle
|
||||
|
||||
## How to run
|
||||
|
||||
```
|
||||
make bazel-build
|
||||
make bazel-build-cli
|
||||
|
||||
# To build end to end and upload to s3
|
||||
make bazel-upload
|
||||
```
|
||||
|
||||
Test:
|
||||
```
|
||||
make bazel-test
|
||||
```
|
||||
|
||||
Regenerate bazel files using gazelle:
|
||||
```
|
||||
make gazelle
|
||||
```
|
||||
|
||||
## Other changes needed
|
||||
|
||||
* By default the `go_test` command doesn't allow tests to use data. So we need to use `data = glob(["testdata/**"]),` or similar. We add `# keep` to stop gazelle from removing it. `data` doesn't make it easy to access files in a parent directory, so we'll have to clean up some of the test / package structure.
|
|
@ -1,13 +1,5 @@
|
|||
## Checklist for a new kubernetes version
|
||||
|
||||
### Update bazel rules_go / rules_docker / gazelle etc
|
||||
|
||||
### Run gazelle
|
||||
|
||||
```bash
|
||||
make gazelle
|
||||
```
|
||||
|
||||
### Check go version used in k/k
|
||||
|
||||
### Update base images
|
||||
|
|
|
@ -49,7 +49,7 @@ kubetest2 kops \
|
|||
--test \
|
||||
--cloud-provider=aws \
|
||||
--cluster-name=my.testcluster.com \
|
||||
--kops-binary-path=${KOPS_ROOT}/.bazel-bin/cmd/kops/linux-amd64/kops \
|
||||
--kops-binary-path=${KOPS_ROOT}/.build/dist/$(go env GOOS)/$(go env GOARCH)/kops \
|
||||
--kubernetes-version=v1.20.2 \
|
||||
--test=kops \
|
||||
-- \
|
||||
|
@ -73,7 +73,7 @@ kubetest2 kops \
|
|||
--cloud-provider=aws \
|
||||
--cluster-name=my.testcluster.com \
|
||||
--create-args="--networking calico" \
|
||||
--kops-binary-path=${KOPS_ROOT}/.bazel-bin/cmd/kops/linux-amd64/kops \
|
||||
--kops-binary-path=${KOPS_ROOT}/.build/dist/$(go env GOOS)/$(go env GOARCH)/kops \
|
||||
--kubernetes-version=v1.20.2 \
|
||||
--test=kops \
|
||||
--
|
||||
|
@ -99,7 +99,7 @@ kubetest2 kops \
|
|||
--up \
|
||||
--cloud-provider=aws \
|
||||
--cluster-name=my.testcluster.com \
|
||||
--kops-binary-path=${KOPS_ROOT}/.bazel-bin/cmd/kops/linux-amd64/kops \
|
||||
--kops-binary-path=${KOPS_ROOT}/.build/dist/$(go env GOOS)/$(go env GOARCH)/kops \
|
||||
--kubernetes-version=v1.20.2 \
|
||||
--template-path=my.testcluster.com.yaml \
|
||||
--test=kops \
|
||||
|
|
|
@ -148,7 +148,6 @@ nav:
|
|||
- Low level description on how kOps works: "contributing/how_it_works.md"
|
||||
- Notes on Gossip design: "contributing/gossip.md"
|
||||
- Notes on master instance sizing: "contributing/instancesizes.md"
|
||||
- Bazel: "contributing/bazel.md"
|
||||
- Vendoring: "contributing/vendoring.md"
|
||||
- Ports: "contributing/ports.md"
|
||||
- Cluster Addons & Manager : "contributing/addons.md"
|
||||
|
|
|
@ -28,7 +28,7 @@ const (
|
|||
AWSAuthenticator = 10000
|
||||
|
||||
// KopsControllerID is the user id for kops-controller, which needs some extra permissions e.g. to write local logs
|
||||
// This should match the user in cmd/kops-controller/BUILD.bazel
|
||||
// This should match the kops-controller DaemonSet's runAsUser
|
||||
KopsControllerID = 10011
|
||||
|
||||
// KopsControllerName is the username for the kops-controller user
|
||||
|
@ -36,7 +36,7 @@ const (
|
|||
|
||||
// KubeApiserverHealthcheckID is the user id for kube-apiserver-healthcheck sidecar
|
||||
// The user needs some extra permissions e.g. to read local secrets
|
||||
// This should match the user in cmd/kube-apiserver-healthcheck/BUILD.bazel
|
||||
// This should match the static pod's runAsUser
|
||||
KubeApiserverHealthcheckID = 10012
|
||||
|
||||
// KubeApiserverHealthcheckName is the username for the kube-apiserver-healthcheck user
|
||||
|
|
|
@ -21,9 +21,10 @@ set -o xtrace
|
|||
|
||||
export KOPS_FEATURE_FLAGS="SpecOverrideFlag,${KOPS_FEATURE_FLAGS:-}"
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel);
|
||||
PATH=$REPO_ROOT/.bazel-bin/cmd/kops/$(go env GOOS)-$(go env GOARCH):$PATH
|
||||
KOPSPATH=$REPO_ROOT/.build/dist/$(go env GOOS)/$(go env GOARCH)
|
||||
PATH=$KOPSPATH:$PATH
|
||||
|
||||
KUBETEST2_COMMON_ARGS="-v=2 --cloud-provider=digitalocean --cluster-name=e2e-test-do.k8s.local --kops-binary-path=${REPO_ROOT}/.bazel-bin/cmd/kops/linux-amd64/kops"
|
||||
KUBETEST2_COMMON_ARGS="-v=2 --cloud-provider=digitalocean --cluster-name=e2e-test-do.k8s.local --kops-binary-path=${KOPSPATH}/kops"
|
||||
KUBETEST2_COMMON_ARGS="${KUBETEST2_COMMON_ARGS} --admin-access=${ADMIN_ACCESS:-}"
|
||||
|
||||
export GO111MODULE=on
|
||||
|
|
Loading…
Reference in New Issue