Skip to content

Commit

Permalink
Merge pull request #1094 from kubernetes-sigs/master
Browse files Browse the repository at this point in the history
Prepare v0.6.2
  • Loading branch information
k8s-ci-robot authored Aug 4, 2020
2 parents 5118ae5 + be832a1 commit ebb8f3f
Show file tree
Hide file tree
Showing 65 changed files with 1,565 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- please add a :running: (`:running:`) to the title of this PR, and delete this line and similar ones -->
<!-- please add a :seedling: (`:seedling:`) to the title of this PR, and delete this line and similar ones -->

<!-- What does this do, and why do we need it? -->
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- please add a icon to the title of this PR (see VERSIONING.md), and delete this line and similar ones -->
<!-- the icon will be either ⚠ (:warning:, major), ✨ (:sparkles, minor), 🐛 (:bug:, patch), 📖 (:book:, docs), or 🏃 (:running:, other) -->
<!-- the icon will be either ⚠ (:warning:, major), ✨ (:sparkles, minor), 🐛 (:bug:, patch), 📖 (:book:, docs), or 🌱 (:seedling:, other) -->

<!-- What does this do, and why do we need it? -->
3 changes: 1 addition & 2 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ aliases:
- gerred
- shawn-hurley
- joelanford
- alvaroaleman

# folks who can review and LGTM any PRs in the repo (doesn't
# include approvers & admins -- those count too via the OWNERS
# file)
controller-runtime-reviewers:
- alvaroaleman
- alenkacz
- vincepri
- alexeldeib
Expand All @@ -33,7 +33,6 @@ aliases:
testing-integration-approvers:
- apelisse
- hoegaarden
- totherme

# folks who may have context on ancient history,
# but are no longer directly involved
Expand Down
12 changes: 6 additions & 6 deletions VERSIONING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ a:
- Non-breaking feature: :sparkles: (`:sparkles:`)
- Patch fix: :bug: (`:bug:`)
- Docs: :book: (`:book:`)
- Infra/Tests/Other: :running: (`:running:`)
- Infra/Tests/Other: :seedling: (`:seedling:`)
- No release note: :ghost: (`:ghost:`)

Use :ghost: (no release note) only for the PRs that change or revert unreleased
Expand Down Expand Up @@ -156,7 +156,7 @@ after that.

3. Add a release for controller-runtime on GitHub, using those release
notes, with a title of `vX.Y.Z`.

4. Do a similar process for
[controller-tools](https://github.com/kubernetes-sigs/controller-tools)

Expand Down Expand Up @@ -210,10 +210,10 @@ converging on a ergonomic API.

- Users will intuitively see `List`, and use that in new projects, even
if it's marked as deprecated.

- Users who don't notice the deprecation may be confused as to the
difference between `List` and `ListParametric`.

- It's not immediately obvious in isolation (e.g. in surrounding code)
why the method is called `ListParametric`, and may cause confusion
when reading code that makes use of that method.
Expand All @@ -229,8 +229,8 @@ Development branches:

- don't win us much in terms of maintenance in the case of breaking
changes (we still have to merge/manage multiple branches for development
and stable)
and stable)

- can be confusing to contributors, who often expect master to have the
latest changes.

Expand Down
5 changes: 5 additions & 0 deletions alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ var (
// get any actual logging.
Log = log.Log

// LoggerFromContext returns a logger with predefined values from a context.Context.
//
// This is meant to be used with the context supplied in a struct that satisfies the Reconciler interface.
LoggerFromContext = log.FromContext

// SetLogger sets a concrete logging implementation for all deferred Loggers.
SetLogger = log.SetLogger
)
10 changes: 4 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ require (
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
gomodules.xyz/jsonpatch/v2 v2.0.1
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
k8s.io/api v0.18.4
k8s.io/apiextensions-apiserver v0.18.4
k8s.io/apimachinery v0.18.4
k8s.io/client-go v0.18.4
k8s.io/api v0.18.6
k8s.io/apiextensions-apiserver v0.18.6
k8s.io/apimachinery v0.18.6
k8s.io/client-go v0.18.6
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451
sigs.k8s.io/yaml v1.2.0
)

replace github.com/evanphx/json-patch => github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8
27 changes: 14 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8 h1:DM7gHzQfHwIj+St8zaPOI6iQEPAxOwIkskvw6s9rDaM=
github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8/go.mod h1:pmLOTb3x90VhIKxsA9yeQG5yfOkkKnkk1h+Ql8NDYDw=
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M=
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
Expand Down Expand Up @@ -498,17 +499,17 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.18.4 h1:8x49nBRxuXGUlDlwlWd3RMY1SayZrzFfxea3UZSkFw4=
k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4=
k8s.io/apiextensions-apiserver v0.18.4 h1:Y3HGERmS8t9u12YNUFoOISqefaoGRuTc43AYCLzWmWE=
k8s.io/apiextensions-apiserver v0.18.4/go.mod h1:NYeyeYq4SIpFlPxSAB6jHPIdvu3hL0pc36wuRChybio=
k8s.io/apimachinery v0.18.4 h1:ST2beySjhqwJoIFk6p7Hp5v5O0hYY6Gngq/gUYXTPIA=
k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/apiserver v0.18.4/go.mod h1:q+zoFct5ABNnYkGIaGQ3bcbUNdmPyOCoEBcg51LChY8=
k8s.io/client-go v0.18.4 h1:un55V1Q/B3JO3A76eS0kUSywgGK/WR3BQ8fHQjNa6Zc=
k8s.io/client-go v0.18.4/go.mod h1:f5sXwL4yAZRkAtzOxRWUhA/N8XzGCb+nPZI8PfobZ9g=
k8s.io/code-generator v0.18.4/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
k8s.io/component-base v0.18.4/go.mod h1:7jr/Ef5PGmKwQhyAz/pjByxJbC58mhKAhiaDu0vXfPk=
k8s.io/api v0.18.6 h1:osqrAXbOQjkKIWDTjrqxWQ3w0GkKb1KA1XkUGHHYpeE=
k8s.io/api v0.18.6/go.mod h1:eeyxr+cwCjMdLAmr2W3RyDI0VvTawSg/3RFFBEnmZGI=
k8s.io/apiextensions-apiserver v0.18.6 h1:vDlk7cyFsDyfwn2rNAO2DbmUbvXy5yT5GE3rrqOzaMo=
k8s.io/apiextensions-apiserver v0.18.6/go.mod h1:lv89S7fUysXjLZO7ke783xOwVTm6lKizADfvUM/SS/M=
k8s.io/apimachinery v0.18.6 h1:RtFHnfGNfd1N0LeSrKCUznz5xtUP1elRGvHJbL3Ntag=
k8s.io/apimachinery v0.18.6/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/apiserver v0.18.6/go.mod h1:Zt2XvTHuaZjBz6EFYzpp+X4hTmgWGy8AthNVnTdm3Wg=
k8s.io/client-go v0.18.6 h1:I+oWqJbibLSGsZj8Xs8F0aWVXJVIoUHWaaJV3kUN/Zw=
k8s.io/client-go v0.18.6/go.mod h1:/fwtGLjYMS1MaM5oi+eXhKwG+1UHidUEXRh6cNsdO0Q=
k8s.io/code-generator v0.18.6/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
k8s.io/component-base v0.18.6/go.mod h1:knSVsibPR5K6EW2XOjEHik6sdU5nCvKMrzMt2D4In14=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
Expand Down
66 changes: 8 additions & 58 deletions hack/check-everything.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,72 +14,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
set -o errexit
set -o nounset
set -o pipefail

hack_dir=$(dirname ${BASH_SOURCE})
source ${hack_dir}/common.sh

k8s_version=1.16.4
goarch=amd64
goos="unknown"

if [[ "$OSTYPE" == "linux-gnu" ]]; then
goos="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
goos="darwin"
fi

if [[ "$goos" == "unknown" ]]; then
echo "OS '$OSTYPE' not supported. Aborting." >&2
exit 1
fi
source ${hack_dir}/setup-envtest.sh

tmp_root=/tmp
kb_root_dir=$tmp_root/kubebuilder

# Skip fetching and untaring the tools by setting the SKIP_FETCH_TOOLS variable
# in your environment to any value:
#
# $ SKIP_FETCH_TOOLS=1 ./check-everything.sh
#
# If you skip fetching tools, this script will use the tools already on your
# machine, but rebuild the kubebuilder and kubebuilder-bin binaries.
SKIP_FETCH_TOOLS=${SKIP_FETCH_TOOLS:-""}

# fetch k8s API gen tools and make it available under kb_root_dir/bin.
function fetch_kb_tools {
local dest_dir="${1}"

# use the pre-existing version in the temporary folder if it matches our k8s version
if [[ -x "${dest_dir}/kubebuilder/bin/kube-apiserver" ]]; then
version=$("${dest_dir}"/kubebuilder/bin/kube-apiserver --version)
if [[ $version == *"${k8s_version}"* ]]; then
header_text "Using cached kubebuilder-tools from ${dest_dir}"
return 0
fi
fi

header_text "fetching tools (into '${dest_dir}')"
kb_tools_archive_name="kubebuilder-tools-$k8s_version-$goos-$goarch.tar.gz"
kb_tools_download_url="https://storage.googleapis.com/kubebuilder-tools/$kb_tools_archive_name"

kb_tools_archive_path="$tmp_root/$kb_tools_archive_name"
if [ ! -f $kb_tools_archive_path ]; then
curl -sL ${kb_tools_download_url} -o "$kb_tools_archive_path"
fi

mkdir -p "${dest_dir}"
tar -C "${dest_dir}" --strip-components=1 -zvxf "$kb_tools_archive_path"
}

header_text "using tools"

if [ -z "$SKIP_FETCH_TOOLS" ]; then
fetch_kb_tools "$kb_root_dir"
fetch_kb_tools "${hack_dir}/../pkg/internal/testing/integration/assets"
fi
ENVTEST_K8S_VERSION=${ENVTEST_K8S_VERSION:-"1.16.4"}

setup_envs
fetch_envtest_tools "$kb_root_dir"
fetch_envtest_tools "${hack_dir}/../pkg/internal/testing/integration/assets"
setup_envtest_env "$kb_root_dir"

${hack_dir}/verify.sh
${hack_dir}/test-all.sh
Expand Down
9 changes: 0 additions & 9 deletions hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,3 @@ fi
function header_text {
echo "$header$*$reset"
}

function setup_envs {
header_text "setting up env vars"

# Setup env vars
if [[ -z "${KUBEBUILDER_ASSETS}" ]]; then
export KUBEBUILDER_ASSETS=$kb_root_dir/bin
fi
}
8 changes: 6 additions & 2 deletions hack/release/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ cr_minor_pattern=":sparkles:|$(printf "\xe2\x9c\xa8")"
cr_patch_pattern=":bug:|$(printf "\xf0\x9f\x90\x9b")"
cr_docs_pattern=":book:|$(printf "\xf0\x9f\x93\x96")"
cr_no_release_note_pattern=":ghost:|$(printf "\xf0\x9f\x91\xbb")"
cr_other_pattern=":running:|$(printf "\xf0\x9f\x8f\x83")"
cr_all_pattern="${cr_major_pattern}|${cr_minor_pattern}|${cr_patch_pattern}|${cr_docs_pattern}|${cr_other_pattern}"
cr_other_pattern=":seedling:|$(printf "\xf0\x9f\x8f\x83")"
cr_other_old_pattern=":running:|$(printf "\xf0\x9f\x8f\x83")"
cr_all_pattern="${cr_major_pattern}|${cr_minor_pattern}|${cr_patch_pattern}|${cr_docs_pattern}|${cr_other_old_pattern}|${cr_other_pattern}"

# cr::symbol-type-raw turns :xyz: and the corresponding emoji
# into one of "major", "minor", "patch", "docs", "other", or
Expand All @@ -32,6 +33,9 @@ cr::symbol-type-raw() {
@(${cr_other_pattern})?('!'))
echo "other"
;;
@(${cr_other_old_pattern})?('!'))
echo "other"
;;
*)
echo "unknown"
;;
Expand Down
96 changes: 96 additions & 0 deletions hack/setup-envtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env bash

# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o pipefail

# Turn colors in this script off by setting the NO_COLOR variable in your
# environment to any value:
#
# $ NO_COLOR=1 test.sh
NO_COLOR=${NO_COLOR:-""}
if [ -z "$NO_COLOR" ]; then
header=$'\e[1;33m'
reset=$'\e[0m'
else
header=''
reset=''
fi

function header_text {
echo "$header$*$reset"
}

function setup_envtest_env {
header_text "setting up env vars"

# Setup env vars
KUBEBUILDER_ASSETS=${KUBEBUILDER_ASSETS:-""}
if [[ -z "${KUBEBUILDER_ASSETS}" ]]; then
export KUBEBUILDER_ASSETS=$1/bin
fi
}

# fetch k8s API gen tools and make it available under envtest_root_dir/bin.
#
# Skip fetching and untaring the tools by setting the SKIP_FETCH_TOOLS variable
# in your environment to any value:
#
# $ SKIP_FETCH_TOOLS=1 ./check-everything.sh
#
# If you skip fetching tools, this script will use the tools already on your
# machine.
function fetch_envtest_tools {
SKIP_FETCH_TOOLS=${SKIP_FETCH_TOOLS:-""}
if [ -n "$SKIP_FETCH_TOOLS" ]; then
return 0
fi

tmp_root=/tmp
envtest_root_dir=$tmp_root/envtest

k8s_version="${ENVTEST_K8S_VERSION:-1.16.4}"
goarch="$(go env GOARCH)"
goos="$(go env GOOS)"

if [[ "$goos" != "linux" && "$goos" != "darwin" ]]; then
echo "OS '$goos' not supported. Aborting." >&2
return 1
fi

local dest_dir="${1}"

# use the pre-existing version in the temporary folder if it matches our k8s version
if [[ -x "${dest_dir}/bin/kube-apiserver" ]]; then
version=$("${dest_dir}"/bin/kube-apiserver --version)
if [[ $version == *"${k8s_version}"* ]]; then
header_text "Using cached envtest tools from ${dest_dir}"
return 0
fi
fi

header_text "fetching envtest tools@${k8s_version} (into '${dest_dir}')"
envtest_tools_archive_name="kubebuilder-tools-$k8s_version-$goos-$goarch.tar.gz"
envtest_tools_download_url="https://storage.googleapis.com/kubebuilder-tools/$envtest_tools_archive_name"

envtest_tools_archive_path="$tmp_root/$envtest_tools_archive_name"
if [ ! -f $envtest_tools_archive_path ]; then
curl -sL ${envtest_tools_download_url} -o "$envtest_tools_archive_path"
fi

mkdir -p "${dest_dir}"
tar -C "${dest_dir}" --strip-components=1 -zvxf "$envtest_tools_archive_path"
}
17 changes: 3 additions & 14 deletions hack/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,10 @@ set -e

source $(dirname ${BASH_SOURCE})/common.sh

setup_envs

header_text "running go test"

# TODO(directxman12): enable the race detector once the LeaderElector race condition is resolved in client-go
go test ${MOD_OPT} ./... -parallel 4

header_text "running coverage"
go test -race ${MOD_OPT} ./...

# Verify no coverage regressions have been introduced. Remove the exception list from here
# once the coverage has been brought back up
if [[ ! $(go test ${MOD_OPT} ./pkg/... -coverprofile cover.out -parallel 4 | grep -v "coverage: 100.0% of statements" | grep "controller-runtime/pkg " | grep -v "controller-runtime/pkg \|controller-runtime/pkg/recorder \|pkg/cache\|pkg/client \|pkg/event \|pkg/client/config \|pkg/controller/controllertest \|pkg/reconcile/reconciletest \|pkg/test ") ]]; then
echo "ok"
else
go test ${MOD_OPT} ./pkg/... -coverprofile cover.out -parallel 4 | grep -v "coverage: 100.0% of statements" | grep "controller-runtime/pkg " | grep -v "controller-runtime/pkg \|controller-runtime/pkg/recorder \|pkg/cache\|pkg/client \|pkg/event \|pkg/client/config \|pkg/controller/controllertest \|pkg/reconcile/reconciletest \|pkg/test "
echo "missing test coverage"
exit 1
if [[ -n ${ARTIFACTS:-} ]]; then
if grep -Rin '<failure type="Failure">' ${ARTIFACTS}/*; then exit 1; fi
fi
3 changes: 2 additions & 1 deletion pkg/builder/builder_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import (

func TestBuilder(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t, "application Suite", []Reporter{printer.NewlineReporter{}})
suiteName := "application Suite"
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
}

var testenv *envtest.Environment
Expand Down
Loading

0 comments on commit ebb8f3f

Please sign in to comment.