Skip to content
Snippets Groups Projects
Commit 1c2f994d authored by kaiyou's avatar kaiyou
Browse files

Build a single binary embeddig all components

parent 29930624
No related branches found
No related tags found
No related merge requests found
HACKS.md 0 → 100644
Bundling together vanilla kubernetes, containerd, vanilla CNI, and a full
featured CNI requires some level of quirks due to conflicting dependencies
mostly.
We try and use the most up to date version of each dependency while upstreaming
patches required for interoperability. Remaining quirks are listed below.
# Kubernetes tree loaded from a submodule
In the pursuit of not vendoring source while still depending on upstream
kubernetes cmd/ tree and k8s.io not including openapi generated stubs, we
settled on embedding kubernetes as a git submodule to a vanilla upstream.
# Kubernetes pinned to v1.22.7
Kubernetes 1.23+ requires a recent version of containerd (1.6+), which itself
pulls in recent versions of opentelemetry, incompatible with embedded Etcd.
Hence kubernetes currently being pinned to 1.22.7.
# CNI plugins forked by Rancher
containernetworking/plugins does not expose its main functions for plugins,
which eventually prevents from using them as reexec targets and bundling them
in a single binary.
Rancher forked the project to build a single CNI binary, which we currently
reuse to bundle them in the main binary instead.
Forked is located at: github.com/rancher/plugins
# Genproto pinned to 2020 version
Containerd and kubernetes both depend on protobuf over gRPC. However, kubernetes
1.22 depends on recent gRPC, which pulls in recent protobuf schemas, while
containerd still depends on gogo/protobuf and does not embed latest schemas,
resulting in parsing and fatals at runtime.
k3s did fork containerd to solve part of if and ended up pinning genproto on top
of it. We chose to pin genproto as well while using vanilla containerd.
This is being tracked as: https://github.com/containerd/ttrpc/issues/62
# Gojose pinned to v2.2.2
TODO (document while this is pinned exactly)
# Hepto is a kubernetes distribution for geodistributed desployments
**This is currently highly experimental and unusable as is.**
package main
import (
"context"
"forge.tedomum.net/acides/hepto/hepto/pkg/wrappers"
"github.com/sirupsen/logrus"
)
func main() {
ctx := context.Background()
kubelet, _ := wrappers.Kubelet(ctx, []string{
"--kubeconfig", "/home/kaiyou/ACIDES/hepto/tests/kubelet-kubeconfig.yaml",
"--config", "/home/kaiyou/ACIDES/hepto/tests/kubelet.yaml",
"--container-runtime", "remote",
"--container-runtime-endpoint", "/run/containerd/containerd.sock",
})
containerd, _ := wrappers.Containerd(ctx, []string{})
logrus.SetLevel(logrus.WarnLevel)
select {
case <-kubelet.Context().Done():
break
case <-containerd.Context().Done():
break
}
}
package main
import (
"fmt"
"os"
"github.com/containerd/containerd/cmd/ctr/app"
)
func main() {
app := app.New()
if err := app.Run(os.Args); err != nil {
fmt.Fprintf(os.Stderr, "ctr: %s\n", err)
os.Exit(1)
}
}
......@@ -2,42 +2,51 @@ package main
import (
"context"
"os"
"path/filepath"
"forge.tedomum.net/acides/hepto/hepto/pkg/wrappers"
hostlocal "github.com/containernetworking/plugins/plugins/ipam/host-local"
"github.com/containernetworking/plugins/plugins/main/bridge"
"github.com/containernetworking/plugins/plugins/main/loopback"
"github.com/containernetworking/plugins/plugins/meta/flannel"
"github.com/containernetworking/plugins/plugins/meta/portmap"
"github.com/docker/docker/pkg/reexec"
"go.etcd.io/etcd/server/v3/embed"
)
func main() {
func server(basedir string) {
ctx := context.Background()
etcdConfig := embed.NewConfig()
etcdConfig.Dir = "/tmp/etcd"
etcd, _ := wrappers.ETCd(ctx, etcdConfig)
api, _ := wrappers.APIServer(ctx, []string{
"--bind-address", "::",
"--tls-cert-file", "/home/kaiyou/ACIDES/hepto/tests/ca-services/apiserver.pem",
"--tls-private-key-file", "/home/kaiyou/ACIDES/hepto/tests/ca-services/apiserver.key",
"--client-ca-file", "/home/kaiyou/ACIDES/hepto/tests/ca-apiserver/ca.pem",
"--kubelet-certificate-authority", "/home/kaiyou/ACIDES/hepto/tests/ca-services/ca.pem",
"--kubelet-client-certificate", "/home/kaiyou/ACIDES/hepto/tests/ca-kubelet/apiserver.pem",
"--kubelet-client-key", "/home/kaiyou/ACIDES/hepto/tests/ca-kubelet/apiserver.key",
"--tls-cert-file", basedir + "/ca-services/apiserver.pem",
"--tls-private-key-file", basedir + "/ca-services/apiserver.key",
"--client-ca-file", basedir + "/ca-apiserver/ca.pem",
"--kubelet-certificate-authority", basedir + "/ca-services/ca.pem",
"--kubelet-client-certificate", basedir + "/ca-kubelet/apiserver.pem",
"--kubelet-client-key", basedir + "/ca-kubelet/apiserver.key",
"--etcd-servers", "http://127.0.0.1:2379",
"--service-account-signing-key-file", "/home/kaiyou/ACIDES/hepto/tests/service.pem",
"--service-account-key-file", "/home/kaiyou/ACIDES/hepto/tests/service.pem",
"--service-account-signing-key-file", basedir + "/service.pem",
"--service-account-key-file", basedir + "/service.pem",
"--service-account-issuer", "https://kubernetes.default.svc.cluster.local",
"--api-audiences", "https://kubernetes.default.svc.cluster.local",
// TODO: currently hardcoded
"--oidc-issuer-url", "https://auth.test.tedomum.net/sso/oidc/7bb37b11-2d43-40ad-a40a-4634d6257588",
"--oidc-client-id", "Fd1SDTs0yHGqIK6KsogQzw3W",
"--authorization-mode", "Node,RBAC",
})
cm, _ := wrappers.ControllerManager(ctx, []string{
"--kubeconfig", "/home/kaiyou/ACIDES/hepto/tests/cm-kubeconfig.yaml",
"--tls-cert-file", "/home/kaiyou/ACIDES/hepto/tests/ca-services/cm.pem",
"--tls-private-key-file", "/home/kaiyou/ACIDES/hepto/tests/ca-services/cm.key",
"--service-account-private-key-file", "/home/kaiyou/ACIDES/hepto/tests/service.pem",
"--kubeconfig", basedir + "/cm-kubeconfig.yaml",
"--tls-cert-file", basedir + "/ca-services/cm.pem",
"--tls-private-key-file", basedir + "/ca-services/cm.key",
"--service-account-private-key-file", basedir + "/service.pem",
"--use-service-account-credentials",
})
scheduler, _ := wrappers.Scheduler(ctx, []string{
"--kubeconfig", "/home/kaiyou/ACIDES/hepto/tests/scheduler-kubeconfig.yaml",
"--kubeconfig", basedir + "/scheduler-kubeconfig.yaml",
})
select {
......@@ -51,3 +60,49 @@ func main() {
break
}
}
func agent(basedir string) {
ctx := context.Background()
kubelet, _ := wrappers.Kubelet(ctx, []string{
"--kubeconfig", basedir + "/kubelet-kubeconfig.yaml",
"--config", basedir + "/kubelet.yaml",
"--container-runtime", "remote",
"--container-runtime-endpoint", "/run/containerd/containerd.sock",
})
containerd, _ := wrappers.Containerd(ctx, []string{
"--config", basedir + "/containerd.toml",
})
select {
case <-kubelet.Context().Done():
break
case <-containerd.Context().Done():
break
}
}
func hepto() {
mode := os.Args[1]
basedir := os.Args[2]
if mode == "server" {
server(basedir)
}
if mode == "agent" {
agent(basedir)
}
if mode == "both" {
go server(basedir)
agent(basedir)
}
}
func main() {
os.Args[0] = filepath.Base(os.Args[0])
reexec.Register("hepto", hepto)
reexec.Register("host-local", hostlocal.Main)
reexec.Register("bridge", bridge.Main)
reexec.Register("flannel", flannel.Main)
reexec.Register("loopback", loopback.Main)
reexec.Register("portmap", portmap.Main)
reexec.Init()
}
......@@ -4,13 +4,17 @@ go 1.17
require (
github.com/containerd/containerd v1.5.10
github.com/containernetworking/plugins v0.9.1
github.com/docker/docker v20.10.8+incompatible
github.com/sirupsen/logrus v1.8.1
go.etcd.io/etcd/server/v3 v3.5.1
k8s.io/kubernetes v1.23.0
github.com/spf13/pflag v1.0.5
go.etcd.io/etcd/server/v3 v3.5.0
k8s.io/component-base v0.20.6
k8s.io/kubernetes v1.22.7
)
require (
cloud.google.com/go v0.81.0 // indirect
cloud.google.com/go v0.54.0 // indirect
github.com/Azure/azure-sdk-for-go v55.0.0+incompatible // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
......@@ -22,20 +26,21 @@ require (
github.com/Azure/go-autorest/autorest/validation v0.1.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/GoogleCloudPlatform/k8s-cloud-provider v1.16.1-0.20210702024009-ea6160c1d0e3 // indirect
github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20200415212048-7901bc822317 // indirect
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab // indirect
github.com/Microsoft/go-winio v0.4.17 // indirect
github.com/Microsoft/hcsshim v0.8.23 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210826220005-b48c857c3a0e // indirect
github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae // indirect
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/aws/aws-sdk-go v1.38.49 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/checkpoint-restore/go-criu/v5 v5.0.0 // indirect
github.com/cilium/ebpf v0.6.2 // indirect
......@@ -52,8 +57,8 @@ require (
github.com/containerd/ttrpc v1.1.0 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/containernetworking/cni v0.8.1 // indirect
github.com/containernetworking/plugins v0.9.1 // indirect
github.com/containers/ocicrypt v1.1.1 // indirect
github.com/coreos/go-iptables v0.5.0 // indirect
github.com/coreos/go-oidc v2.1.0+incompatible // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
......@@ -61,7 +66,6 @@ require (
github.com/cyphar/filepath-securejoin v0.2.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v20.10.7+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/docker/go-metrics v0.0.1 // indirect
......@@ -69,11 +73,11 @@ require (
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
......@@ -83,11 +87,10 @@ require (
github.com/gogo/googleapis v1.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.5.0 // indirect
github.com/golang/mock v1.4.4 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/cadvisor v0.43.0 // indirect
github.com/google/cel-go v0.9.0 // indirect
github.com/google/cadvisor v0.39.3 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.2.0 // indirect
......@@ -103,27 +106,29 @@ require (
github.com/heketi/heketi v10.3.0+incompatible // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/klauspost/compress v1.11.13 // indirect
github.com/libopenstorage/openstorage v1.0.0 // indirect
github.com/lithammer/dedent v1.1.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-shellwords v1.0.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/mindprince/gonvml v0.0.0-20190828220739-9ebdce4bb989 // indirect
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/sys/mountinfo v0.4.1 // indirect
github.com/moby/sys/symlink v0.1.0 // indirect
github.com/moby/term v0.0.0-20210610120745-9d4ed1856297 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/mrunalp/fileutils v0.5.0 // indirect
......@@ -134,25 +139,27 @@ require (
github.com/opencontainers/runc v1.0.2 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
github.com/opencontainers/selinux v1.8.2 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.28.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/quobyte/api v0.1.8 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8 // indirect
github.com/seccomp/libseccomp-golang v0.9.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/cobra v1.2.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/cobra v1.1.3 // indirect
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/storageos/go-api v2.2.0+incompatible // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.0 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/tchap/go-patricia v2.2.6+incompatible // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
......@@ -162,14 +169,14 @@ require (
github.com/vmware/govmomi v0.20.3 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.etcd.io/etcd/api/v3 v3.5.1 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.1 // indirect
go.etcd.io/etcd/client/v2 v2.305.1 // indirect
go.etcd.io/etcd/client/v3 v3.5.1 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.1 // indirect
go.etcd.io/etcd/raft/v3 v3.5.1 // indirect
go.etcd.io/etcd/api/v3 v3.5.0 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.0 // indirect
go.etcd.io/etcd/client/v2 v2.305.0 // indirect
go.etcd.io/etcd/client/v3 v3.5.0 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.0 // indirect
go.etcd.io/etcd/raft/v3 v3.5.0 // indirect
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1 // indirect
go.opencensus.io v0.23.0 // indirect
go.opencensus.io v0.22.3 // indirect
go.opentelemetry.io/contrib v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0 // indirect
......@@ -183,22 +190,22 @@ require (
go.opentelemetry.io/proto/otlp v0.7.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.0 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff // indirect
golang.org/x/tools v0.1.2 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gonum.org/v1/gonum v0.6.2 // indirect
google.golang.org/api v0.46.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2 // indirect
google.golang.org/grpc v1.40.0 // indirect
google.golang.org/api v0.20.0 // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
google.golang.org/grpc v1.38.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/gcfg.v1 v1.2.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
......@@ -214,15 +221,14 @@ require (
k8s.io/client-go v0.20.6 // indirect
k8s.io/cloud-provider v0.0.0 // indirect
k8s.io/cluster-bootstrap v0.0.0 // indirect
k8s.io/component-base v0.20.6 // indirect
k8s.io/component-helpers v0.0.0 // indirect
k8s.io/controller-manager v0.0.0 // indirect
k8s.io/cri-api v0.20.6 // indirect
k8s.io/csi-translation-lib v0.0.0 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/klog/v2 v2.9.0 // indirect
k8s.io/kube-aggregator v0.0.0 // indirect
k8s.io/kube-controller-manager v0.0.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c // indirect
k8s.io/kube-scheduler v0.0.0 // indirect
k8s.io/kubectl v0.0.0 // indirect
k8s.io/kubelet v0.0.0 // indirect
......@@ -232,18 +238,16 @@ require (
k8s.io/pod-security-admission v0.0.0 // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.27 // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)
replace (
go.etcd.io/etcd/server/v3 => go.etcd.io/etcd/server/v3 v3.5.1
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0
go.opentelemetry.io/otel => go.opentelemetry.io/otel v0.20.0
go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v0.20.0
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v0.20.0
// These pinned dependencies are documented in HACKS.md
github.com/containernetworking/plugins => github.com/rancher/plugins v0.9.1-k3s1
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63
gopkg.in/square/go-jose.v2 => gopkg.in/square/go-jose.v2 v2.2.2
// Vanilla kubernetes is pulled from a submodule, see HACKS.md
k8s.io/api => ./kubernetes/staging/src/k8s.io/api
k8s.io/apiextensions-apiserver => ./kubernetes/staging/src/k8s.io/apiextensions-apiserver
k8s.io/apimachinery => ./kubernetes/staging/src/k8s.io/apimachinery
......
This diff is collapsed.
Subproject commit 531a28b82ee0211b91fafc4af23cf74a9a06a6b9
Subproject commit b56e432f2191419647a6a13b9f5867801850f969
......@@ -31,6 +31,7 @@ import (
func Containerd(ctx context.Context, args []string) (*Wrapper, error) {
app := command.App()
args = append([]string{"containerd"}, args...)
errors := make(chan error)
go func() {
......
......@@ -3,9 +3,13 @@ package wrappers
import (
"context"
"github.com/spf13/pflag"
"k8s.io/component-base/cli/flag"
apiserver "k8s.io/kubernetes/cmd/kube-apiserver/app"
apiserveropts "k8s.io/kubernetes/cmd/kube-apiserver/app/options"
cm "k8s.io/kubernetes/cmd/kube-controller-manager/app"
scheduler "k8s.io/kubernetes/cmd/kube-scheduler/app"
scheduleropts "k8s.io/kubernetes/cmd/kube-scheduler/app/options"
kubelet "k8s.io/kubernetes/cmd/kubelet/app"
)
......@@ -26,13 +30,20 @@ func ControllerManager(ctx context.Context, args []string) (*Wrapper, error) {
}
func Scheduler(ctx context.Context, args []string) (*Wrapper, error) {
command := scheduler.NewSchedulerCommand()
command.SetArgs(args)
config := scheduleropts.NewOptions()
flags := flagsFromNamedFlagSet("scheduler", config.Flags)
if err := flags.Parse(args); err != nil {
return nil, err
}
cc, sched, err := scheduler.Setup(ctx, config)
if err != nil {
return nil, err
}
errors := make(chan error)
go func() {
err := command.ExecuteContext(ctx)
errors <- err
errors <- scheduler.Run(ctx, cc, sched)
}()
return &Wrapper{
......@@ -58,13 +69,21 @@ func Kubelet(ctx context.Context, args []string) (*Wrapper, error) {
}
func APIServer(ctx context.Context, args []string) (*Wrapper, error) {
command := apiserver.NewAPIServerCommand()
command.SetArgs(args)
config := apiserveropts.NewServerRunOptions()
nfs := config.Flags()
flags := flagsFromNamedFlagSet("apiserver", &nfs)
if err := flags.Parse(args); err != nil {
return nil, err
}
completedOptions, err := apiserver.Complete(config)
if err != nil {
return nil, err
}
errors := make(chan error)
go func() {
result := command.ExecuteContext(ctx)
errors <- result
errors <- apiserver.Run(completedOptions, ctx.Done())
}()
return &Wrapper{
......@@ -72,3 +91,11 @@ func APIServer(ctx context.Context, args []string) (*Wrapper, error) {
err: errors,
}, nil
}
func flagsFromNamedFlagSet(name string, nfs *flag.NamedFlagSets) *pflag.FlagSet {
flags := pflag.NewFlagSet(name, pflag.ContinueOnError)
for _, f := range nfs.FlagSets {
flags.AddFlagSet(f)
}
return flags
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment