Merge remote-tracking branch 'upstream/master' into issue-112

pull/2199/head
Brian Downs 2020-09-04 14:41:42 -07:00
commit 15d7b61939
8 changed files with 28 additions and 6 deletions

View File

@ -12,7 +12,7 @@ If you're interested in contributing documentation, please note the following:
## Developer Certificate Of Origin ##
To contribute to this project, you must agree to the Developer Certificate of Origin (DCO) for each commit you make. The DCO is a simple statement that you, as a contributor, have the legal rite to make the contribution.
To contribute to this project, you must agree to the Developer Certificate of Origin (DCO) for each commit you make. The DCO is a simple statement that you, as a contributor, have the legal right to make the contribution.
See the [DCO](DCO) file for the full text of what you must agree to.

View File

@ -29,3 +29,7 @@ generate: build/data
build/data:
mkdir -p $@
.PHONY: binary-size-check
binary-size-check:
scripts/binary_size_check.sh

View File

@ -70,7 +70,7 @@ There are two major ways that K3s is lighter weight than upstream Kubernetes:
1. The memory footprint to run it is smaller
2. The binary, which contains all the non-containerized components needed to run a cluster, is smaller
The memory footprint is reduced primarily by running many components inside of single process. This eliminates significant overhead that would otherwise be duplicated for each component.
The memory footprint is reduced primarily by running many components inside of a single process. This eliminates significant overhead that would otherwise be duplicated for each component.
The binary is smaller by removing third-party storage drivers and cloud providers, which is explained in more detail below.

View File

@ -3,7 +3,6 @@ package cmds
import (
"context"
"github.com/rancher/k3s/pkg/daemons/config"
"github.com/rancher/k3s/pkg/version"
"github.com/urfave/cli"
)
@ -60,7 +59,7 @@ type Server struct {
ClusterReset bool
ClusterResetRestorePath string
EncryptSecrets bool
StartupHooks []func(context.Context, config.Control) error
StartupHooks []func(context.Context, <-chan struct{}, string) error
EtcdDisableSnapshots bool
EtcdSnapshotDir string
EtcdSnapshotCron string

View File

@ -61,7 +61,7 @@ func StartServer(ctx context.Context, config *Config) error {
}
for _, hook := range config.StartupHooks {
if err := hook(ctx, config.ControlConfig); err != nil {
if err := hook(ctx, config.ControlConfig.Runtime.APIServerReady, config.ControlConfig.Runtime.KubeConfigAdmin); err != nil {
return errors.Wrap(err, "startup hook")
}
}

View File

@ -12,5 +12,5 @@ type Config struct {
ControlConfig config.Control
Rootless bool
SupervisorPort int
StartupHooks []func(context.Context, config.Control) error
StartupHooks []func(context.Context, <-chan struct{}, string) error
}

17
scripts/binary_size_check.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
if [ "${DEBUG}" = 1 ]; then
set -x
fi
MAX_BINARY_SIZE=61000000
SIZE=$(ls -l dist/artifacts/k3s | awk -F ' ' '{print $5}')
if [ ${SIZE} -gt ${MAX_BINARY_SIZE} ]; then
echo "k3s binary exceeds acceptable size of "${MAX_BINARY_SIZE}
exit 1
fi
exit 0

View File

@ -7,5 +7,7 @@ cd $(dirname $0)
if [ -z "$SKIP_VALIDATE" ]; then
./validate
fi
./build
./package
./binary_size_check.sh