Skip to content

Commit

Permalink
Merge pull request #971 from jnummelin/cherry-picks-for-june-release
Browse files Browse the repository at this point in the history
Cherry picks for June release
  • Loading branch information
jnummelin authored Jun 17, 2021
2 parents c80fabd + b9b04e7 commit 574215c
Show file tree
Hide file tree
Showing 169 changed files with 4,360 additions and 2,924 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/check-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ on:
prNumber:
description: PR against which to this workflow
required: false

schedule:
- cron: "0 23 * * *"

jobs:
terraform:
env:
Expand Down Expand Up @@ -98,3 +96,13 @@ jobs:
export TF_VAR_cluster_name=$(cat CLUSTER_NAME)
terraform destroy -auto-approve
if: ${{ always() }}

- name: slack notify
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
uses: 8398a7/action-slack@v3
with:
job_name: "K8s Network Conformance Testing"
status: ${{ job.status }}
fields: workflow,ref,commit,author,job,took # selectable (default: repo,message)
if: ${{ always() }} # Pick up events even if the job fails or is canceled.
69 changes: 16 additions & 53 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,24 @@
name: Publish docs via GitHub Pages
name: Lint docs

on:
push:
branches:
- main
release:
types:
- published
- release-*
paths:
- '**.md'
pull_request:
branches:
- main
- release-*
paths:
- '**.md'
jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
name: Deploy docs
lint:
name: Lint markdown
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- name: Set up Python 3.7
uses: actions/setup-python@v2
- uses: actions/checkout@v1
- uses: articulate/actions-markdownlint@v1
with:
python-version: '3.x'
- name: Checkout deps
uses: actions/checkout@v2
with:
repository: lensapp/mkdocs-material-insiders
token: ${{ env.GITHUB_TOKEN }}
path: mkdocs-material-insiders

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip -v --log /tmp/pip.log install ./mkdocs-material-insiders
pip install mike
- name: Checkout K0s release
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: mkdocs deploy main
if: contains(github.ref, 'refs/heads/main')
run: |
mike deploy --push main
- name: Get the release version
if: contains(github.ref, 'refs/tags/v') && !github.event.release.prerelease # (don't generate for pre-releases)
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: mkdocs deploy new release
if: contains(github.ref, 'refs/tags/v') && !github.event.release.prerelease # (don't generate for pre-releases)
run: |
mike deploy --push --update-aliases ${{ steps.get_version.outputs.VERSION }} latest
mike set-default --push ${{ steps.get_version.outputs.VERSION }}
config: .github/workflows/markdownlint-config.json
61 changes: 61 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,36 @@ jobs:
path: |
/tmp/*.log
smoketest-ctr-command:
name: Smoke test for 'k0s ctr' command
needs: build
runs-on: ubuntu-latest

steps:
- name: Get PR Reference and Set Cache Name
run: |
PR_NUMBER=$(echo ${GITHUB_REF} | cut -d / -f 3 )
echo "cachePrefix=k0s-${PR_NUMBER}-${{ github.sha }}" >> $GITHUB_ENV
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Cache compiled binary for smoke testing
uses: actions/cache@v2
id: restore-compiled-binary
with:
path: |
k0s
key: build-${{env.cachePrefix}}

- name: Run test .
run: make -C inttest check-ctr

- name: Collect test logs
if: failure()
uses: actions/upload-artifact@v2
with:
path: |
/tmp/*.log
smoketest-hacontrolplane:
name: Smoke test for HA controlplane operations
Expand Down Expand Up @@ -593,6 +623,37 @@ jobs:
path: |
/tmp/*.log
smoketest-metrics:
name: Smoke test metrics server
needs: build
runs-on: ubuntu-latest

steps:
- name: Get PR Reference and Set Cache Name
run: |
PR_NUMBER=$(echo ${GITHUB_REF} | cut -d / -f 3 )
echo "cachePrefix=k0s-${PR_NUMBER}-${{ github.sha }}" >> $GITHUB_ENV
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Cache compiled binary for smoke testing
uses: actions/cache@v2
id: restore-compiled-binary
with:
path: |
k0s
key: build-${{env.cachePrefix}}

- name: Run metrics server test
run: make -C inttest check-metrics

- name: Collect test logs
if: failure()
uses: actions/upload-artifact@v2
with:
path: |
/tmp/*.log
smoketest-arm:
name: Smoke test on arm64
runs-on: [self-hosted,linux,arm64]
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/markdownlint-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"default": true,
"line_length": false,
"no-bare-urls": false,
"first-line-h1": false,
"single-trailing-newline": false,
"ol-prefix": "one_or_ordered"
}
61 changes: 61 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish docs via GitHub Pages
on:
push:
branches:
- main
release:
types:
- published
jobs:
build:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
name: Deploy docs
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Checkout deps
uses: actions/checkout@v2
with:
repository: lensapp/mkdocs-material-insiders
token: ${{ env.GITHUB_TOKEN }}
path: mkdocs-material-insiders

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip -v --log /tmp/pip.log install ./mkdocs-material-insiders
pip install mike
- name: Checkout K0s release
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Using Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: mkdocs deploy main
if: contains(github.ref, 'refs/heads/main')
run: |
mike deploy --push main
- name: Get the release version
if: contains(github.ref, 'refs/tags/v') && !github.event.release.prerelease # (don't generate for pre-releases)
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: mkdocs deploy new release
if: contains(github.ref, 'refs/tags/v') && !github.event.release.prerelease # (don't generate for pre-releases)
run: |
mike deploy --push --update-aliases ${{ steps.get_version.outputs.VERSION }} latest
mike set-default --push ${{ steps.get_version.outputs.VERSION }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ bindata*
aws_private.pem
out.json
.vscode
static/gen_manifests.go
static/gen_manifests.go
.k0sbuild.docker-image.*
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# k0s Community Code Of Conduct

Please refer to our [contributor code of conduct](contributors/CODE_OF_CONDUCT.md).
Please refer to our [contributor code of conduct](contributors/CODE_OF_CONDUCT.md).
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# K0s Contributor Guide
Our contributor's guide can be found [here](docs/contributors/overview.md).

Please refer to our [contributor's guide](docs/contributors/overview.md).
30 changes: 24 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ EMBEDDED_BINS_BUILDMODE ?= docker
TARGET_OS ?= linux
GOARCH ?= $(shell go env GOARCH)
GOPATH ?= $(shell go env GOPATH)
BUILD_GO_FLAGS :=
BUILD_GO_CGO_ENABLED ?= 0
BUILD_GO_LDFLAGS_EXTRA :=
DEBUG ?= false

VERSION ?= $(shell git describe --tags)
Expand All @@ -33,14 +36,14 @@ LD_FLAGS += -X github.com/k0sproject/k0s/pkg/build.KubernetesVersion=$(kubernete
LD_FLAGS += -X github.com/k0sproject/k0s/pkg/build.KineVersion=$(kine_version)
LD_FLAGS += -X github.com/k0sproject/k0s/pkg/build.EtcdVersion=$(etcd_version)
LD_FLAGS += -X github.com/k0sproject/k0s/pkg/build.KonnectivityVersion=$(konnectivity_version)
LD_FLAGS += -X \"github.com/k0sproject/k0s/pkg/build.EulaNotice=$(EULA_NOTICE)\"
LD_FLAGS += -X "github.com/k0sproject/k0s/pkg/build.EulaNotice=$(EULA_NOTICE)"
LD_FLAGS += -X github.com/k0sproject/k0s/pkg/telemetry.segmentToken=$(SEGMENT_TOKEN)
LD_FLAGS += -X k8s.io/component-base/version.gitVersion="v$(KUBECTL_VERSION)"
LD_FLAGS += -X k8s.io/component-base/version.gitMajor="$(KUBECTL_MAJOR)"
LD_FLAGS += -X k8s.io/component-base/version.gitMinor="$(KUBECTL_MINOR)"
LD_FLAGS += -X k8s.io/component-base/version.buildDate=$(BUILD_DATE)
LD_FLAGS += -X k8s.io/component-base/version.gitCommit="not_available"

LD_FLAGS += $(BUILD_GO_LDFLAGS_EXTRA)

golint := $(shell which golangci-lint)
ifeq ($(golint),)
Expand Down Expand Up @@ -69,6 +72,12 @@ else
build: k0s
endif

.k0sbuild.docker-image.k0s:
docker build --rm -t k0sbuild.docker-image.k0s -f build/Dockerfile .
touch $@

.k0sbuild.docker-image.k0s: build/Dockerfile

.PHONY: all
all: k0s k0s.exe

Expand All @@ -84,22 +93,29 @@ pkg/assets/zz_generated_offsets_linux.go pkg/assets/zz_generated_offsets_windows
else
pkg/assets/zz_generated_offsets_linux.go: .bins.linux.stamp
pkg/assets/zz_generated_offsets_windows.go: .bins.windows.stamp
pkg/assets/zz_generated_offsets_linux.go pkg/assets/zz_generated_offsets_windows.go:
pkg/assets/zz_generated_offsets_linux.go pkg/assets/zz_generated_offsets_windows.go: .k0sbuild.docker-image.k0s
GOOS=${GOHOSTOS} $(GO) run hack/gen-bindata/main.go -o bindata_$(zz_os) -pkg assets \
-gofile pkg/assets/zz_generated_offsets_$(zz_os).go \
-prefix embedded-bins/staging/$(zz_os)/ embedded-bins/staging/$(zz_os)/bin
endif


k0s: TARGET_OS = linux
k0s: pkg/assets/zz_generated_offsets_linux.go
k0s: BUILD_GO_CGO_ENABLED = 1
k0s: GOLANG_IMAGE = "k0sbuild.docker-image.k0s"
k0s: BUILD_GO_LDFLAGS_EXTRA = -extldflags=-static
k0s: .k0sbuild.docker-image.k0s

k0s.exe: TARGET_OS = windows
k0s.exe: BUILD_GO_CGO_ENABLED = 0
k0s.exe: GOLANG_IMAGE = golang:1.16-alpine
k0s.exe: pkg/assets/zz_generated_offsets_windows.go

k0s.exe k0s: static/gen_manifests.go

k0s.exe k0s: $(GO_SRCS)
CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(GOARCH) $(GO) build -v -ldflags="$(LD_FLAGS)" -o $@.code main.go
CGO_ENABLED=$(BUILD_GO_CGO_ENABLED) GOOS=$(TARGET_OS) GOARCH=$(GOARCH) $(GO) build $(BUILD_GO_FLAGS) -ldflags='$(LD_FLAGS)' -o $@.code main.go
cat $@.code bindata_$(TARGET_OS) > $@.tmp \
&& rm -f $@.code \
&& chmod +x $@.tmp \
Expand Down Expand Up @@ -133,7 +149,8 @@ check-unit: pkg/assets/zz_generated_offsets_$(TARGET_OS).go static/gen_manifests

.PHONY: clean
clean:
rm -f pkg/assets/zz_generated_offsets_*.go k0s k0s.exe .bins.*stamp bindata* static/gen_manifests.go
rm -f pkg/assets/zz_generated_offsets_*.go k0s k0s.exe .bins.*stamp bindata* static/gen_manifests.go .k0sbuild.docker-image.k0s
docker rmi k0sbuild.docker-image.k0s -f
$(MAKE) -C embedded-bins clean
$(MAKE) -C image-bundle clean
$(MAKE) -C inttest clean
Expand Down Expand Up @@ -169,4 +186,5 @@ fi \
; ' GOMODTIDYLINT
lint-gomod:
@${GOMODTIDYLINT}
@${GOMODTIDYLINT}
Loading

0 comments on commit 574215c

Please sign in to comment.