Update godeps to include k/k/pkg/client/metrics/prometheus import.
This commit is contained in:
parent
67b834368b
commit
884b49a4bf
File diff suppressed because it is too large
Load Diff
|
|
@ -1,18 +1,26 @@
|
||||||
commit 2c933695fa61d57d1c6fa5defb89caed7d49f773 (origin/master, origin/HEAD)
|
commit 8e329f1c3cbb1354c27b6135990c5544f14d2a17
|
||||||
Merge: 79b3d3e7dc 04e793e65a
|
Merge: 4bc9e94fee 07ebe323fa
|
||||||
Author: Kubernetes Submit Queue <k8s-merge-robot@users.noreply.github.com>
|
Author: Kubernetes Submit Queue <k8s-merge-robot@users.noreply.github.com>
|
||||||
Date: Wed Sep 5 03:09:37 2018 -0700
|
Date: Thu Sep 6 00:02:02 2018 -0700
|
||||||
|
|
||||||
Merge pull request #68273 from sttts/sttts-non-fatal-in-cluster-config
|
Merge pull request #68312 from msau42/fix-e2e
|
||||||
|
|
||||||
Automatic merge from submit-queue (batch tested with PRs 68265, 68273). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.
|
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.
|
||||||
|
|
||||||
apiserver: make InClusterConfig errs for delegated authn/z non-fatal
|
Fix gce localssd pv tests
|
||||||
|
|
||||||
Fixes https://github.com/kubernetes/kubernetes/issues/68246:
|
**What this PR does / why we need it**:
|
||||||
|
When running local PV tests against GCE local SSD, it directly uses the disk so doesn't need to create a tmp dir like the other test formats. Fsgroup tests do not create test-file so don't error on cleanup if the file doesn't exist.
|
||||||
|
|
||||||
Background:
|
|
||||||
|
|
||||||
In gci e2e tests the kube-controller-manager is started as static pod. When it first starts, there is no kubernetes service and the KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT env vars are not set inside the container.
|
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
|
||||||
|
Fixes #68308
|
||||||
|
|
||||||
When the kube-controller-manager is restarted, the KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT env vars are set, but the static pod has no service account, i.e. /var/run/secrets/kubernetes.io/serviceaccount/token does not exist. We made the later fatal in rest.InCluster
|
**Special notes for your reviewer**:
|
||||||
|
|
||||||
|
**Release note**:
|
||||||
|
|
||||||
|
```release-note
|
||||||
|
NONE
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import (
|
||||||
var (
|
var (
|
||||||
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
|
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
|
||||||
MinClusterVersion = "3.0.0"
|
MinClusterVersion = "3.0.0"
|
||||||
Version = "3.2.13"
|
Version = "3.2.24"
|
||||||
APIVersion = "unknown"
|
APIVersion = "unknown"
|
||||||
|
|
||||||
// Git SHA Value will be set during build
|
// Git SHA Value will be set during build
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ go_library(
|
||||||
],
|
],
|
||||||
importpath = "k8s.io/kubernetes/cmd/kube-proxy/app",
|
importpath = "k8s.io/kubernetes/cmd/kube-proxy/app",
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/componentconfig:go_default_library",
|
|
||||||
"//pkg/apis/core:go_default_library",
|
"//pkg/apis/core:go_default_library",
|
||||||
"//pkg/kubelet/qos:go_default_library",
|
"//pkg/kubelet/qos:go_default_library",
|
||||||
"//pkg/master/ports:go_default_library",
|
"//pkg/master/ports:go_default_library",
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ import (
|
||||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
"k8s.io/kube-proxy/config/v1alpha1"
|
"k8s.io/kube-proxy/config/v1alpha1"
|
||||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/qos"
|
"k8s.io/kubernetes/pkg/kubelet/qos"
|
||||||
"k8s.io/kubernetes/pkg/master/ports"
|
"k8s.io/kubernetes/pkg/master/ports"
|
||||||
|
|
@ -131,16 +130,16 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
|
||||||
|
|
||||||
// All flags below here are deprecated and will eventually be removed.
|
// All flags below here are deprecated and will eventually be removed.
|
||||||
|
|
||||||
fs.Var(componentconfig.IPVar{Val: &o.config.BindAddress}, "bind-address", "The IP address for the proxy server to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
fs.Var(utilflag.IPVar{Val: &o.config.BindAddress}, "bind-address", "The IP address for the proxy server to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
||||||
fs.StringVar(&o.master, "master", o.master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
|
fs.StringVar(&o.master, "master", o.master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
|
||||||
fs.Int32Var(&o.healthzPort, "healthz-port", o.healthzPort, "The port to bind the health check server. Use 0 to disable.")
|
fs.Int32Var(&o.healthzPort, "healthz-port", o.healthzPort, "The port to bind the health check server. Use 0 to disable.")
|
||||||
fs.Var(componentconfig.IPVar{Val: &o.config.HealthzBindAddress}, "healthz-bind-address", "The IP address and port for the health check server to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
fs.Var(utilflag.IPVar{Val: &o.config.HealthzBindAddress}, "healthz-bind-address", "The IP address and port for the health check server to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
||||||
fs.Var(componentconfig.IPVar{Val: &o.config.MetricsBindAddress}, "metrics-bind-address", "The IP address and port for the metrics server to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
fs.Var(utilflag.IPVar{Val: &o.config.MetricsBindAddress}, "metrics-bind-address", "The IP address and port for the metrics server to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
||||||
fs.Int32Var(o.config.OOMScoreAdj, "oom-score-adj", utilpointer.Int32PtrDerefOr(o.config.OOMScoreAdj, int32(qos.KubeProxyOOMScoreAdj)), "The oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]")
|
fs.Int32Var(o.config.OOMScoreAdj, "oom-score-adj", utilpointer.Int32PtrDerefOr(o.config.OOMScoreAdj, int32(qos.KubeProxyOOMScoreAdj)), "The oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]")
|
||||||
fs.StringVar(&o.config.ResourceContainer, "resource-container", o.config.ResourceContainer, "Absolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).")
|
fs.StringVar(&o.config.ResourceContainer, "resource-container", o.config.ResourceContainer, "Absolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).")
|
||||||
fs.MarkDeprecated("resource-container", "This feature will be removed in a later release.")
|
fs.MarkDeprecated("resource-container", "This feature will be removed in a later release.")
|
||||||
fs.StringVar(&o.config.ClientConnection.Kubeconfig, "kubeconfig", o.config.ClientConnection.Kubeconfig, "Path to kubeconfig file with authorization information (the master location is set by the master flag).")
|
fs.StringVar(&o.config.ClientConnection.Kubeconfig, "kubeconfig", o.config.ClientConnection.Kubeconfig, "Path to kubeconfig file with authorization information (the master location is set by the master flag).")
|
||||||
fs.Var(componentconfig.PortRangeVar{Val: &o.config.PortRange}, "proxy-port-range", "Range of host ports (beginPort-endPort, single port or beginPort+offset, inclusive) that may be consumed in order to proxy service traffic. If (unspecified, 0, or 0-0) then ports will be randomly chosen.")
|
fs.Var(utilflag.PortRangeVar{Val: &o.config.PortRange}, "proxy-port-range", "Range of host ports (beginPort-endPort, single port or beginPort+offset, inclusive) that may be consumed in order to proxy service traffic. If (unspecified, 0, or 0-0) then ports will be randomly chosen.")
|
||||||
fs.StringVar(&o.config.HostnameOverride, "hostname-override", o.config.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.")
|
fs.StringVar(&o.config.HostnameOverride, "hostname-override", o.config.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.")
|
||||||
fs.Var(&o.config.Mode, "proxy-mode", "Which proxy mode to use: 'userspace' (older) or 'iptables' (faster) or 'ipvs' (experimental). If blank, use the best-available proxy (currently iptables). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient, this always falls back to the userspace proxy.")
|
fs.Var(&o.config.Mode, "proxy-mode", "Which proxy mode to use: 'userspace' (older) or 'iptables' (faster) or 'ipvs' (experimental). If blank, use the best-available proxy (currently iptables). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient, this always falls back to the userspace proxy.")
|
||||||
fs.Int32Var(o.config.IPTables.MasqueradeBit, "iptables-masquerade-bit", utilpointer.Int32PtrDerefOr(o.config.IPTables.MasqueradeBit, 14), "If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].")
|
fs.Int32Var(o.config.IPTables.MasqueradeBit, "iptables-masquerade-bit", utilpointer.Int32PtrDerefOr(o.config.IPTables.MasqueradeBit, 14), "If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].")
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ go_library(
|
||||||
"//staging/src/k8s.io/apiserver/pkg/server/healthz:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/server/healthz:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
|
||||||
|
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1beta1:go_default_library",
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ go_library(
|
||||||
],
|
],
|
||||||
importpath = "k8s.io/kubernetes/cmd/kubelet/app/options",
|
importpath = "k8s.io/kubernetes/cmd/kubelet/app/options",
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/componentconfig:go_default_library",
|
|
||||||
"//pkg/apis/core:go_default_library",
|
"//pkg/apis/core:go_default_library",
|
||||||
"//pkg/credentialprovider/azure:go_default_library",
|
"//pkg/credentialprovider/azure:go_default_library",
|
||||||
"//pkg/credentialprovider/gcp:go_default_library",
|
"//pkg/credentialprovider/gcp:go_default_library",
|
||||||
|
|
@ -30,6 +29,7 @@ go_library(
|
||||||
"//pkg/kubelet/config:go_default_library",
|
"//pkg/kubelet/config:go_default_library",
|
||||||
"//pkg/kubelet/types:go_default_library",
|
"//pkg/kubelet/types:go_default_library",
|
||||||
"//pkg/master/ports:go_default_library",
|
"//pkg/master/ports:go_default_library",
|
||||||
|
"//pkg/util/flag:go_default_library",
|
||||||
"//pkg/util/taints:go_default_library",
|
"//pkg/util/taints:go_default_library",
|
||||||
"//pkg/version/verflag:go_default_library",
|
"//pkg/version/verflag:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import (
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/apiserver/pkg/util/flag"
|
"k8s.io/apiserver/pkg/util/flag"
|
||||||
"k8s.io/kubelet/config/v1beta1"
|
"k8s.io/kubelet/config/v1beta1"
|
||||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
|
||||||
"k8s.io/kubernetes/pkg/apis/core"
|
"k8s.io/kubernetes/pkg/apis/core"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
"k8s.io/kubernetes/pkg/features"
|
||||||
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
|
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
|
||||||
|
|
@ -39,6 +38,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/kubelet/config"
|
"k8s.io/kubernetes/pkg/kubelet/config"
|
||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
"k8s.io/kubernetes/pkg/master/ports"
|
"k8s.io/kubernetes/pkg/master/ports"
|
||||||
|
utilflag "k8s.io/kubernetes/pkg/util/flag"
|
||||||
utiltaints "k8s.io/kubernetes/pkg/util/taints"
|
utiltaints "k8s.io/kubernetes/pkg/util/taints"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -447,7 +447,7 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig
|
||||||
fs.DurationVar(&c.HTTPCheckFrequency.Duration, "http-check-frequency", c.HTTPCheckFrequency.Duration, "Duration between checking http for new data")
|
fs.DurationVar(&c.HTTPCheckFrequency.Duration, "http-check-frequency", c.HTTPCheckFrequency.Duration, "Duration between checking http for new data")
|
||||||
fs.StringVar(&c.StaticPodURL, "manifest-url", c.StaticPodURL, "URL for accessing additional Pod specifications to run")
|
fs.StringVar(&c.StaticPodURL, "manifest-url", c.StaticPodURL, "URL for accessing additional Pod specifications to run")
|
||||||
fs.Var(flag.NewColonSeparatedMultimapStringString(&c.StaticPodURLHeader), "manifest-url-header", "Comma-separated list of HTTP headers to use when accessing the url provided to --manifest-url. Multiple headers with the same name will be added in the same order provided. This flag can be repeatedly invoked. For example: `--manifest-url-header 'a:hello,b:again,c:world' --manifest-url-header 'b:beautiful'`")
|
fs.Var(flag.NewColonSeparatedMultimapStringString(&c.StaticPodURLHeader), "manifest-url-header", "Comma-separated list of HTTP headers to use when accessing the url provided to --manifest-url. Multiple headers with the same name will be added in the same order provided. This flag can be repeatedly invoked. For example: `--manifest-url-header 'a:hello,b:again,c:world' --manifest-url-header 'b:beautiful'`")
|
||||||
fs.Var(componentconfig.IPVar{Val: &c.Address}, "address", "The IP address for the Kubelet to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
fs.Var(utilflag.IPVar{Val: &c.Address}, "address", "The IP address for the Kubelet to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
||||||
fs.Int32Var(&c.Port, "port", c.Port, "The port for the Kubelet to serve on.")
|
fs.Int32Var(&c.Port, "port", c.Port, "The port for the Kubelet to serve on.")
|
||||||
fs.Int32Var(&c.ReadOnlyPort, "read-only-port", c.ReadOnlyPort, "The read-only port for the Kubelet to serve on with no authentication/authorization (set to 0 to disable)")
|
fs.Int32Var(&c.ReadOnlyPort, "read-only-port", c.ReadOnlyPort, "The read-only port for the Kubelet to serve on with no authentication/authorization (set to 0 to disable)")
|
||||||
|
|
||||||
|
|
@ -499,7 +499,7 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig
|
||||||
fs.BoolVar(&c.EnableDebuggingHandlers, "enable-debugging-handlers", c.EnableDebuggingHandlers, "Enables server endpoints for log collection and local running of containers and commands")
|
fs.BoolVar(&c.EnableDebuggingHandlers, "enable-debugging-handlers", c.EnableDebuggingHandlers, "Enables server endpoints for log collection and local running of containers and commands")
|
||||||
fs.BoolVar(&c.EnableContentionProfiling, "contention-profiling", c.EnableContentionProfiling, "Enable lock contention profiling, if profiling is enabled")
|
fs.BoolVar(&c.EnableContentionProfiling, "contention-profiling", c.EnableContentionProfiling, "Enable lock contention profiling, if profiling is enabled")
|
||||||
fs.Int32Var(&c.HealthzPort, "healthz-port", c.HealthzPort, "The port of the localhost healthz endpoint (set to 0 to disable)")
|
fs.Int32Var(&c.HealthzPort, "healthz-port", c.HealthzPort, "The port of the localhost healthz endpoint (set to 0 to disable)")
|
||||||
fs.Var(componentconfig.IPVar{Val: &c.HealthzBindAddress}, "healthz-bind-address", "The IP address for the healthz server to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
fs.Var(utilflag.IPVar{Val: &c.HealthzBindAddress}, "healthz-bind-address", "The IP address for the healthz server to serve on (set to `0.0.0.0` for all IPv4 interfaces and `::` for all IPv6 interfaces)")
|
||||||
fs.Int32Var(&c.OOMScoreAdj, "oom-score-adj", c.OOMScoreAdj, "The oom-score-adj value for kubelet process. Values must be within the range [-1000, 1000]")
|
fs.Int32Var(&c.OOMScoreAdj, "oom-score-adj", c.OOMScoreAdj, "The oom-score-adj value for kubelet process. Values must be within the range [-1000, 1000]")
|
||||||
fs.StringVar(&c.ClusterDomain, "cluster-domain", c.ClusterDomain, "Domain for this cluster. If set, kubelet will configure all containers to search this domain in addition to the host's search domains")
|
fs.StringVar(&c.ClusterDomain, "cluster-domain", c.ClusterDomain, "Domain for this cluster. If set, kubelet will configure all containers to search this domain in addition to the host's search domains")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ import (
|
||||||
"k8s.io/apiserver/pkg/server/healthz"
|
"k8s.io/apiserver/pkg/server/healthz"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/apiserver/pkg/util/flag"
|
"k8s.io/apiserver/pkg/util/flag"
|
||||||
|
"k8s.io/client-go/dynamic"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
restclient "k8s.io/client-go/rest"
|
restclient "k8s.io/client-go/rest"
|
||||||
|
|
@ -546,14 +547,16 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
||||||
// if in standalone mode, indicate as much by setting all clients to nil
|
// if in standalone mode, indicate as much by setting all clients to nil
|
||||||
if standaloneMode {
|
if standaloneMode {
|
||||||
kubeDeps.KubeClient = nil
|
kubeDeps.KubeClient = nil
|
||||||
|
kubeDeps.DynamicKubeClient = nil
|
||||||
kubeDeps.EventClient = nil
|
kubeDeps.EventClient = nil
|
||||||
kubeDeps.HeartbeatClient = nil
|
kubeDeps.HeartbeatClient = nil
|
||||||
glog.Warningf("standalone mode, no API client")
|
glog.Warningf("standalone mode, no API client")
|
||||||
} else if kubeDeps.KubeClient == nil || kubeDeps.EventClient == nil || kubeDeps.HeartbeatClient == nil {
|
} else if kubeDeps.KubeClient == nil || kubeDeps.EventClient == nil || kubeDeps.HeartbeatClient == nil || kubeDeps.DynamicKubeClient == nil {
|
||||||
// initialize clients if not standalone mode and any of the clients are not provided
|
// initialize clients if not standalone mode and any of the clients are not provided
|
||||||
var kubeClient clientset.Interface
|
var kubeClient clientset.Interface
|
||||||
var eventClient v1core.EventsGetter
|
var eventClient v1core.EventsGetter
|
||||||
var heartbeatClient clientset.Interface
|
var heartbeatClient clientset.Interface
|
||||||
|
var dynamicKubeClient dynamic.Interface
|
||||||
|
|
||||||
clientConfig, err := createAPIServerClientConfig(s)
|
clientConfig, err := createAPIServerClientConfig(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -583,6 +586,10 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
||||||
clientCertificateManager.SetCertificateSigningRequestClient(kubeClient.CertificatesV1beta1().CertificateSigningRequests())
|
clientCertificateManager.SetCertificateSigningRequestClient(kubeClient.CertificatesV1beta1().CertificateSigningRequests())
|
||||||
clientCertificateManager.Start()
|
clientCertificateManager.Start()
|
||||||
}
|
}
|
||||||
|
dynamicKubeClient, err = dynamic.NewForConfig(clientConfig)
|
||||||
|
if err != nil {
|
||||||
|
glog.Warningf("Failed to initialize dynamic KubeClient: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// make a separate client for events
|
// make a separate client for events
|
||||||
eventClientConfig := *clientConfig
|
eventClientConfig := *clientConfig
|
||||||
|
|
@ -617,6 +624,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
||||||
}
|
}
|
||||||
|
|
||||||
kubeDeps.KubeClient = kubeClient
|
kubeDeps.KubeClient = kubeClient
|
||||||
|
kubeDeps.DynamicKubeClient = dynamicKubeClient
|
||||||
if heartbeatClient != nil {
|
if heartbeatClient != nil {
|
||||||
kubeDeps.HeartbeatClient = heartbeatClient
|
kubeDeps.HeartbeatClient = heartbeatClient
|
||||||
kubeDeps.OnHeartbeatFailure = closeAllConns
|
kubeDeps.OnHeartbeatFailure = closeAllConns
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
|
||||||
|
|
||||||
load(
|
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
|
||||||
"go_library",
|
|
||||||
"go_test",
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
|
||||||
name = "go_default_library",
|
|
||||||
srcs = [
|
|
||||||
"doc.go",
|
|
||||||
"helpers.go",
|
|
||||||
"register.go",
|
|
||||||
"types.go",
|
|
||||||
"zz_generated.deepcopy.go",
|
|
||||||
],
|
|
||||||
importpath = "k8s.io/kubernetes/pkg/apis/componentconfig",
|
|
||||||
deps = [
|
|
||||||
"//pkg/controller/apis/config:go_default_library",
|
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_test(
|
|
||||||
name = "go_default_test",
|
|
||||||
srcs = ["helpers_test.go"],
|
|
||||||
embed = [":go_default_library"],
|
|
||||||
deps = ["//vendor/github.com/spf13/pflag:go_default_library"],
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "package-srcs",
|
|
||||||
srcs = glob(["**"]),
|
|
||||||
tags = ["automanaged"],
|
|
||||||
visibility = ["//visibility:private"],
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "all-srcs",
|
|
||||||
srcs = [
|
|
||||||
":package-srcs",
|
|
||||||
"//pkg/apis/componentconfig/fuzzer:all-srcs",
|
|
||||||
"//pkg/apis/componentconfig/install:all-srcs",
|
|
||||||
"//pkg/apis/componentconfig/v1alpha1:all-srcs",
|
|
||||||
],
|
|
||||||
tags = ["automanaged"],
|
|
||||||
)
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
approvers:
|
|
||||||
- api-approvers
|
|
||||||
- mikedanese
|
|
||||||
- vishh
|
|
||||||
- mtaufen
|
|
||||||
- luxas
|
|
||||||
- sttts
|
|
||||||
reviewers:
|
|
||||||
- api-reviewers
|
|
||||||
- thockin
|
|
||||||
- lavalamp
|
|
||||||
- smarterclayton
|
|
||||||
- wojtek-t
|
|
||||||
- deads2k
|
|
||||||
- vishh
|
|
||||||
- mikedanese
|
|
||||||
- liggitt
|
|
||||||
- luxas
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2016 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen=package
|
|
||||||
|
|
||||||
package componentconfig
|
|
||||||
157
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers.go
generated
vendored
157
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/helpers.go
generated
vendored
|
|
@ -1,157 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2016 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package componentconfig
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"net"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
utilnet "k8s.io/apimachinery/pkg/util/net"
|
|
||||||
)
|
|
||||||
|
|
||||||
// used for validating command line opts
|
|
||||||
// TODO(mikedanese): remove these when we remove command line flags
|
|
||||||
|
|
||||||
type IPVar struct {
|
|
||||||
Val *string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v IPVar) Set(s string) error {
|
|
||||||
if len(s) == 0 {
|
|
||||||
v.Val = nil
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if net.ParseIP(s) == nil {
|
|
||||||
return fmt.Errorf("%q is not a valid IP address", s)
|
|
||||||
}
|
|
||||||
if v.Val == nil {
|
|
||||||
// it's okay to panic here since this is programmer error
|
|
||||||
panic("the string pointer passed into IPVar should not be nil")
|
|
||||||
}
|
|
||||||
*v.Val = s
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v IPVar) String() string {
|
|
||||||
if v.Val == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return *v.Val
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v IPVar) Type() string {
|
|
||||||
return "ip"
|
|
||||||
}
|
|
||||||
|
|
||||||
// IPPortVar allows IP or IP:port formats.
|
|
||||||
type IPPortVar struct {
|
|
||||||
Val *string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v IPPortVar) Set(s string) error {
|
|
||||||
if len(s) == 0 {
|
|
||||||
v.Val = nil
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.Val == nil {
|
|
||||||
// it's okay to panic here since this is programmer error
|
|
||||||
panic("the string pointer passed into IPPortVar should not be nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Both IP and IP:port are valid.
|
|
||||||
// Attempt to parse into IP first.
|
|
||||||
if net.ParseIP(s) != nil {
|
|
||||||
*v.Val = s
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Can not parse into IP, now assume IP:port.
|
|
||||||
host, port, err := net.SplitHostPort(s)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("%q is not in a valid format (ip or ip:port): %v", s, err)
|
|
||||||
}
|
|
||||||
if net.ParseIP(host) == nil {
|
|
||||||
return fmt.Errorf("%q is not a valid IP address", host)
|
|
||||||
}
|
|
||||||
if _, err := strconv.Atoi(port); err != nil {
|
|
||||||
return fmt.Errorf("%q is not a valid number", port)
|
|
||||||
}
|
|
||||||
*v.Val = s
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v IPPortVar) String() string {
|
|
||||||
if v.Val == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return *v.Val
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v IPPortVar) Type() string {
|
|
||||||
return "ipport"
|
|
||||||
}
|
|
||||||
|
|
||||||
type PortRangeVar struct {
|
|
||||||
Val *string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v PortRangeVar) Set(s string) error {
|
|
||||||
if _, err := utilnet.ParsePortRange(s); err != nil {
|
|
||||||
return fmt.Errorf("%q is not a valid port range: %v", s, err)
|
|
||||||
}
|
|
||||||
if v.Val == nil {
|
|
||||||
// it's okay to panic here since this is programmer error
|
|
||||||
panic("the string pointer passed into PortRangeVar should not be nil")
|
|
||||||
}
|
|
||||||
*v.Val = s
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v PortRangeVar) String() string {
|
|
||||||
if v.Val == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return *v.Val
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v PortRangeVar) Type() string {
|
|
||||||
return "port-range"
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConvertObjToConfigMap converts an object to a ConfigMap.
|
|
||||||
// This is specifically meant for ComponentConfigs.
|
|
||||||
func ConvertObjToConfigMap(name string, obj runtime.Object) (*v1.ConfigMap, error) {
|
|
||||||
eJSONBytes, err := json.Marshal(obj)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
cm := &v1.ConfigMap{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: name,
|
|
||||||
},
|
|
||||||
Data: map[string]string{
|
|
||||||
name: string(eJSONBytes[:]),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return cm, nil
|
|
||||||
}
|
|
||||||
52
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/register.go
generated
vendored
52
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/apis/componentconfig/register.go
generated
vendored
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2015 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package componentconfig
|
|
||||||
|
|
||||||
import (
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GroupName is the group name use in this package
|
|
||||||
const GroupName = "componentconfig"
|
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
|
||||||
|
|
||||||
var (
|
|
||||||
SchemeBuilder runtime.SchemeBuilder
|
|
||||||
localSchemeBuilder = &SchemeBuilder
|
|
||||||
AddToScheme = localSchemeBuilder.AddToScheme
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
// We only register manually written functions here. The registration of the
|
|
||||||
// generated functions takes place in the generated files. The separation
|
|
||||||
// makes the code compile even when the generated files are missing.
|
|
||||||
localSchemeBuilder.Register(addKnownTypes)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
|
||||||
func Kind(kind string) schema.GroupKind {
|
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
|
||||||
}
|
|
||||||
|
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
||||||
// TODO: All structs in this package are about to be moved out,
|
|
||||||
// so nothing should be registered here as this API group is going to be removed soon.
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2015 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package componentconfig
|
|
||||||
|
|
||||||
import (
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
|
||||||
)
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
type CloudControllerManagerConfiguration struct {
|
|
||||||
metav1.TypeMeta
|
|
||||||
|
|
||||||
// Generic holds configuration for a generic controller-manager
|
|
||||||
Generic kubectrlmgrconfig.GenericControllerManagerConfiguration
|
|
||||||
// KubeCloudSharedConfiguration holds configuration for shared related features
|
|
||||||
// both in cloud controller manager and kube-controller manager.
|
|
||||||
KubeCloudShared kubectrlmgrconfig.KubeCloudSharedConfiguration
|
|
||||||
|
|
||||||
// ServiceControllerConfiguration holds configuration for ServiceController
|
|
||||||
// related features.
|
|
||||||
ServiceController kubectrlmgrconfig.ServiceControllerConfiguration
|
|
||||||
// NodeStatusUpdateFrequency is the frequency at which the controller updates nodes' status
|
|
||||||
NodeStatusUpdateFrequency metav1.Duration
|
|
||||||
}
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
// +build !ignore_autogenerated
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package componentconfig
|
|
||||||
|
|
||||||
import (
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *CloudControllerManagerConfiguration) DeepCopyInto(out *CloudControllerManagerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.Generic.DeepCopyInto(&out.Generic)
|
|
||||||
out.KubeCloudShared = in.KubeCloudShared
|
|
||||||
out.ServiceController = in.ServiceController
|
|
||||||
out.NodeStatusUpdateFrequency = in.NodeStatusUpdateFrequency
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudControllerManagerConfiguration.
|
|
||||||
func (in *CloudControllerManagerConfiguration) DeepCopy() *CloudControllerManagerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(CloudControllerManagerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *CloudControllerManagerConfiguration) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *IPPortVar) DeepCopyInto(out *IPPortVar) {
|
|
||||||
*out = *in
|
|
||||||
if in.Val != nil {
|
|
||||||
in, out := &in.Val, &out.Val
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPortVar.
|
|
||||||
func (in *IPPortVar) DeepCopy() *IPPortVar {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(IPPortVar)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *IPVar) DeepCopyInto(out *IPVar) {
|
|
||||||
*out = *in
|
|
||||||
if in.Val != nil {
|
|
||||||
in, out := &in.Val, &out.Val
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPVar.
|
|
||||||
func (in *IPVar) DeepCopy() *IPVar {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(IPVar)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *PortRangeVar) DeepCopyInto(out *PortRangeVar) {
|
|
||||||
*out = *in
|
|
||||||
if in.Val != nil {
|
|
||||||
in, out := &in.Val, &out.Val
|
|
||||||
*out = new(string)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortRangeVar.
|
|
||||||
func (in *PortRangeVar) DeepCopy() *PortRangeVar {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(PortRangeVar)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
29
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/client/metrics/prometheus/BUILD
generated
vendored
Normal file
29
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/client/metrics/prometheus/BUILD
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = ["prometheus.go"],
|
||||||
|
importpath = "k8s.io/kubernetes/pkg/client/metrics/prometheus",
|
||||||
|
deps = [
|
||||||
|
"//staging/src/k8s.io/client-go/tools/metrics:go_default_library",
|
||||||
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "package-srcs",
|
||||||
|
srcs = glob(["**"]),
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "all-srcs",
|
||||||
|
srcs = [":package-srcs"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
)
|
||||||
71
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/client/metrics/prometheus/prometheus.go
generated
vendored
Normal file
71
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/client/metrics/prometheus/prometheus.go
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package prometheus creates and registers prometheus metrics with
|
||||||
|
// rest clients. To use this package, you just have to import it.
|
||||||
|
package prometheus
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/url"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/client-go/tools/metrics"
|
||||||
|
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// requestLatency is a Prometheus Summary metric type partitioned by
|
||||||
|
// "verb" and "url" labels. It is used for the rest client latency metrics.
|
||||||
|
requestLatency = prometheus.NewHistogramVec(
|
||||||
|
prometheus.HistogramOpts{
|
||||||
|
Name: "rest_client_request_latency_seconds",
|
||||||
|
Help: "Request latency in seconds. Broken down by verb and URL.",
|
||||||
|
Buckets: prometheus.ExponentialBuckets(0.001, 2, 10),
|
||||||
|
},
|
||||||
|
[]string{"verb", "url"},
|
||||||
|
)
|
||||||
|
|
||||||
|
requestResult = prometheus.NewCounterVec(
|
||||||
|
prometheus.CounterOpts{
|
||||||
|
Name: "rest_client_requests_total",
|
||||||
|
Help: "Number of HTTP requests, partitioned by status code, method, and host.",
|
||||||
|
},
|
||||||
|
[]string{"code", "method", "host"},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
prometheus.MustRegister(requestLatency)
|
||||||
|
prometheus.MustRegister(requestResult)
|
||||||
|
metrics.Register(&latencyAdapter{requestLatency}, &resultAdapter{requestResult})
|
||||||
|
}
|
||||||
|
|
||||||
|
type latencyAdapter struct {
|
||||||
|
m *prometheus.HistogramVec
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *latencyAdapter) Observe(verb string, u url.URL, latency time.Duration) {
|
||||||
|
l.m.WithLabelValues(verb, u.String()).Observe(latency.Seconds())
|
||||||
|
}
|
||||||
|
|
||||||
|
type resultAdapter struct {
|
||||||
|
m *prometheus.CounterVec
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *resultAdapter) Increment(code, method, host string) {
|
||||||
|
r.m.WithLabelValues(code, method, host).Inc()
|
||||||
|
}
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
|
||||||
|
|
||||||
go_library(
|
|
||||||
name = "go_default_library",
|
|
||||||
srcs = [
|
|
||||||
"doc.go",
|
|
||||||
"register.go",
|
|
||||||
"types.go",
|
|
||||||
"zz_generated.deepcopy.go",
|
|
||||||
],
|
|
||||||
importpath = "k8s.io/kubernetes/pkg/controller/apis/config",
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
deps = [
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/config:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apiserver/pkg/apis/config:go_default_library",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "package-srcs",
|
|
||||||
srcs = glob(["**"]),
|
|
||||||
tags = ["automanaged"],
|
|
||||||
visibility = ["//visibility:private"],
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "all-srcs",
|
|
||||||
srcs = [
|
|
||||||
":package-srcs",
|
|
||||||
"//pkg/controller/apis/config/scheme:all-srcs",
|
|
||||||
"//pkg/controller/apis/config/v1alpha1:all-srcs",
|
|
||||||
],
|
|
||||||
tags = ["automanaged"],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
approvers:
|
|
||||||
- api-approvers
|
|
||||||
- deads2k
|
|
||||||
- luxas
|
|
||||||
- mtaufen
|
|
||||||
- sttts
|
|
||||||
- stewart-yu
|
|
||||||
reviewers:
|
|
||||||
- api-reviewers
|
|
||||||
- deads2k
|
|
||||||
- luxas
|
|
||||||
- mtaufen
|
|
||||||
- sttts
|
|
||||||
- stewart-yu
|
|
||||||
43
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/apis/config/register.go
generated
vendored
43
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/apis/config/register.go
generated
vendored
|
|
@ -1,43 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package config
|
|
||||||
|
|
||||||
import (
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GroupName is the group name use in this package
|
|
||||||
const GroupName = "kubecontrollermanager.config.k8s.io"
|
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
|
||||||
|
|
||||||
var (
|
|
||||||
// SchemeBuilder providers the handle of collects functions that add things to a scheme
|
|
||||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
|
||||||
// AddToScheme applies all the stored functions to the scheme. A non-nil error
|
|
||||||
// indicates that one function failed and the attempt was abandoned.
|
|
||||||
AddToScheme = SchemeBuilder.AddToScheme
|
|
||||||
)
|
|
||||||
|
|
||||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
|
||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
|
||||||
&KubeControllerManagerConfiguration{},
|
|
||||||
)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
450
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/apis/config/types.go
generated
vendored
450
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/controller/apis/config/types.go
generated
vendored
|
|
@ -1,450 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package config
|
|
||||||
|
|
||||||
import (
|
|
||||||
apimachineryconfig "k8s.io/apimachinery/pkg/apis/config"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
apiserverconfig "k8s.io/apiserver/pkg/apis/config"
|
|
||||||
)
|
|
||||||
|
|
||||||
// GroupResource describes an group resource.
|
|
||||||
type GroupResource struct {
|
|
||||||
// group is the group portion of the GroupResource.
|
|
||||||
Group string
|
|
||||||
// resource is the resource portion of the GroupResource.
|
|
||||||
Resource string
|
|
||||||
}
|
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
||||||
|
|
||||||
// KubeControllerManagerConfiguration contains elements describing kube-controller manager.
|
|
||||||
type KubeControllerManagerConfiguration struct {
|
|
||||||
metav1.TypeMeta
|
|
||||||
|
|
||||||
// Generic holds configuration for a generic controller-manager
|
|
||||||
Generic GenericControllerManagerConfiguration
|
|
||||||
// KubeCloudSharedConfiguration holds configuration for shared related features
|
|
||||||
// both in cloud controller manager and kube-controller manager.
|
|
||||||
KubeCloudShared KubeCloudSharedConfiguration
|
|
||||||
|
|
||||||
// AttachDetachControllerConfiguration holds configuration for
|
|
||||||
// AttachDetachController related features.
|
|
||||||
AttachDetachController AttachDetachControllerConfiguration
|
|
||||||
// CSRSigningControllerConfiguration holds configuration for
|
|
||||||
// CSRSigningController related features.
|
|
||||||
CSRSigningController CSRSigningControllerConfiguration
|
|
||||||
// DaemonSetControllerConfiguration holds configuration for DaemonSetController
|
|
||||||
// related features.
|
|
||||||
DaemonSetController DaemonSetControllerConfiguration
|
|
||||||
// DeploymentControllerConfiguration holds configuration for
|
|
||||||
// DeploymentController related features.
|
|
||||||
DeploymentController DeploymentControllerConfiguration
|
|
||||||
// DeprecatedControllerConfiguration holds configuration for some deprecated
|
|
||||||
// features.
|
|
||||||
DeprecatedController DeprecatedControllerConfiguration
|
|
||||||
// EndpointControllerConfiguration holds configuration for EndpointController
|
|
||||||
// related features.
|
|
||||||
EndpointController EndpointControllerConfiguration
|
|
||||||
// GarbageCollectorControllerConfiguration holds configuration for
|
|
||||||
// GarbageCollectorController related features.
|
|
||||||
GarbageCollectorController GarbageCollectorControllerConfiguration
|
|
||||||
// HPAControllerConfiguration holds configuration for HPAController related features.
|
|
||||||
HPAController HPAControllerConfiguration
|
|
||||||
// JobControllerConfiguration holds configuration for JobController related features.
|
|
||||||
JobController JobControllerConfiguration
|
|
||||||
// NamespaceControllerConfiguration holds configuration for NamespaceController
|
|
||||||
// related features.
|
|
||||||
NamespaceController NamespaceControllerConfiguration
|
|
||||||
// NodeIPAMControllerConfiguration holds configuration for NodeIPAMController
|
|
||||||
// related features.
|
|
||||||
NodeIPAMController NodeIPAMControllerConfiguration
|
|
||||||
// NodeLifecycleControllerConfiguration holds configuration for
|
|
||||||
// NodeLifecycleController related features.
|
|
||||||
NodeLifecycleController NodeLifecycleControllerConfiguration
|
|
||||||
// PersistentVolumeBinderControllerConfiguration holds configuration for
|
|
||||||
// PersistentVolumeBinderController related features.
|
|
||||||
PersistentVolumeBinderController PersistentVolumeBinderControllerConfiguration
|
|
||||||
// PodGCControllerConfiguration holds configuration for PodGCController
|
|
||||||
// related features.
|
|
||||||
PodGCController PodGCControllerConfiguration
|
|
||||||
// ReplicaSetControllerConfiguration holds configuration for ReplicaSet related features.
|
|
||||||
ReplicaSetController ReplicaSetControllerConfiguration
|
|
||||||
// ReplicationControllerConfiguration holds configuration for
|
|
||||||
// ReplicationController related features.
|
|
||||||
ReplicationController ReplicationControllerConfiguration
|
|
||||||
// ResourceQuotaControllerConfiguration holds configuration for
|
|
||||||
// ResourceQuotaController related features.
|
|
||||||
ResourceQuotaController ResourceQuotaControllerConfiguration
|
|
||||||
// SAControllerConfiguration holds configuration for ServiceAccountController
|
|
||||||
// related features.
|
|
||||||
SAController SAControllerConfiguration
|
|
||||||
// ServiceControllerConfiguration holds configuration for ServiceController
|
|
||||||
// related features.
|
|
||||||
ServiceController ServiceControllerConfiguration
|
|
||||||
// TTLAfterFinishedControllerConfiguration holds configuration for
|
|
||||||
// TTLAfterFinishedController related features.
|
|
||||||
TTLAfterFinishedController TTLAfterFinishedControllerConfiguration
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenericControllerManagerConfiguration holds configuration for a generic controller-manager
|
|
||||||
type GenericControllerManagerConfiguration struct {
|
|
||||||
// port is the port that the controller-manager's http service runs on.
|
|
||||||
Port int32
|
|
||||||
// address is the IP address to serve on (set to 0.0.0.0 for all interfaces).
|
|
||||||
Address string
|
|
||||||
// minResyncPeriod is the resync period in reflectors; will be random between
|
|
||||||
// minResyncPeriod and 2*minResyncPeriod.
|
|
||||||
MinResyncPeriod metav1.Duration
|
|
||||||
// ClientConnection specifies the kubeconfig file and client connection
|
|
||||||
// settings for the proxy server to use when communicating with the apiserver.
|
|
||||||
ClientConnection apimachineryconfig.ClientConnectionConfiguration
|
|
||||||
// How long to wait between starting controller managers
|
|
||||||
ControllerStartInterval metav1.Duration
|
|
||||||
// leaderElection defines the configuration of leader election client.
|
|
||||||
LeaderElection apiserverconfig.LeaderElectionConfiguration
|
|
||||||
// Controllers is the list of controllers to enable or disable
|
|
||||||
// '*' means "all enabled by default controllers"
|
|
||||||
// 'foo' means "enable 'foo'"
|
|
||||||
// '-foo' means "disable 'foo'"
|
|
||||||
// first item for a particular name wins
|
|
||||||
Controllers []string
|
|
||||||
// DebuggingConfiguration holds configuration for Debugging related features.
|
|
||||||
Debugging apiserverconfig.DebuggingConfiguration
|
|
||||||
}
|
|
||||||
|
|
||||||
// KubeCloudSharedConfiguration contains elements shared by both kube-controller manager
|
|
||||||
// and cloud-controller manager, but not genericconfig.
|
|
||||||
type KubeCloudSharedConfiguration struct {
|
|
||||||
// CloudProviderConfiguration holds configuration for CloudProvider related features.
|
|
||||||
CloudProvider CloudProviderConfiguration
|
|
||||||
// externalCloudVolumePlugin specifies the plugin to use when cloudProvider is "external".
|
|
||||||
// It is currently used by the in repo cloud providers to handle node and volume control in the KCM.
|
|
||||||
ExternalCloudVolumePlugin string
|
|
||||||
// useServiceAccountCredentials indicates whether controllers should be run with
|
|
||||||
// individual service account credentials.
|
|
||||||
UseServiceAccountCredentials bool
|
|
||||||
// run with untagged cloud instances
|
|
||||||
AllowUntaggedCloud bool
|
|
||||||
// routeReconciliationPeriod is the period for reconciling routes created for Nodes by cloud provider..
|
|
||||||
RouteReconciliationPeriod metav1.Duration
|
|
||||||
// nodeMonitorPeriod is the period for syncing NodeStatus in NodeController.
|
|
||||||
NodeMonitorPeriod metav1.Duration
|
|
||||||
// clusterName is the instance prefix for the cluster.
|
|
||||||
ClusterName string
|
|
||||||
// clusterCIDR is CIDR Range for Pods in cluster.
|
|
||||||
ClusterCIDR string
|
|
||||||
// AllocateNodeCIDRs enables CIDRs for Pods to be allocated and, if
|
|
||||||
// ConfigureCloudRoutes is true, to be set on the cloud provider.
|
|
||||||
AllocateNodeCIDRs bool
|
|
||||||
// CIDRAllocatorType determines what kind of pod CIDR allocator will be used.
|
|
||||||
CIDRAllocatorType string
|
|
||||||
// configureCloudRoutes enables CIDRs allocated with allocateNodeCIDRs
|
|
||||||
// to be configured on the cloud provider.
|
|
||||||
ConfigureCloudRoutes bool
|
|
||||||
// nodeSyncPeriod is the period for syncing nodes from cloudprovider. Longer
|
|
||||||
// periods will result in fewer calls to cloud provider, but may delay addition
|
|
||||||
// of new nodes to cluster.
|
|
||||||
NodeSyncPeriod metav1.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
// AttachDetachControllerConfiguration contains elements describing AttachDetachController.
|
|
||||||
type AttachDetachControllerConfiguration struct {
|
|
||||||
// Reconciler runs a periodic loop to reconcile the desired state of the with
|
|
||||||
// the actual state of the world by triggering attach detach operations.
|
|
||||||
// This flag enables or disables reconcile. Is false by default, and thus enabled.
|
|
||||||
DisableAttachDetachReconcilerSync bool
|
|
||||||
// ReconcilerSyncLoopPeriod is the amount of time the reconciler sync states loop
|
|
||||||
// wait between successive executions. Is set to 5 sec by default.
|
|
||||||
ReconcilerSyncLoopPeriod metav1.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
// CloudProviderConfiguration contains basically elements about cloud provider.
|
|
||||||
type CloudProviderConfiguration struct {
|
|
||||||
// Name is the provider for cloud services.
|
|
||||||
Name string
|
|
||||||
// cloudConfigFile is the path to the cloud provider configuration file.
|
|
||||||
CloudConfigFile string
|
|
||||||
}
|
|
||||||
|
|
||||||
// CSRSigningControllerConfiguration contains elements describing CSRSigningController.
|
|
||||||
type CSRSigningControllerConfiguration struct {
|
|
||||||
// clusterSigningCertFile is the filename containing a PEM-encoded
|
|
||||||
// X509 CA certificate used to issue cluster-scoped certificates
|
|
||||||
ClusterSigningCertFile string
|
|
||||||
// clusterSigningCertFile is the filename containing a PEM-encoded
|
|
||||||
// RSA or ECDSA private key used to issue cluster-scoped certificates
|
|
||||||
ClusterSigningKeyFile string
|
|
||||||
// clusterSigningDuration is the length of duration signed certificates
|
|
||||||
// will be given.
|
|
||||||
ClusterSigningDuration metav1.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
// DaemonSetControllerConfiguration contains elements describing DaemonSetController.
|
|
||||||
type DaemonSetControllerConfiguration struct {
|
|
||||||
// concurrentDaemonSetSyncs is the number of daemonset objects that are
|
|
||||||
// allowed to sync concurrently. Larger number = more responsive daemonset,
|
|
||||||
// but more CPU (and network) load.
|
|
||||||
ConcurrentDaemonSetSyncs int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeploymentControllerConfiguration contains elements describing DeploymentController.
|
|
||||||
type DeploymentControllerConfiguration struct {
|
|
||||||
// concurrentDeploymentSyncs is the number of deployment objects that are
|
|
||||||
// allowed to sync concurrently. Larger number = more responsive deployments,
|
|
||||||
// but more CPU (and network) load.
|
|
||||||
ConcurrentDeploymentSyncs int32
|
|
||||||
// deploymentControllerSyncPeriod is the period for syncing the deployments.
|
|
||||||
DeploymentControllerSyncPeriod metav1.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeprecatedControllerConfiguration contains elements be deprecated.
|
|
||||||
type DeprecatedControllerConfiguration struct {
|
|
||||||
// DEPRECATED: deletingPodsQps is the number of nodes per second on which pods are deleted in
|
|
||||||
// case of node failure.
|
|
||||||
DeletingPodsQPS float32
|
|
||||||
// DEPRECATED: deletingPodsBurst is the number of nodes on which pods are bursty deleted in
|
|
||||||
// case of node failure. For more details look into RateLimiter.
|
|
||||||
DeletingPodsBurst int32
|
|
||||||
// registerRetryCount is the number of retries for initial node registration.
|
|
||||||
// Retry interval equals node-sync-period.
|
|
||||||
RegisterRetryCount int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// EndpointControllerConfiguration contains elements describing EndpointController.
|
|
||||||
type EndpointControllerConfiguration struct {
|
|
||||||
// concurrentEndpointSyncs is the number of endpoint syncing operations
|
|
||||||
// that will be done concurrently. Larger number = faster endpoint updating,
|
|
||||||
// but more CPU (and network) load.
|
|
||||||
ConcurrentEndpointSyncs int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// GarbageCollectorControllerConfiguration contains elements describing GarbageCollectorController.
|
|
||||||
type GarbageCollectorControllerConfiguration struct {
|
|
||||||
// enables the generic garbage collector. MUST be synced with the
|
|
||||||
// corresponding flag of the kube-apiserver. WARNING: the generic garbage
|
|
||||||
// collector is an alpha feature.
|
|
||||||
EnableGarbageCollector bool
|
|
||||||
// concurrentGCSyncs is the number of garbage collector workers that are
|
|
||||||
// allowed to sync concurrently.
|
|
||||||
ConcurrentGCSyncs int32
|
|
||||||
// gcIgnoredResources is the list of GroupResources that garbage collection should ignore.
|
|
||||||
GCIgnoredResources []GroupResource
|
|
||||||
}
|
|
||||||
|
|
||||||
// HPAControllerConfiguration contains elements describing HPAController.
|
|
||||||
type HPAControllerConfiguration struct {
|
|
||||||
// horizontalPodAutoscalerSyncPeriod is the period for syncing the number of
|
|
||||||
// pods in horizontal pod autoscaler.
|
|
||||||
HorizontalPodAutoscalerSyncPeriod metav1.Duration
|
|
||||||
// horizontalPodAutoscalerUpscaleForbiddenWindow is a period after which next upscale allowed.
|
|
||||||
HorizontalPodAutoscalerUpscaleForbiddenWindow metav1.Duration
|
|
||||||
// horizontalPodAutoscalerDownscaleForbiddenWindow is a period after which next downscale allowed.
|
|
||||||
HorizontalPodAutoscalerDownscaleForbiddenWindow metav1.Duration
|
|
||||||
// HorizontalPodAutoscalerDowncaleStabilizationWindow is a period for which autoscaler will look
|
|
||||||
// backwards and not scale down below any recommendation it made during that period.
|
|
||||||
HorizontalPodAutoscalerDownscaleStabilizationWindow metav1.Duration
|
|
||||||
// horizontalPodAutoscalerTolerance is the tolerance for when
|
|
||||||
// resource usage suggests upscaling/downscaling
|
|
||||||
HorizontalPodAutoscalerTolerance float64
|
|
||||||
// HorizontalPodAutoscalerUseRESTClients causes the HPA controller to use REST clients
|
|
||||||
// through the kube-aggregator when enabled, instead of using the legacy metrics client
|
|
||||||
// through the API server proxy.
|
|
||||||
HorizontalPodAutoscalerUseRESTClients bool
|
|
||||||
// HorizontalPodAutoscalerCPUInitializationPeriod is the period after pod start when CPU samples
|
|
||||||
// might be skipped.
|
|
||||||
HorizontalPodAutoscalerCPUInitializationPeriod metav1.Duration
|
|
||||||
// HorizontalPodAutoscalerInitialReadinessDelay is period after pod start during which readiness
|
|
||||||
// changes are treated as readiness being set for the first time. The only effect of this is that
|
|
||||||
// HPA will disregard CPU samples from unready pods that had last readiness change during that
|
|
||||||
// period.
|
|
||||||
HorizontalPodAutoscalerInitialReadinessDelay metav1.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
// JobControllerConfiguration contains elements describing JobController.
|
|
||||||
type JobControllerConfiguration struct {
|
|
||||||
// concurrentJobSyncs is the number of job objects that are
|
|
||||||
// allowed to sync concurrently. Larger number = more responsive jobs,
|
|
||||||
// but more CPU (and network) load.
|
|
||||||
ConcurrentJobSyncs int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// NamespaceControllerConfiguration contains elements describing NamespaceController.
|
|
||||||
type NamespaceControllerConfiguration struct {
|
|
||||||
// namespaceSyncPeriod is the period for syncing namespace life-cycle
|
|
||||||
// updates.
|
|
||||||
NamespaceSyncPeriod metav1.Duration
|
|
||||||
// concurrentNamespaceSyncs is the number of namespace objects that are
|
|
||||||
// allowed to sync concurrently.
|
|
||||||
ConcurrentNamespaceSyncs int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeIPAMControllerConfiguration contains elements describing NodeIPAMController.
|
|
||||||
type NodeIPAMControllerConfiguration struct {
|
|
||||||
// serviceCIDR is CIDR Range for Services in cluster.
|
|
||||||
ServiceCIDR string
|
|
||||||
// NodeCIDRMaskSize is the mask size for node cidr in cluster.
|
|
||||||
NodeCIDRMaskSize int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeLifecycleControllerConfiguration contains elements describing NodeLifecycleController.
|
|
||||||
type NodeLifecycleControllerConfiguration struct {
|
|
||||||
// If set to true enables NoExecute Taints and will evict all not-tolerating
|
|
||||||
// Pod running on Nodes tainted with this kind of Taints.
|
|
||||||
EnableTaintManager bool
|
|
||||||
// nodeEvictionRate is the number of nodes per second on which pods are deleted in case of node failure when a zone is healthy
|
|
||||||
NodeEvictionRate float32
|
|
||||||
// secondaryNodeEvictionRate is the number of nodes per second on which pods are deleted in case of node failure when a zone is unhealthy
|
|
||||||
SecondaryNodeEvictionRate float32
|
|
||||||
// nodeStartupGracePeriod is the amount of time which we allow starting a node to
|
|
||||||
// be unresponsive before marking it unhealthy.
|
|
||||||
NodeStartupGracePeriod metav1.Duration
|
|
||||||
// nodeMontiorGracePeriod is the amount of time which we allow a running node to be
|
|
||||||
// unresponsive before marking it unhealthy. Must be N times more than kubelet's
|
|
||||||
// nodeStatusUpdateFrequency, where N means number of retries allowed for kubelet
|
|
||||||
// to post node status.
|
|
||||||
NodeMonitorGracePeriod metav1.Duration
|
|
||||||
// podEvictionTimeout is the grace period for deleting pods on failed nodes.
|
|
||||||
PodEvictionTimeout metav1.Duration
|
|
||||||
// secondaryNodeEvictionRate is implicitly overridden to 0 for clusters smaller than or equal to largeClusterSizeThreshold
|
|
||||||
LargeClusterSizeThreshold int32
|
|
||||||
// Zone is treated as unhealthy in nodeEvictionRate and secondaryNodeEvictionRate when at least
|
|
||||||
// unhealthyZoneThreshold (no less than 3) of Nodes in the zone are NotReady
|
|
||||||
UnhealthyZoneThreshold float32
|
|
||||||
}
|
|
||||||
|
|
||||||
// PersistentVolumeBinderControllerConfiguration contains elements describing
|
|
||||||
// PersistentVolumeBinderController.
|
|
||||||
type PersistentVolumeBinderControllerConfiguration struct {
|
|
||||||
// pvClaimBinderSyncPeriod is the period for syncing persistent volumes
|
|
||||||
// and persistent volume claims.
|
|
||||||
PVClaimBinderSyncPeriod metav1.Duration
|
|
||||||
// volumeConfiguration holds configuration for volume related features.
|
|
||||||
VolumeConfiguration VolumeConfiguration
|
|
||||||
}
|
|
||||||
|
|
||||||
// PodGCControllerConfiguration contains elements describing PodGCController.
|
|
||||||
type PodGCControllerConfiguration struct {
|
|
||||||
// terminatedPodGCThreshold is the number of terminated pods that can exist
|
|
||||||
// before the terminated pod garbage collector starts deleting terminated pods.
|
|
||||||
// If <= 0, the terminated pod garbage collector is disabled.
|
|
||||||
TerminatedPodGCThreshold int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReplicaSetControllerConfiguration contains elements describing ReplicaSetController.
|
|
||||||
type ReplicaSetControllerConfiguration struct {
|
|
||||||
// concurrentRSSyncs is the number of replica sets that are allowed to sync
|
|
||||||
// concurrently. Larger number = more responsive replica management, but more
|
|
||||||
// CPU (and network) load.
|
|
||||||
ConcurrentRSSyncs int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReplicationControllerConfiguration contains elements describing ReplicationController.
|
|
||||||
type ReplicationControllerConfiguration struct {
|
|
||||||
// concurrentRCSyncs is the number of replication controllers that are
|
|
||||||
// allowed to sync concurrently. Larger number = more responsive replica
|
|
||||||
// management, but more CPU (and network) load.
|
|
||||||
ConcurrentRCSyncs int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResourceQuotaControllerConfiguration contains elements describing ResourceQuotaController.
|
|
||||||
type ResourceQuotaControllerConfiguration struct {
|
|
||||||
// resourceQuotaSyncPeriod is the period for syncing quota usage status
|
|
||||||
// in the system.
|
|
||||||
ResourceQuotaSyncPeriod metav1.Duration
|
|
||||||
// concurrentResourceQuotaSyncs is the number of resource quotas that are
|
|
||||||
// allowed to sync concurrently. Larger number = more responsive quota
|
|
||||||
// management, but more CPU (and network) load.
|
|
||||||
ConcurrentResourceQuotaSyncs int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// SAControllerConfiguration contains elements describing ServiceAccountController.
|
|
||||||
type SAControllerConfiguration struct {
|
|
||||||
// serviceAccountKeyFile is the filename containing a PEM-encoded private RSA key
|
|
||||||
// used to sign service account tokens.
|
|
||||||
ServiceAccountKeyFile string
|
|
||||||
// concurrentSATokenSyncs is the number of service account token syncing operations
|
|
||||||
// that will be done concurrently.
|
|
||||||
ConcurrentSATokenSyncs int32
|
|
||||||
// rootCAFile is the root certificate authority will be included in service
|
|
||||||
// account's token secret. This must be a valid PEM-encoded CA bundle.
|
|
||||||
RootCAFile string
|
|
||||||
}
|
|
||||||
|
|
||||||
// ServiceControllerConfiguration contains elements describing ServiceController.
|
|
||||||
type ServiceControllerConfiguration struct {
|
|
||||||
// concurrentServiceSyncs is the number of services that are
|
|
||||||
// allowed to sync concurrently. Larger number = more responsive service
|
|
||||||
// management, but more CPU (and network) load.
|
|
||||||
ConcurrentServiceSyncs int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// VolumeConfiguration contains *all* enumerated flags meant to configure all volume
|
|
||||||
// plugins. From this config, the controller-manager binary will create many instances of
|
|
||||||
// volume.VolumeConfig, each containing only the configuration needed for that plugin which
|
|
||||||
// are then passed to the appropriate plugin. The ControllerManager binary is the only part
|
|
||||||
// of the code which knows what plugins are supported and which flags correspond to each plugin.
|
|
||||||
type VolumeConfiguration struct {
|
|
||||||
// enableHostPathProvisioning enables HostPath PV provisioning when running without a
|
|
||||||
// cloud provider. This allows testing and development of provisioning features. HostPath
|
|
||||||
// provisioning is not supported in any way, won't work in a multi-node cluster, and
|
|
||||||
// should not be used for anything other than testing or development.
|
|
||||||
EnableHostPathProvisioning bool
|
|
||||||
// enableDynamicProvisioning enables the provisioning of volumes when running within an environment
|
|
||||||
// that supports dynamic provisioning. Defaults to true.
|
|
||||||
EnableDynamicProvisioning bool
|
|
||||||
// persistentVolumeRecyclerConfiguration holds configuration for persistent volume plugins.
|
|
||||||
PersistentVolumeRecyclerConfiguration PersistentVolumeRecyclerConfiguration
|
|
||||||
// volumePluginDir is the full path of the directory in which the flex
|
|
||||||
// volume plugin should search for additional third party volume plugins
|
|
||||||
FlexVolumePluginDir string
|
|
||||||
}
|
|
||||||
|
|
||||||
// PersistentVolumeRecyclerConfiguration contains elements describing persistent volume plugins.
|
|
||||||
type PersistentVolumeRecyclerConfiguration struct {
|
|
||||||
// maximumRetry is number of retries the PV recycler will execute on failure to recycle
|
|
||||||
// PV.
|
|
||||||
MaximumRetry int32
|
|
||||||
// minimumTimeoutNFS is the minimum ActiveDeadlineSeconds to use for an NFS Recycler
|
|
||||||
// pod.
|
|
||||||
MinimumTimeoutNFS int32
|
|
||||||
// podTemplateFilePathNFS is the file path to a pod definition used as a template for
|
|
||||||
// NFS persistent volume recycling
|
|
||||||
PodTemplateFilePathNFS string
|
|
||||||
// incrementTimeoutNFS is the increment of time added per Gi to ActiveDeadlineSeconds
|
|
||||||
// for an NFS scrubber pod.
|
|
||||||
IncrementTimeoutNFS int32
|
|
||||||
// podTemplateFilePathHostPath is the file path to a pod definition used as a template for
|
|
||||||
// HostPath persistent volume recycling. This is for development and testing only and
|
|
||||||
// will not work in a multi-node cluster.
|
|
||||||
PodTemplateFilePathHostPath string
|
|
||||||
// minimumTimeoutHostPath is the minimum ActiveDeadlineSeconds to use for a HostPath
|
|
||||||
// Recycler pod. This is for development and testing only and will not work in a multi-node
|
|
||||||
// cluster.
|
|
||||||
MinimumTimeoutHostPath int32
|
|
||||||
// incrementTimeoutHostPath is the increment of time added per Gi to ActiveDeadlineSeconds
|
|
||||||
// for a HostPath scrubber pod. This is for development and testing only and will not work
|
|
||||||
// in a multi-node cluster.
|
|
||||||
IncrementTimeoutHostPath int32
|
|
||||||
}
|
|
||||||
|
|
||||||
// TTLAfterFinishedControllerConfiguration contains elements describing TTLAfterFinishedController.
|
|
||||||
type TTLAfterFinishedControllerConfiguration struct {
|
|
||||||
// concurrentTTLSyncs is the number of TTL-after-finished collector workers that are
|
|
||||||
// allowed to sync concurrently.
|
|
||||||
ConcurrentTTLSyncs int32
|
|
||||||
}
|
|
||||||
|
|
@ -1,524 +0,0 @@
|
||||||
// +build !ignore_autogenerated
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
|
||||||
|
|
||||||
package config
|
|
||||||
|
|
||||||
import (
|
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *AttachDetachControllerConfiguration) DeepCopyInto(out *AttachDetachControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.ReconcilerSyncLoopPeriod = in.ReconcilerSyncLoopPeriod
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AttachDetachControllerConfiguration.
|
|
||||||
func (in *AttachDetachControllerConfiguration) DeepCopy() *AttachDetachControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(AttachDetachControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *CSRSigningControllerConfiguration) DeepCopyInto(out *CSRSigningControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.ClusterSigningDuration = in.ClusterSigningDuration
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CSRSigningControllerConfiguration.
|
|
||||||
func (in *CSRSigningControllerConfiguration) DeepCopy() *CSRSigningControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(CSRSigningControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *CloudProviderConfiguration) DeepCopyInto(out *CloudProviderConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudProviderConfiguration.
|
|
||||||
func (in *CloudProviderConfiguration) DeepCopy() *CloudProviderConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(CloudProviderConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *DaemonSetControllerConfiguration) DeepCopyInto(out *DaemonSetControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaemonSetControllerConfiguration.
|
|
||||||
func (in *DaemonSetControllerConfiguration) DeepCopy() *DaemonSetControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(DaemonSetControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *DeploymentControllerConfiguration) DeepCopyInto(out *DeploymentControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.DeploymentControllerSyncPeriod = in.DeploymentControllerSyncPeriod
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentControllerConfiguration.
|
|
||||||
func (in *DeploymentControllerConfiguration) DeepCopy() *DeploymentControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(DeploymentControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *DeprecatedControllerConfiguration) DeepCopyInto(out *DeprecatedControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeprecatedControllerConfiguration.
|
|
||||||
func (in *DeprecatedControllerConfiguration) DeepCopy() *DeprecatedControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(DeprecatedControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *EndpointControllerConfiguration) DeepCopyInto(out *EndpointControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointControllerConfiguration.
|
|
||||||
func (in *EndpointControllerConfiguration) DeepCopy() *EndpointControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(EndpointControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *GarbageCollectorControllerConfiguration) DeepCopyInto(out *GarbageCollectorControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
if in.GCIgnoredResources != nil {
|
|
||||||
in, out := &in.GCIgnoredResources, &out.GCIgnoredResources
|
|
||||||
*out = make([]GroupResource, len(*in))
|
|
||||||
copy(*out, *in)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GarbageCollectorControllerConfiguration.
|
|
||||||
func (in *GarbageCollectorControllerConfiguration) DeepCopy() *GarbageCollectorControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(GarbageCollectorControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *GenericControllerManagerConfiguration) DeepCopyInto(out *GenericControllerManagerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.MinResyncPeriod = in.MinResyncPeriod
|
|
||||||
out.ClientConnection = in.ClientConnection
|
|
||||||
out.ControllerStartInterval = in.ControllerStartInterval
|
|
||||||
out.LeaderElection = in.LeaderElection
|
|
||||||
if in.Controllers != nil {
|
|
||||||
in, out := &in.Controllers, &out.Controllers
|
|
||||||
*out = make([]string, len(*in))
|
|
||||||
copy(*out, *in)
|
|
||||||
}
|
|
||||||
out.Debugging = in.Debugging
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericControllerManagerConfiguration.
|
|
||||||
func (in *GenericControllerManagerConfiguration) DeepCopy() *GenericControllerManagerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(GenericControllerManagerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *GroupResource) DeepCopyInto(out *GroupResource) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupResource.
|
|
||||||
func (in *GroupResource) DeepCopy() *GroupResource {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(GroupResource)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *HPAControllerConfiguration) DeepCopyInto(out *HPAControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.HorizontalPodAutoscalerSyncPeriod = in.HorizontalPodAutoscalerSyncPeriod
|
|
||||||
out.HorizontalPodAutoscalerUpscaleForbiddenWindow = in.HorizontalPodAutoscalerUpscaleForbiddenWindow
|
|
||||||
out.HorizontalPodAutoscalerDownscaleForbiddenWindow = in.HorizontalPodAutoscalerDownscaleForbiddenWindow
|
|
||||||
out.HorizontalPodAutoscalerDownscaleStabilizationWindow = in.HorizontalPodAutoscalerDownscaleStabilizationWindow
|
|
||||||
out.HorizontalPodAutoscalerCPUInitializationPeriod = in.HorizontalPodAutoscalerCPUInitializationPeriod
|
|
||||||
out.HorizontalPodAutoscalerInitialReadinessDelay = in.HorizontalPodAutoscalerInitialReadinessDelay
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HPAControllerConfiguration.
|
|
||||||
func (in *HPAControllerConfiguration) DeepCopy() *HPAControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(HPAControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *JobControllerConfiguration) DeepCopyInto(out *JobControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobControllerConfiguration.
|
|
||||||
func (in *JobControllerConfiguration) DeepCopy() *JobControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(JobControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *KubeCloudSharedConfiguration) DeepCopyInto(out *KubeCloudSharedConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.CloudProvider = in.CloudProvider
|
|
||||||
out.RouteReconciliationPeriod = in.RouteReconciliationPeriod
|
|
||||||
out.NodeMonitorPeriod = in.NodeMonitorPeriod
|
|
||||||
out.NodeSyncPeriod = in.NodeSyncPeriod
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeCloudSharedConfiguration.
|
|
||||||
func (in *KubeCloudSharedConfiguration) DeepCopy() *KubeCloudSharedConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(KubeCloudSharedConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *KubeControllerManagerConfiguration) DeepCopyInto(out *KubeControllerManagerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.TypeMeta = in.TypeMeta
|
|
||||||
in.Generic.DeepCopyInto(&out.Generic)
|
|
||||||
out.KubeCloudShared = in.KubeCloudShared
|
|
||||||
out.AttachDetachController = in.AttachDetachController
|
|
||||||
out.CSRSigningController = in.CSRSigningController
|
|
||||||
out.DaemonSetController = in.DaemonSetController
|
|
||||||
out.DeploymentController = in.DeploymentController
|
|
||||||
out.DeprecatedController = in.DeprecatedController
|
|
||||||
out.EndpointController = in.EndpointController
|
|
||||||
in.GarbageCollectorController.DeepCopyInto(&out.GarbageCollectorController)
|
|
||||||
out.HPAController = in.HPAController
|
|
||||||
out.JobController = in.JobController
|
|
||||||
out.NamespaceController = in.NamespaceController
|
|
||||||
out.NodeIPAMController = in.NodeIPAMController
|
|
||||||
out.NodeLifecycleController = in.NodeLifecycleController
|
|
||||||
out.PersistentVolumeBinderController = in.PersistentVolumeBinderController
|
|
||||||
out.PodGCController = in.PodGCController
|
|
||||||
out.ReplicaSetController = in.ReplicaSetController
|
|
||||||
out.ReplicationController = in.ReplicationController
|
|
||||||
out.ResourceQuotaController = in.ResourceQuotaController
|
|
||||||
out.SAController = in.SAController
|
|
||||||
out.ServiceController = in.ServiceController
|
|
||||||
out.TTLAfterFinishedController = in.TTLAfterFinishedController
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeControllerManagerConfiguration.
|
|
||||||
func (in *KubeControllerManagerConfiguration) DeepCopy() *KubeControllerManagerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(KubeControllerManagerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
|
||||||
func (in *KubeControllerManagerConfiguration) DeepCopyObject() runtime.Object {
|
|
||||||
if c := in.DeepCopy(); c != nil {
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *NamespaceControllerConfiguration) DeepCopyInto(out *NamespaceControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.NamespaceSyncPeriod = in.NamespaceSyncPeriod
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceControllerConfiguration.
|
|
||||||
func (in *NamespaceControllerConfiguration) DeepCopy() *NamespaceControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(NamespaceControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *NodeIPAMControllerConfiguration) DeepCopyInto(out *NodeIPAMControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeIPAMControllerConfiguration.
|
|
||||||
func (in *NodeIPAMControllerConfiguration) DeepCopy() *NodeIPAMControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(NodeIPAMControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *NodeLifecycleControllerConfiguration) DeepCopyInto(out *NodeLifecycleControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.NodeStartupGracePeriod = in.NodeStartupGracePeriod
|
|
||||||
out.NodeMonitorGracePeriod = in.NodeMonitorGracePeriod
|
|
||||||
out.PodEvictionTimeout = in.PodEvictionTimeout
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeLifecycleControllerConfiguration.
|
|
||||||
func (in *NodeLifecycleControllerConfiguration) DeepCopy() *NodeLifecycleControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(NodeLifecycleControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *PersistentVolumeBinderControllerConfiguration) DeepCopyInto(out *PersistentVolumeBinderControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.PVClaimBinderSyncPeriod = in.PVClaimBinderSyncPeriod
|
|
||||||
out.VolumeConfiguration = in.VolumeConfiguration
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeBinderControllerConfiguration.
|
|
||||||
func (in *PersistentVolumeBinderControllerConfiguration) DeepCopy() *PersistentVolumeBinderControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(PersistentVolumeBinderControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *PersistentVolumeRecyclerConfiguration) DeepCopyInto(out *PersistentVolumeRecyclerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeRecyclerConfiguration.
|
|
||||||
func (in *PersistentVolumeRecyclerConfiguration) DeepCopy() *PersistentVolumeRecyclerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(PersistentVolumeRecyclerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *PodGCControllerConfiguration) DeepCopyInto(out *PodGCControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGCControllerConfiguration.
|
|
||||||
func (in *PodGCControllerConfiguration) DeepCopy() *PodGCControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(PodGCControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ReplicaSetControllerConfiguration) DeepCopyInto(out *ReplicaSetControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicaSetControllerConfiguration.
|
|
||||||
func (in *ReplicaSetControllerConfiguration) DeepCopy() *ReplicaSetControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ReplicaSetControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ReplicationControllerConfiguration) DeepCopyInto(out *ReplicationControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicationControllerConfiguration.
|
|
||||||
func (in *ReplicationControllerConfiguration) DeepCopy() *ReplicationControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ReplicationControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ResourceQuotaControllerConfiguration) DeepCopyInto(out *ResourceQuotaControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.ResourceQuotaSyncPeriod = in.ResourceQuotaSyncPeriod
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceQuotaControllerConfiguration.
|
|
||||||
func (in *ResourceQuotaControllerConfiguration) DeepCopy() *ResourceQuotaControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ResourceQuotaControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *SAControllerConfiguration) DeepCopyInto(out *SAControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SAControllerConfiguration.
|
|
||||||
func (in *SAControllerConfiguration) DeepCopy() *SAControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(SAControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *ServiceControllerConfiguration) DeepCopyInto(out *ServiceControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceControllerConfiguration.
|
|
||||||
func (in *ServiceControllerConfiguration) DeepCopy() *ServiceControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(ServiceControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *TTLAfterFinishedControllerConfiguration) DeepCopyInto(out *TTLAfterFinishedControllerConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TTLAfterFinishedControllerConfiguration.
|
|
||||||
func (in *TTLAfterFinishedControllerConfiguration) DeepCopy() *TTLAfterFinishedControllerConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(TTLAfterFinishedControllerConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
|
||||||
func (in *VolumeConfiguration) DeepCopyInto(out *VolumeConfiguration) {
|
|
||||||
*out = *in
|
|
||||||
out.PersistentVolumeRecyclerConfiguration = in.PersistentVolumeRecyclerConfiguration
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeConfiguration.
|
|
||||||
func (in *VolumeConfiguration) DeepCopy() *VolumeConfiguration {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(VolumeConfiguration)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
@ -303,7 +303,7 @@ const (
|
||||||
VolumeSubpath utilfeature.Feature = "VolumeSubpath"
|
VolumeSubpath utilfeature.Feature = "VolumeSubpath"
|
||||||
|
|
||||||
// owner: @gnufied
|
// owner: @gnufied
|
||||||
// alpha : v1.11
|
// beta : v1.12
|
||||||
//
|
//
|
||||||
// Add support for volume plugins to report node specific
|
// Add support for volume plugins to report node specific
|
||||||
// volume limits
|
// volume limits
|
||||||
|
|
@ -386,6 +386,16 @@ const (
|
||||||
//
|
//
|
||||||
// Allow TTL controller to clean up Pods and Jobs after they finish.
|
// Allow TTL controller to clean up Pods and Jobs after they finish.
|
||||||
TTLAfterFinished utilfeature.Feature = "TTLAfterFinished"
|
TTLAfterFinished utilfeature.Feature = "TTLAfterFinished"
|
||||||
|
|
||||||
|
// owner: @jsafrane
|
||||||
|
// Kubernetes skips attaching CSI volumes that don't require attachment.
|
||||||
|
//
|
||||||
|
CSISkipAttach utilfeature.Feature = "CSISkipAttach"
|
||||||
|
|
||||||
|
// owner: @jsafrane
|
||||||
|
//
|
||||||
|
// Kubelet sends pod information in NodePublish CSI call when a CSI driver wants so.
|
||||||
|
CSIPodInfo utilfeature.Feature = "CSIPodInfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -417,7 +427,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
||||||
QOSReserved: {Default: false, PreRelease: utilfeature.Alpha},
|
QOSReserved: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
ExpandPersistentVolumes: {Default: true, PreRelease: utilfeature.Beta},
|
ExpandPersistentVolumes: {Default: true, PreRelease: utilfeature.Beta},
|
||||||
ExpandInUsePersistentVolumes: {Default: false, PreRelease: utilfeature.Alpha},
|
ExpandInUsePersistentVolumes: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
AttachVolumeLimit: {Default: false, PreRelease: utilfeature.Alpha},
|
AttachVolumeLimit: {Default: false, PreRelease: utilfeature.Beta},
|
||||||
CPUManager: {Default: true, PreRelease: utilfeature.Beta},
|
CPUManager: {Default: true, PreRelease: utilfeature.Beta},
|
||||||
CPUCFSQuotaPeriod: {Default: false, PreRelease: utilfeature.Alpha},
|
CPUCFSQuotaPeriod: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
ServiceNodeExclusion: {Default: false, PreRelease: utilfeature.Alpha},
|
ServiceNodeExclusion: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
|
@ -442,7 +452,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
||||||
BalanceAttachedNodeVolumes: {Default: false, PreRelease: utilfeature.Alpha},
|
BalanceAttachedNodeVolumes: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
PodReadinessGates: {Default: true, PreRelease: utilfeature.Beta},
|
PodReadinessGates: {Default: true, PreRelease: utilfeature.Beta},
|
||||||
VolumeSubpathEnvExpansion: {Default: false, PreRelease: utilfeature.Alpha},
|
VolumeSubpathEnvExpansion: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
KubeletPluginsWatcher: {Default: false, PreRelease: utilfeature.Alpha},
|
KubeletPluginsWatcher: {Default: true, PreRelease: utilfeature.Beta},
|
||||||
ResourceQuotaScopeSelectors: {Default: true, PreRelease: utilfeature.Beta},
|
ResourceQuotaScopeSelectors: {Default: true, PreRelease: utilfeature.Beta},
|
||||||
CSIBlockVolume: {Default: false, PreRelease: utilfeature.Alpha},
|
CSIBlockVolume: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
RuntimeClass: {Default: false, PreRelease: utilfeature.Alpha},
|
RuntimeClass: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
|
@ -451,6 +461,8 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
||||||
VolumeSnapshotDataSource: {Default: false, PreRelease: utilfeature.Alpha},
|
VolumeSnapshotDataSource: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
ProcMountType: {Default: false, PreRelease: utilfeature.Alpha},
|
ProcMountType: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
TTLAfterFinished: {Default: false, PreRelease: utilfeature.Alpha},
|
TTLAfterFinished: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
CSISkipAttach: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
CSIPodInfo: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
|
||||||
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
||||||
// unintentionally on either side:
|
// unintentionally on either side:
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ go_library(
|
||||||
"kubelet.go",
|
"kubelet.go",
|
||||||
"kubelet_getters.go",
|
"kubelet_getters.go",
|
||||||
"kubelet_network.go",
|
"kubelet_network.go",
|
||||||
|
"kubelet_network_linux.go",
|
||||||
|
"kubelet_network_others.go",
|
||||||
"kubelet_node_status.go",
|
"kubelet_node_status.go",
|
||||||
"kubelet_pods.go",
|
"kubelet_pods.go",
|
||||||
"kubelet_resources.go",
|
"kubelet_resources.go",
|
||||||
|
|
@ -75,6 +77,7 @@ go_library(
|
||||||
"//pkg/kubelet/prober:go_default_library",
|
"//pkg/kubelet/prober:go_default_library",
|
||||||
"//pkg/kubelet/prober/results:go_default_library",
|
"//pkg/kubelet/prober/results:go_default_library",
|
||||||
"//pkg/kubelet/remote:go_default_library",
|
"//pkg/kubelet/remote:go_default_library",
|
||||||
|
"//pkg/kubelet/runtimeclass:go_default_library",
|
||||||
"//pkg/kubelet/secret:go_default_library",
|
"//pkg/kubelet/secret:go_default_library",
|
||||||
"//pkg/kubelet/server:go_default_library",
|
"//pkg/kubelet/server:go_default_library",
|
||||||
"//pkg/kubelet/server/portforward:go_default_library",
|
"//pkg/kubelet/server/portforward:go_default_library",
|
||||||
|
|
@ -127,6 +130,7 @@ go_library(
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/validation:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
|
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
||||||
|
|
@ -153,6 +157,7 @@ go_test(
|
||||||
"kubelet_getters_test.go",
|
"kubelet_getters_test.go",
|
||||||
"kubelet_network_test.go",
|
"kubelet_network_test.go",
|
||||||
"kubelet_node_status_test.go",
|
"kubelet_node_status_test.go",
|
||||||
|
"kubelet_pods_linux_test.go",
|
||||||
"kubelet_pods_test.go",
|
"kubelet_pods_test.go",
|
||||||
"kubelet_pods_windows_test.go",
|
"kubelet_pods_windows_test.go",
|
||||||
"kubelet_resources_test.go",
|
"kubelet_resources_test.go",
|
||||||
|
|
@ -170,7 +175,6 @@ go_test(
|
||||||
"//pkg/capabilities:go_default_library",
|
"//pkg/capabilities:go_default_library",
|
||||||
"//pkg/features:go_default_library",
|
"//pkg/features:go_default_library",
|
||||||
"//pkg/kubelet/apis:go_default_library",
|
"//pkg/kubelet/apis:go_default_library",
|
||||||
"//pkg/kubelet/apis/cri/runtime/v1alpha2:go_default_library",
|
|
||||||
"//pkg/kubelet/cadvisor/testing:go_default_library",
|
"//pkg/kubelet/cadvisor/testing:go_default_library",
|
||||||
"//pkg/kubelet/cm:go_default_library",
|
"//pkg/kubelet/cm:go_default_library",
|
||||||
"//pkg/kubelet/config:go_default_library",
|
"//pkg/kubelet/config:go_default_library",
|
||||||
|
|
@ -240,7 +244,12 @@ go_test(
|
||||||
"//vendor/github.com/google/cadvisor/info/v2:go_default_library",
|
"//vendor/github.com/google/cadvisor/info/v2:go_default_library",
|
||||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||||
"//vendor/github.com/stretchr/testify/require:go_default_library",
|
"//vendor/github.com/stretchr/testify/require:go_default_library",
|
||||||
],
|
] + select({
|
||||||
|
"@io_bazel_rules_go//go/platform:linux": [
|
||||||
|
"//pkg/kubelet/apis/cri/runtime/v1alpha2:go_default_library",
|
||||||
|
],
|
||||||
|
"//conditions:default": [],
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
|
|
@ -287,6 +296,7 @@ filegroup(
|
||||||
"//pkg/kubelet/prober:all-srcs",
|
"//pkg/kubelet/prober:all-srcs",
|
||||||
"//pkg/kubelet/qos:all-srcs",
|
"//pkg/kubelet/qos:all-srcs",
|
||||||
"//pkg/kubelet/remote:all-srcs",
|
"//pkg/kubelet/remote:all-srcs",
|
||||||
|
"//pkg/kubelet/runtimeclass:all-srcs",
|
||||||
"//pkg/kubelet/secret:all-srcs",
|
"//pkg/kubelet/secret:all-srcs",
|
||||||
"//pkg/kubelet/server:all-srcs",
|
"//pkg/kubelet/server:all-srcs",
|
||||||
"//pkg/kubelet/stats:all-srcs",
|
"//pkg/kubelet/stats:all-srcs",
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ filegroup(
|
||||||
"//pkg/kubelet/apis/deviceplugin/v1alpha:all-srcs",
|
"//pkg/kubelet/apis/deviceplugin/v1alpha:all-srcs",
|
||||||
"//pkg/kubelet/apis/deviceplugin/v1beta1:all-srcs",
|
"//pkg/kubelet/apis/deviceplugin/v1beta1:all-srcs",
|
||||||
"//pkg/kubelet/apis/pluginregistration/v1alpha1:all-srcs",
|
"//pkg/kubelet/apis/pluginregistration/v1alpha1:all-srcs",
|
||||||
|
"//pkg/kubelet/apis/pluginregistration/v1beta1:all-srcs",
|
||||||
"//pkg/kubelet/apis/stats/v1alpha1:all-srcs",
|
"//pkg/kubelet/apis/stats/v1alpha1:all-srcs",
|
||||||
],
|
],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ type ContainerManager interface {
|
||||||
type PodSandboxManager interface {
|
type PodSandboxManager interface {
|
||||||
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
|
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
|
||||||
// the sandbox is in ready state.
|
// the sandbox is in ready state.
|
||||||
RunPodSandbox(config *runtimeapi.PodSandboxConfig) (string, error)
|
RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error)
|
||||||
// StopPodSandbox stops the sandbox. If there are any running containers in the
|
// StopPodSandbox stops the sandbox. If there are any running containers in the
|
||||||
// sandbox, they should be force terminated.
|
// sandbox, they should be force terminated.
|
||||||
StopPodSandbox(podSandboxID string) error
|
StopPodSandbox(podSandboxID string) error
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,12 @@ message PluginInfo {
|
||||||
// should follow the extended resource name convention.
|
// should follow the extended resource name convention.
|
||||||
// For CSI, this is the CSI driver registrar name.
|
// For CSI, this is the CSI driver registrar name.
|
||||||
string name = 2;
|
string name = 2;
|
||||||
// Optional endpoint location. If found set by Kubelet component,
|
// Optional endpoint location. If found set by Kubelet component,
|
||||||
// Kubelet component will use this endpoint for specific requests.
|
// Kubelet component will use this endpoint for specific requests.
|
||||||
// This allows the plugin to register using one endpoint and possibly use
|
// This allows the plugin to register using one endpoint and possibly use
|
||||||
// a different socket for control operations. CSI uses this model to delegate
|
// a different socket for control operations. CSI uses this model to delegate
|
||||||
// its registration external from the plugin.
|
// its registration external from the plugin.
|
||||||
string endpoint = 3;
|
string endpoint = 3;
|
||||||
// Plugin service API versions the plugin supports.
|
// Plugin service API versions the plugin supports.
|
||||||
// For DevicePlugin, this maps to the deviceplugin API versions the
|
// For DevicePlugin, this maps to the deviceplugin API versions the
|
||||||
// plugin supports at the given socket.
|
// plugin supports at the given socket.
|
||||||
|
|
|
||||||
3
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_sandbox.go
generated
vendored
3
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/dockershim/docker_sandbox.go
generated
vendored
|
|
@ -96,6 +96,9 @@ func (ds *dockerService) RunPodSandbox(ctx context.Context, r *runtimeapi.RunPod
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: Create the sandbox container.
|
// Step 2: Create the sandbox container.
|
||||||
|
if r.GetRuntimeHandler() != "" {
|
||||||
|
return nil, fmt.Errorf("RuntimeHandler %q not supported", r.GetRuntimeHandler())
|
||||||
|
}
|
||||||
createConfig, err := ds.makeSandboxDockerConfig(config, image)
|
createConfig, err := ds.makeSandboxDockerConfig(config, image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to make sandbox docker config for pod %q: %v", config.Metadata.Name, err)
|
return nil, fmt.Errorf("failed to make sandbox docker config for pod %q: %v", config.Metadata.Name, err)
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/client-go/dynamic"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
corelisters "k8s.io/client-go/listers/core/v1"
|
corelisters "k8s.io/client-go/listers/core/v1"
|
||||||
|
|
@ -87,6 +88,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/kubelet/prober"
|
"k8s.io/kubernetes/pkg/kubelet/prober"
|
||||||
proberesults "k8s.io/kubernetes/pkg/kubelet/prober/results"
|
proberesults "k8s.io/kubernetes/pkg/kubelet/prober/results"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/remote"
|
"k8s.io/kubernetes/pkg/kubelet/remote"
|
||||||
|
"k8s.io/kubernetes/pkg/kubelet/runtimeclass"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/secret"
|
"k8s.io/kubernetes/pkg/kubelet/secret"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/server"
|
"k8s.io/kubernetes/pkg/kubelet/server"
|
||||||
serverstats "k8s.io/kubernetes/pkg/kubelet/server/stats"
|
serverstats "k8s.io/kubernetes/pkg/kubelet/server/stats"
|
||||||
|
|
@ -245,6 +247,7 @@ type Dependencies struct {
|
||||||
OnHeartbeatFailure func()
|
OnHeartbeatFailure func()
|
||||||
KubeClient clientset.Interface
|
KubeClient clientset.Interface
|
||||||
CSIClient csiclientset.Interface
|
CSIClient csiclientset.Interface
|
||||||
|
DynamicKubeClient dynamic.Interface
|
||||||
Mounter mount.Interface
|
Mounter mount.Interface
|
||||||
OOMAdjuster *oom.OOMAdjuster
|
OOMAdjuster *oom.OOMAdjuster
|
||||||
OSInterface kubecontainer.OSInterface
|
OSInterface kubecontainer.OSInterface
|
||||||
|
|
@ -653,6 +656,11 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
klet.runtimeService = runtimeService
|
klet.runtimeService = runtimeService
|
||||||
|
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.RuntimeClass) {
|
||||||
|
klet.runtimeClassManager = runtimeclass.NewManager(kubeDeps.DynamicKubeClient)
|
||||||
|
}
|
||||||
|
|
||||||
runtime, err := kuberuntime.NewKubeGenericRuntimeManager(
|
runtime, err := kuberuntime.NewKubeGenericRuntimeManager(
|
||||||
kubecontainer.FilterEventRecorder(kubeDeps.Recorder),
|
kubecontainer.FilterEventRecorder(kubeDeps.Recorder),
|
||||||
klet.livenessManager,
|
klet.livenessManager,
|
||||||
|
|
@ -673,6 +681,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||||
imageService,
|
imageService,
|
||||||
kubeDeps.ContainerManager.InternalContainerLifecycle(),
|
kubeDeps.ContainerManager.InternalContainerLifecycle(),
|
||||||
legacyLogProvider,
|
legacyLogProvider,
|
||||||
|
klet.runtimeClassManager,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -1192,6 +1201,9 @@ type Kubelet struct {
|
||||||
|
|
||||||
// This flag indicates that kubelet should start plugin watcher utility server for discovering Kubelet plugins
|
// This flag indicates that kubelet should start plugin watcher utility server for discovering Kubelet plugins
|
||||||
enablePluginsWatcher bool
|
enablePluginsWatcher bool
|
||||||
|
|
||||||
|
// Handles RuntimeClass objects for the Kubelet.
|
||||||
|
runtimeClassManager *runtimeclass.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
func allGlobalUnicastIPs() ([]net.IP, error) {
|
func allGlobalUnicastIPs() ([]net.IP, error) {
|
||||||
|
|
@ -1412,6 +1424,11 @@ func (kl *Kubelet) Run(updates <-chan kubetypes.PodUpdate) {
|
||||||
kl.statusManager.Start()
|
kl.statusManager.Start()
|
||||||
kl.probeManager.Start()
|
kl.probeManager.Start()
|
||||||
|
|
||||||
|
// Start syncing RuntimeClasses if enabled.
|
||||||
|
if kl.runtimeClassManager != nil {
|
||||||
|
go kl.runtimeClassManager.Run(wait.NeverStop)
|
||||||
|
}
|
||||||
|
|
||||||
// Start the pod lifecycle event generator.
|
// Start the pod lifecycle event generator.
|
||||||
kl.pleg.Start()
|
kl.pleg.Start()
|
||||||
kl.syncLoop(updates, kl)
|
kl.syncLoop(updates, kl)
|
||||||
|
|
|
||||||
|
|
@ -77,91 +77,6 @@ func (kl *Kubelet) updatePodCIDR(cidr string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// syncNetworkUtil ensures the network utility are present on host.
|
|
||||||
// Network util includes:
|
|
||||||
// 1. In nat table, KUBE-MARK-DROP rule to mark connections for dropping
|
|
||||||
// Marked connection will be drop on INPUT/OUTPUT Chain in filter table
|
|
||||||
// 2. In nat table, KUBE-MARK-MASQ rule to mark connections for SNAT
|
|
||||||
// Marked connection will get SNAT on POSTROUTING Chain in nat table
|
|
||||||
func (kl *Kubelet) syncNetworkUtil() {
|
|
||||||
if kl.iptablesMasqueradeBit < 0 || kl.iptablesMasqueradeBit > 31 {
|
|
||||||
glog.Errorf("invalid iptables-masquerade-bit %v not in [0, 31]", kl.iptablesMasqueradeBit)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if kl.iptablesDropBit < 0 || kl.iptablesDropBit > 31 {
|
|
||||||
glog.Errorf("invalid iptables-drop-bit %v not in [0, 31]", kl.iptablesDropBit)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if kl.iptablesDropBit == kl.iptablesMasqueradeBit {
|
|
||||||
glog.Errorf("iptables-masquerade-bit %v and iptables-drop-bit %v must be different", kl.iptablesMasqueradeBit, kl.iptablesDropBit)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup KUBE-MARK-DROP rules
|
|
||||||
dropMark := getIPTablesMark(kl.iptablesDropBit)
|
|
||||||
if _, err := kl.iptClient.EnsureChain(utiliptables.TableNAT, KubeMarkDropChain); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure that %s chain %s exists: %v", utiliptables.TableNAT, KubeMarkDropChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureRule(utiliptables.Append, utiliptables.TableNAT, KubeMarkDropChain, "-j", "MARK", "--set-xmark", dropMark); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure marking rule for %v: %v", KubeMarkDropChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureChain(utiliptables.TableFilter, KubeFirewallChain); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure that %s chain %s exists: %v", utiliptables.TableFilter, KubeFirewallChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureRule(utiliptables.Append, utiliptables.TableFilter, KubeFirewallChain,
|
|
||||||
"-m", "comment", "--comment", "kubernetes firewall for dropping marked packets",
|
|
||||||
"-m", "mark", "--mark", dropMark,
|
|
||||||
"-j", "DROP"); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure rule to drop packet marked by %v in %v chain %v: %v", KubeMarkDropChain, utiliptables.TableFilter, KubeFirewallChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableFilter, utiliptables.ChainOutput, "-j", string(KubeFirewallChain)); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", utiliptables.TableFilter, utiliptables.ChainOutput, KubeFirewallChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableFilter, utiliptables.ChainInput, "-j", string(KubeFirewallChain)); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", utiliptables.TableFilter, utiliptables.ChainInput, KubeFirewallChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup KUBE-MARK-MASQ rules
|
|
||||||
masqueradeMark := getIPTablesMark(kl.iptablesMasqueradeBit)
|
|
||||||
if _, err := kl.iptClient.EnsureChain(utiliptables.TableNAT, KubeMarkMasqChain); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure that %s chain %s exists: %v", utiliptables.TableNAT, KubeMarkMasqChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureChain(utiliptables.TableNAT, KubePostroutingChain); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure that %s chain %s exists: %v", utiliptables.TableNAT, KubePostroutingChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureRule(utiliptables.Append, utiliptables.TableNAT, KubeMarkMasqChain, "-j", "MARK", "--set-xmark", masqueradeMark); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure marking rule for %v: %v", KubeMarkMasqChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableNAT, utiliptables.ChainPostrouting,
|
|
||||||
"-m", "comment", "--comment", "kubernetes postrouting rules", "-j", string(KubePostroutingChain)); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", utiliptables.TableNAT, utiliptables.ChainPostrouting, KubePostroutingChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err := kl.iptClient.EnsureRule(utiliptables.Append, utiliptables.TableNAT, KubePostroutingChain,
|
|
||||||
"-m", "comment", "--comment", "kubernetes service traffic requiring SNAT",
|
|
||||||
"-m", "mark", "--mark", masqueradeMark, "-j", "MASQUERADE"); err != nil {
|
|
||||||
glog.Errorf("Failed to ensure SNAT rule for packets marked by %v in %v chain %v: %v", KubeMarkMasqChain, utiliptables.TableNAT, KubePostroutingChain, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// getIPTablesMark returns the fwmark given the bit
|
|
||||||
func getIPTablesMark(bit int) string {
|
|
||||||
value := 1 << uint(bit)
|
|
||||||
return fmt.Sprintf("%#08x/%#08x", value, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPodDNS returns DNS settings for the pod.
|
// GetPodDNS returns DNS settings for the pod.
|
||||||
// This function is defined in kubecontainer.RuntimeHelper interface so we
|
// This function is defined in kubecontainer.RuntimeHelper interface so we
|
||||||
// have to implement it.
|
// have to implement it.
|
||||||
|
|
|
||||||
111
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_network_linux.go
generated
vendored
Normal file
111
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/kubelet_network_linux.go
generated
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
// +build linux
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package kubelet
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
|
utiliptables "k8s.io/kubernetes/pkg/util/iptables"
|
||||||
|
)
|
||||||
|
|
||||||
|
// syncNetworkUtil ensures the network utility are present on host.
|
||||||
|
// Network util includes:
|
||||||
|
// 1. In nat table, KUBE-MARK-DROP rule to mark connections for dropping
|
||||||
|
// Marked connection will be drop on INPUT/OUTPUT Chain in filter table
|
||||||
|
// 2. In nat table, KUBE-MARK-MASQ rule to mark connections for SNAT
|
||||||
|
// Marked connection will get SNAT on POSTROUTING Chain in nat table
|
||||||
|
func (kl *Kubelet) syncNetworkUtil() {
|
||||||
|
if kl.iptablesMasqueradeBit < 0 || kl.iptablesMasqueradeBit > 31 {
|
||||||
|
glog.Errorf("invalid iptables-masquerade-bit %v not in [0, 31]", kl.iptablesMasqueradeBit)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if kl.iptablesDropBit < 0 || kl.iptablesDropBit > 31 {
|
||||||
|
glog.Errorf("invalid iptables-drop-bit %v not in [0, 31]", kl.iptablesDropBit)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if kl.iptablesDropBit == kl.iptablesMasqueradeBit {
|
||||||
|
glog.Errorf("iptables-masquerade-bit %v and iptables-drop-bit %v must be different", kl.iptablesMasqueradeBit, kl.iptablesDropBit)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup KUBE-MARK-DROP rules
|
||||||
|
dropMark := getIPTablesMark(kl.iptablesDropBit)
|
||||||
|
if _, err := kl.iptClient.EnsureChain(utiliptables.TableNAT, KubeMarkDropChain); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure that %s chain %s exists: %v", utiliptables.TableNAT, KubeMarkDropChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureRule(utiliptables.Append, utiliptables.TableNAT, KubeMarkDropChain, "-j", "MARK", "--set-xmark", dropMark); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure marking rule for %v: %v", KubeMarkDropChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureChain(utiliptables.TableFilter, KubeFirewallChain); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure that %s chain %s exists: %v", utiliptables.TableFilter, KubeFirewallChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureRule(utiliptables.Append, utiliptables.TableFilter, KubeFirewallChain,
|
||||||
|
"-m", "comment", "--comment", "kubernetes firewall for dropping marked packets",
|
||||||
|
"-m", "mark", "--mark", dropMark,
|
||||||
|
"-j", "DROP"); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure rule to drop packet marked by %v in %v chain %v: %v", KubeMarkDropChain, utiliptables.TableFilter, KubeFirewallChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableFilter, utiliptables.ChainOutput, "-j", string(KubeFirewallChain)); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", utiliptables.TableFilter, utiliptables.ChainOutput, KubeFirewallChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableFilter, utiliptables.ChainInput, "-j", string(KubeFirewallChain)); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", utiliptables.TableFilter, utiliptables.ChainInput, KubeFirewallChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup KUBE-MARK-MASQ rules
|
||||||
|
masqueradeMark := getIPTablesMark(kl.iptablesMasqueradeBit)
|
||||||
|
if _, err := kl.iptClient.EnsureChain(utiliptables.TableNAT, KubeMarkMasqChain); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure that %s chain %s exists: %v", utiliptables.TableNAT, KubeMarkMasqChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureChain(utiliptables.TableNAT, KubePostroutingChain); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure that %s chain %s exists: %v", utiliptables.TableNAT, KubePostroutingChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureRule(utiliptables.Append, utiliptables.TableNAT, KubeMarkMasqChain, "-j", "MARK", "--set-xmark", masqueradeMark); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure marking rule for %v: %v", KubeMarkMasqChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableNAT, utiliptables.ChainPostrouting,
|
||||||
|
"-m", "comment", "--comment", "kubernetes postrouting rules", "-j", string(KubePostroutingChain)); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure that %s chain %s jumps to %s: %v", utiliptables.TableNAT, utiliptables.ChainPostrouting, KubePostroutingChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, err := kl.iptClient.EnsureRule(utiliptables.Append, utiliptables.TableNAT, KubePostroutingChain,
|
||||||
|
"-m", "comment", "--comment", "kubernetes service traffic requiring SNAT",
|
||||||
|
"-m", "mark", "--mark", masqueradeMark, "-j", "MASQUERADE"); err != nil {
|
||||||
|
glog.Errorf("Failed to ensure SNAT rule for packets marked by %v in %v chain %v: %v", KubeMarkMasqChain, utiliptables.TableNAT, KubePostroutingChain, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getIPTablesMark returns the fwmark given the bit
|
||||||
|
func getIPTablesMark(bit int) string {
|
||||||
|
value := 1 << uint(bit)
|
||||||
|
return fmt.Sprintf("%#08x/%#08x", value, value)
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build !linux
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2018 The Kubernetes Authors.
|
Copyright 2018 The Kubernetes Authors.
|
||||||
|
|
||||||
|
|
@ -14,6 +16,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// +k8s:deepcopy-gen=package
|
package kubelet
|
||||||
|
|
||||||
package config
|
// Do nothing.
|
||||||
|
func (kl *Kubelet) syncNetworkUtil() {}
|
||||||
|
|
@ -45,6 +45,7 @@ go_library(
|
||||||
"//pkg/kubelet/lifecycle:go_default_library",
|
"//pkg/kubelet/lifecycle:go_default_library",
|
||||||
"//pkg/kubelet/metrics:go_default_library",
|
"//pkg/kubelet/metrics:go_default_library",
|
||||||
"//pkg/kubelet/prober/results:go_default_library",
|
"//pkg/kubelet/prober/results:go_default_library",
|
||||||
|
"//pkg/kubelet/runtimeclass:go_default_library",
|
||||||
"//pkg/kubelet/types:go_default_library",
|
"//pkg/kubelet/types:go_default_library",
|
||||||
"//pkg/kubelet/util/cache:go_default_library",
|
"//pkg/kubelet/util/cache:go_default_library",
|
||||||
"//pkg/kubelet/util/format:go_default_library",
|
"//pkg/kubelet/util/format:go_default_library",
|
||||||
|
|
@ -106,6 +107,8 @@ go_test(
|
||||||
"//pkg/kubelet/container/testing:go_default_library",
|
"//pkg/kubelet/container/testing:go_default_library",
|
||||||
"//pkg/kubelet/lifecycle:go_default_library",
|
"//pkg/kubelet/lifecycle:go_default_library",
|
||||||
"//pkg/kubelet/metrics:go_default_library",
|
"//pkg/kubelet/metrics:go_default_library",
|
||||||
|
"//pkg/kubelet/runtimeclass:go_default_library",
|
||||||
|
"//pkg/kubelet/runtimeclass/testing:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
|
|
@ -119,6 +122,7 @@ go_test(
|
||||||
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
"//vendor/github.com/prometheus/client_golang/prometheus:go_default_library",
|
||||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||||
"//vendor/github.com/stretchr/testify/require:go_default_library",
|
"//vendor/github.com/stretchr/testify/require:go_default_library",
|
||||||
|
"//vendor/k8s.io/utils/pointer:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,11 +176,11 @@ func (in instrumentedRuntimeService) Attach(req *runtimeapi.AttachRequest) (*run
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (in instrumentedRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig) (string, error) {
|
func (in instrumentedRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error) {
|
||||||
const operation = "run_podsandbox"
|
const operation = "run_podsandbox"
|
||||||
defer recordOperation(operation, time.Now())
|
defer recordOperation(operation, time.Now())
|
||||||
|
|
||||||
out, err := in.service.RunPodSandbox(config)
|
out, err := in.service.RunPodSandbox(config, runtimeHandler)
|
||||||
recordError(operation, err)
|
recordError(operation, err)
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/kubelet/images"
|
"k8s.io/kubernetes/pkg/kubelet/images"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
|
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
|
||||||
proberesults "k8s.io/kubernetes/pkg/kubelet/prober/results"
|
proberesults "k8s.io/kubernetes/pkg/kubelet/prober/results"
|
||||||
|
"k8s.io/kubernetes/pkg/kubelet/runtimeclass"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/types"
|
"k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/util/cache"
|
"k8s.io/kubernetes/pkg/kubelet/util/cache"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/util/format"
|
"k8s.io/kubernetes/pkg/kubelet/util/format"
|
||||||
|
|
@ -119,6 +120,9 @@ type kubeGenericRuntimeManager struct {
|
||||||
|
|
||||||
// A shim to legacy functions for backward compatibility.
|
// A shim to legacy functions for backward compatibility.
|
||||||
legacyLogProvider LegacyLogProvider
|
legacyLogProvider LegacyLogProvider
|
||||||
|
|
||||||
|
// Manage RuntimeClass resources.
|
||||||
|
runtimeClassManager *runtimeclass.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
type KubeGenericRuntime interface {
|
type KubeGenericRuntime interface {
|
||||||
|
|
@ -154,6 +158,7 @@ func NewKubeGenericRuntimeManager(
|
||||||
imageService internalapi.ImageManagerService,
|
imageService internalapi.ImageManagerService,
|
||||||
internalLifecycle cm.InternalContainerLifecycle,
|
internalLifecycle cm.InternalContainerLifecycle,
|
||||||
legacyLogProvider LegacyLogProvider,
|
legacyLogProvider LegacyLogProvider,
|
||||||
|
runtimeClassManager *runtimeclass.Manager,
|
||||||
) (KubeGenericRuntime, error) {
|
) (KubeGenericRuntime, error) {
|
||||||
kubeRuntimeManager := &kubeGenericRuntimeManager{
|
kubeRuntimeManager := &kubeGenericRuntimeManager{
|
||||||
recorder: recorder,
|
recorder: recorder,
|
||||||
|
|
@ -170,6 +175,7 @@ func NewKubeGenericRuntimeManager(
|
||||||
keyring: credentialprovider.NewDockerKeyring(),
|
keyring: credentialprovider.NewDockerKeyring(),
|
||||||
internalLifecycle: internalLifecycle,
|
internalLifecycle: internalLifecycle,
|
||||||
legacyLogProvider: legacyLogProvider,
|
legacyLogProvider: legacyLogProvider,
|
||||||
|
runtimeClassManager: runtimeClassManager,
|
||||||
}
|
}
|
||||||
|
|
||||||
typedVersion, err := kubeRuntimeManager.runtimeService.Version(kubeRuntimeAPIVersion)
|
typedVersion, err := kubeRuntimeManager.runtimeService.Version(kubeRuntimeAPIVersion)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,16 @@ func (m *kubeGenericRuntimeManager) createPodSandbox(pod *v1.Pod, attempt uint32
|
||||||
return "", message, err
|
return "", message, err
|
||||||
}
|
}
|
||||||
|
|
||||||
podSandBoxID, err := m.runtimeService.RunPodSandbox(podSandboxConfig)
|
runtimeHandler := ""
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.RuntimeClass) {
|
||||||
|
runtimeHandler, err = m.runtimeClassManager.LookupRuntimeHandler(pod.Spec.RuntimeClassName)
|
||||||
|
if err != nil {
|
||||||
|
message := fmt.Sprintf("CreatePodSandbox for pod %q failed: %v", format.Pod(pod), err)
|
||||||
|
return "", message, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
podSandBoxID, err := m.runtimeService.RunPodSandbox(podSandboxConfig, runtimeHandler)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
message := fmt.Sprintf("CreatePodSandbox for pod %q failed: %v", format.Pod(pod), err)
|
message := fmt.Sprintf("CreatePodSandbox for pod %q failed: %v", format.Pod(pod), err)
|
||||||
glog.Error(message)
|
glog.Error(message)
|
||||||
|
|
|
||||||
5
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/remote/remote_runtime.go
generated
vendored
5
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/remote/remote_runtime.go
generated
vendored
|
|
@ -79,14 +79,15 @@ func (r *RemoteRuntimeService) Version(apiVersion string) (*runtimeapi.VersionRe
|
||||||
|
|
||||||
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
|
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
|
||||||
// the sandbox is in ready state.
|
// the sandbox is in ready state.
|
||||||
func (r *RemoteRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig) (string, error) {
|
func (r *RemoteRuntimeService) RunPodSandbox(config *runtimeapi.PodSandboxConfig, runtimeHandler string) (string, error) {
|
||||||
// Use 2 times longer timeout for sandbox operation (4 mins by default)
|
// Use 2 times longer timeout for sandbox operation (4 mins by default)
|
||||||
// TODO: Make the pod sandbox timeout configurable.
|
// TODO: Make the pod sandbox timeout configurable.
|
||||||
ctx, cancel := getContextWithTimeout(r.timeout * 2)
|
ctx, cancel := getContextWithTimeout(r.timeout * 2)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
resp, err := r.runtimeClient.RunPodSandbox(ctx, &runtimeapi.RunPodSandboxRequest{
|
resp, err := r.runtimeClient.RunPodSandbox(ctx, &runtimeapi.RunPodSandboxRequest{
|
||||||
Config: config,
|
Config: config,
|
||||||
|
RuntimeHandler: runtimeHandler,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("RunPodSandbox from runtime service failed: %v", err)
|
glog.Errorf("RunPodSandbox from runtime service failed: %v", err)
|
||||||
|
|
|
||||||
45
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/runtimeclass/BUILD
generated
vendored
Normal file
45
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/runtimeclass/BUILD
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = ["runtimeclass_manager.go"],
|
||||||
|
importpath = "k8s.io/kubernetes/pkg/kubelet/runtimeclass",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
deps = [
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
|
||||||
|
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "package-srcs",
|
||||||
|
srcs = glob(["**"]),
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "all-srcs",
|
||||||
|
srcs = [
|
||||||
|
":package-srcs",
|
||||||
|
"//pkg/kubelet/runtimeclass/testing:all-srcs",
|
||||||
|
],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["runtimeclass_manager_test.go"],
|
||||||
|
embed = [":go_default_library"],
|
||||||
|
deps = [
|
||||||
|
"//pkg/kubelet/runtimeclass/testing:go_default_library",
|
||||||
|
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||||
|
"//vendor/k8s.io/utils/pointer:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
97
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/runtimeclass/runtimeclass_manager.go
generated
vendored
Normal file
97
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/kubelet/runtimeclass/runtimeclass_manager.go
generated
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
Copyright 2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package runtimeclass
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
"k8s.io/client-go/dynamic"
|
||||||
|
"k8s.io/client-go/tools/cache"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
runtimeClassGVR = schema.GroupVersionResource{
|
||||||
|
Group: "node.k8s.io",
|
||||||
|
Version: "v1alpha1",
|
||||||
|
Resource: "runtimeclasses",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Manager caches RuntimeClass API objects, and provides accessors to the Kubelet.
|
||||||
|
type Manager struct {
|
||||||
|
informer cache.SharedInformer
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewManager returns a new RuntimeClass Manager. Run must be called before the manager can be used.
|
||||||
|
func NewManager(client dynamic.Interface) *Manager {
|
||||||
|
rc := client.Resource(runtimeClassGVR)
|
||||||
|
lw := &cache.ListWatch{
|
||||||
|
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
|
return rc.List(options)
|
||||||
|
},
|
||||||
|
WatchFunc: rc.Watch,
|
||||||
|
}
|
||||||
|
informer := cache.NewSharedInformer(lw, &unstructured.Unstructured{}, 0)
|
||||||
|
|
||||||
|
return &Manager{
|
||||||
|
informer: informer,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run starts syncing the RuntimeClass cache with the apiserver.
|
||||||
|
func (m *Manager) Run(stopCh <-chan struct{}) {
|
||||||
|
m.informer.Run(stopCh)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LookupRuntimeHandler returns the RuntimeHandler string associated with the given RuntimeClass
|
||||||
|
// name (or the default of "" for nil). If the RuntimeClass is not found, it returns an
|
||||||
|
// apierrors.NotFound error.
|
||||||
|
func (m *Manager) LookupRuntimeHandler(runtimeClassName *string) (string, error) {
|
||||||
|
if runtimeClassName == nil || *runtimeClassName == "" {
|
||||||
|
// The default RuntimeClass always resolves to the empty runtime handler.
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
name := *runtimeClassName
|
||||||
|
item, exists, err := m.informer.GetStore().GetByKey(name)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Failed to lookup RuntimeClass %s: %v", name, err)
|
||||||
|
}
|
||||||
|
if !exists {
|
||||||
|
return "", errors.NewNotFound(schema.GroupResource{
|
||||||
|
Group: runtimeClassGVR.Group,
|
||||||
|
Resource: runtimeClassGVR.Resource,
|
||||||
|
}, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
rc, ok := item.(*unstructured.Unstructured)
|
||||||
|
if !ok {
|
||||||
|
return "", fmt.Errorf("unexpected RuntimeClass type %T", item)
|
||||||
|
}
|
||||||
|
|
||||||
|
handler, _, err := unstructured.NestedString(rc.Object, "spec", "runtimeHandler")
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Invalid RuntimeClass object: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return handler, nil
|
||||||
|
}
|
||||||
|
|
@ -325,7 +325,7 @@ export KUBE_PROXY_MODE=ipvs
|
||||||
|
|
||||||
Similar to local-up cluster, kube-proxy in [clusters running on GCE](https://kubernetes.io/docs/getting-started-guides/gce/) run in iptables mode by default. Users need to export the env `KUBE_PROXY_MODE=ipvs` before [starting a cluster](https://kubernetes.io/docs/getting-started-guides/gce/#starting-a-cluster):
|
Similar to local-up cluster, kube-proxy in [clusters running on GCE](https://kubernetes.io/docs/getting-started-guides/gce/) run in iptables mode by default. Users need to export the env `KUBE_PROXY_MODE=ipvs` before [starting a cluster](https://kubernetes.io/docs/getting-started-guides/gce/#starting-a-cluster):
|
||||||
```shell
|
```shell
|
||||||
#before running one of the commmands chosen to start a cluster:
|
#before running one of the commands chosen to start a cluster:
|
||||||
# curl -sS https://get.k8s.io | bash
|
# curl -sS https://get.k8s.io | bash
|
||||||
# wget -q -O - https://get.k8s.io | bash
|
# wget -q -O - https://get.k8s.io | bash
|
||||||
# cluster/kube-up.sh
|
# cluster/kube-up.sh
|
||||||
|
|
|
||||||
2
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/algorithm/predicates/BUILD
generated
vendored
2
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/algorithm/predicates/BUILD
generated
vendored
|
|
@ -9,6 +9,7 @@ load(
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = [
|
srcs = [
|
||||||
|
"csi_volume_predicate.go",
|
||||||
"error.go",
|
"error.go",
|
||||||
"metadata.go",
|
"metadata.go",
|
||||||
"predicates.go",
|
"predicates.go",
|
||||||
|
|
@ -46,6 +47,7 @@ go_library(
|
||||||
go_test(
|
go_test(
|
||||||
name = "go_default_test",
|
name = "go_default_test",
|
||||||
srcs = [
|
srcs = [
|
||||||
|
"csi_volume_predicate_test.go",
|
||||||
"max_attachable_volume_predicate_test.go",
|
"max_attachable_volume_predicate_test.go",
|
||||||
"metadata_test.go",
|
"metadata_test.go",
|
||||||
"predicates_test.go",
|
"predicates_test.go",
|
||||||
|
|
|
||||||
157
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/algorithm/predicates/csi_volume_predicate.go
generated
vendored
Normal file
157
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/algorithm/predicates/csi_volume_predicate.go
generated
vendored
Normal file
|
|
@ -0,0 +1,157 @@
|
||||||
|
/*
|
||||||
|
Copyright 2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package predicates
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
|
"k8s.io/api/core/v1"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/algorithm"
|
||||||
|
schedulercache "k8s.io/kubernetes/pkg/scheduler/cache"
|
||||||
|
volumeutil "k8s.io/kubernetes/pkg/volume/util"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CSIMaxVolumeLimitChecker defines predicate needed for counting CSI volumes
|
||||||
|
type CSIMaxVolumeLimitChecker struct {
|
||||||
|
pvInfo PersistentVolumeInfo
|
||||||
|
pvcInfo PersistentVolumeClaimInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewCSIMaxVolumeLimitPredicate returns a predicate for counting CSI volumes
|
||||||
|
func NewCSIMaxVolumeLimitPredicate(
|
||||||
|
pvInfo PersistentVolumeInfo, pvcInfo PersistentVolumeClaimInfo) algorithm.FitPredicate {
|
||||||
|
c := &CSIMaxVolumeLimitChecker{
|
||||||
|
pvInfo: pvInfo,
|
||||||
|
pvcInfo: pvcInfo,
|
||||||
|
}
|
||||||
|
return c.attachableLimitPredicate
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CSIMaxVolumeLimitChecker) attachableLimitPredicate(
|
||||||
|
pod *v1.Pod, meta algorithm.PredicateMetadata, nodeInfo *schedulercache.NodeInfo) (bool, []algorithm.PredicateFailureReason, error) {
|
||||||
|
|
||||||
|
// if feature gate is disable we return
|
||||||
|
if !utilfeature.DefaultFeatureGate.Enabled(features.AttachVolumeLimit) {
|
||||||
|
return true, nil, nil
|
||||||
|
}
|
||||||
|
// If a pod doesn't have any volume attached to it, the predicate will always be true.
|
||||||
|
// Thus we make a fast path for it, to avoid unnecessary computations in this case.
|
||||||
|
if len(pod.Spec.Volumes) == 0 {
|
||||||
|
return true, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeVolumeLimits := nodeInfo.VolumeLimits()
|
||||||
|
|
||||||
|
// if node does not have volume limits this predicate should exit
|
||||||
|
if len(nodeVolumeLimits) == 0 {
|
||||||
|
return true, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// a map of unique volume name/csi volume handle and volume limit key
|
||||||
|
newVolumes := make(map[string]string)
|
||||||
|
if err := c.filterAttachableVolumes(pod.Spec.Volumes, pod.Namespace, newVolumes); err != nil {
|
||||||
|
return false, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(newVolumes) == 0 {
|
||||||
|
return true, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// a map of unique volume name/csi volume handle and volume limit key
|
||||||
|
attachedVolumes := make(map[string]string)
|
||||||
|
for _, existingPod := range nodeInfo.Pods() {
|
||||||
|
if err := c.filterAttachableVolumes(existingPod.Spec.Volumes, existingPod.Namespace, attachedVolumes); err != nil {
|
||||||
|
return false, nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newVolumeCount := map[string]int{}
|
||||||
|
attachedVolumeCount := map[string]int{}
|
||||||
|
|
||||||
|
for volumeName, volumeLimitKey := range attachedVolumes {
|
||||||
|
if _, ok := newVolumes[volumeName]; ok {
|
||||||
|
delete(newVolumes, volumeName)
|
||||||
|
}
|
||||||
|
attachedVolumeCount[volumeLimitKey]++
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, volumeLimitKey := range newVolumes {
|
||||||
|
newVolumeCount[volumeLimitKey]++
|
||||||
|
}
|
||||||
|
|
||||||
|
for volumeLimitKey, count := range newVolumeCount {
|
||||||
|
maxVolumeLimit, ok := nodeVolumeLimits[v1.ResourceName(volumeLimitKey)]
|
||||||
|
if ok {
|
||||||
|
currentVolumeCount := attachedVolumeCount[volumeLimitKey]
|
||||||
|
if currentVolumeCount+count > int(maxVolumeLimit) {
|
||||||
|
return false, []algorithm.PredicateFailureReason{ErrMaxVolumeCountExceeded}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CSIMaxVolumeLimitChecker) filterAttachableVolumes(
|
||||||
|
volumes []v1.Volume, namespace string, result map[string]string) error {
|
||||||
|
|
||||||
|
for _, vol := range volumes {
|
||||||
|
// CSI volumes can only be used as persistent volumes
|
||||||
|
if vol.PersistentVolumeClaim == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
pvcName := vol.PersistentVolumeClaim.ClaimName
|
||||||
|
|
||||||
|
if pvcName == "" {
|
||||||
|
return fmt.Errorf("PersistentVolumeClaim had no name")
|
||||||
|
}
|
||||||
|
|
||||||
|
pvc, err := c.pvcInfo.GetPersistentVolumeClaimInfo(namespace, pvcName)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
glog.V(4).Infof("Unable to look up PVC info for %s/%s", namespace, pvcName)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
pvName := pvc.Spec.VolumeName
|
||||||
|
// TODO - the actual handling of unbound PVCs will be fixed by late binding design.
|
||||||
|
if pvName == "" {
|
||||||
|
glog.V(4).Infof("Persistent volume had no name for claim %s/%s", namespace, pvcName)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
pv, err := c.pvInfo.GetPersistentVolumeInfo(pvName)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
glog.V(4).Infof("Unable to look up PV info for PVC %s/%s and PV %s", namespace, pvcName, pvName)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
csiSource := pv.Spec.PersistentVolumeSource.CSI
|
||||||
|
if csiSource == nil {
|
||||||
|
glog.V(4).Infof("Not considering non-CSI volume %s/%s", namespace, pvcName)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
driverName := csiSource.Driver
|
||||||
|
volumeLimitKey := volumeutil.GetCSIAttachLimitKey(driverName)
|
||||||
|
result[csiSource.VolumeHandle] = volumeLimitKey
|
||||||
|
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -85,6 +85,8 @@ const (
|
||||||
MaxGCEPDVolumeCountPred = "MaxGCEPDVolumeCount"
|
MaxGCEPDVolumeCountPred = "MaxGCEPDVolumeCount"
|
||||||
// MaxAzureDiskVolumeCountPred defines the name of predicate MaxAzureDiskVolumeCount.
|
// MaxAzureDiskVolumeCountPred defines the name of predicate MaxAzureDiskVolumeCount.
|
||||||
MaxAzureDiskVolumeCountPred = "MaxAzureDiskVolumeCount"
|
MaxAzureDiskVolumeCountPred = "MaxAzureDiskVolumeCount"
|
||||||
|
// MaxCSIVolumeCountPred defines the predicate that decides how many CSI volumes should be attached
|
||||||
|
MaxCSIVolumeCountPred = "MaxCSIVolumeCountPred"
|
||||||
// NoVolumeZoneConflictPred defines the name of predicate NoVolumeZoneConflict.
|
// NoVolumeZoneConflictPred defines the name of predicate NoVolumeZoneConflict.
|
||||||
NoVolumeZoneConflictPred = "NoVolumeZoneConflict"
|
NoVolumeZoneConflictPred = "NoVolumeZoneConflict"
|
||||||
// CheckNodeMemoryPressurePred defines the name of predicate CheckNodeMemoryPressure.
|
// CheckNodeMemoryPressurePred defines the name of predicate CheckNodeMemoryPressure.
|
||||||
|
|
@ -137,7 +139,7 @@ var (
|
||||||
GeneralPred, HostNamePred, PodFitsHostPortsPred,
|
GeneralPred, HostNamePred, PodFitsHostPortsPred,
|
||||||
MatchNodeSelectorPred, PodFitsResourcesPred, NoDiskConflictPred,
|
MatchNodeSelectorPred, PodFitsResourcesPred, NoDiskConflictPred,
|
||||||
PodToleratesNodeTaintsPred, PodToleratesNodeNoExecuteTaintsPred, CheckNodeLabelPresencePred,
|
PodToleratesNodeTaintsPred, PodToleratesNodeNoExecuteTaintsPred, CheckNodeLabelPresencePred,
|
||||||
CheckServiceAffinityPred, MaxEBSVolumeCountPred, MaxGCEPDVolumeCountPred,
|
CheckServiceAffinityPred, MaxEBSVolumeCountPred, MaxGCEPDVolumeCountPred, MaxCSIVolumeCountPred,
|
||||||
MaxAzureDiskVolumeCountPred, CheckVolumeBindingPred, NoVolumeZoneConflictPred,
|
MaxAzureDiskVolumeCountPred, CheckVolumeBindingPred, NoVolumeZoneConflictPred,
|
||||||
CheckNodeMemoryPressurePred, CheckNodePIDPressurePred, CheckNodeDiskPressurePred, MatchInterPodAffinityPred}
|
CheckNodeMemoryPressurePred, CheckNodePIDPressurePred, CheckNodeDiskPressurePred, MatchInterPodAffinityPred}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,12 @@ func defaultPredicates() sets.String {
|
||||||
return predicates.NewMaxPDVolumeCountPredicate(predicates.AzureDiskVolumeFilterType, args.PVInfo, args.PVCInfo)
|
return predicates.NewMaxPDVolumeCountPredicate(predicates.AzureDiskVolumeFilterType, args.PVInfo, args.PVCInfo)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
factory.RegisterFitPredicateFactory(
|
||||||
|
predicates.MaxCSIVolumeCountPred,
|
||||||
|
func(args factory.PluginFactoryArgs) algorithm.FitPredicate {
|
||||||
|
return predicates.NewCSIMaxVolumeLimitPredicate(args.PVInfo, args.PVCInfo)
|
||||||
|
},
|
||||||
|
),
|
||||||
// Fit is determined by inter-pod affinity.
|
// Fit is determined by inter-pod affinity.
|
||||||
factory.RegisterFitPredicateFactory(
|
factory.RegisterFitPredicateFactory(
|
||||||
predicates.MatchInterPodAffinityPred,
|
predicates.MatchInterPodAffinityPred,
|
||||||
|
|
|
||||||
2
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/core/equivalence/BUILD
generated
vendored
2
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/core/equivalence/BUILD
generated
vendored
|
|
@ -6,6 +6,7 @@ go_library(
|
||||||
importpath = "k8s.io/kubernetes/pkg/scheduler/core/equivalence",
|
importpath = "k8s.io/kubernetes/pkg/scheduler/core/equivalence",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
"//pkg/scheduler/algorithm:go_default_library",
|
"//pkg/scheduler/algorithm:go_default_library",
|
||||||
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
||||||
"//pkg/scheduler/cache:go_default_library",
|
"//pkg/scheduler/cache:go_default_library",
|
||||||
|
|
@ -13,6 +14,7 @@ go_library(
|
||||||
"//pkg/util/hash:go_default_library",
|
"//pkg/util/hash:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
18
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/core/equivalence/eqivalence.go
generated
vendored
18
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/scheduler/core/equivalence/eqivalence.go
generated
vendored
|
|
@ -23,16 +23,16 @@ import (
|
||||||
"hash/fnv"
|
"hash/fnv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/scheduler/metrics"
|
"github.com/golang/glog"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
||||||
schedulercache "k8s.io/kubernetes/pkg/scheduler/cache"
|
schedulercache "k8s.io/kubernetes/pkg/scheduler/cache"
|
||||||
|
"k8s.io/kubernetes/pkg/scheduler/metrics"
|
||||||
hashutil "k8s.io/kubernetes/pkg/util/hash"
|
hashutil "k8s.io/kubernetes/pkg/util/hash"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cache is a thread safe map saves and reuses the output of predicate functions,
|
// Cache is a thread safe map saves and reuses the output of predicate functions,
|
||||||
|
|
@ -136,8 +136,16 @@ func (c *Cache) InvalidateCachedPredicateItemForPodAdd(pod *v1.Pod, nodeName str
|
||||||
// MaxPDVolumeCountPredicate: we check the volumes of pod to make decisioc.
|
// MaxPDVolumeCountPredicate: we check the volumes of pod to make decisioc.
|
||||||
for _, vol := range pod.Spec.Volumes {
|
for _, vol := range pod.Spec.Volumes {
|
||||||
if vol.PersistentVolumeClaim != nil {
|
if vol.PersistentVolumeClaim != nil {
|
||||||
invalidPredicates.Insert(predicates.MaxEBSVolumeCountPred, predicates.MaxGCEPDVolumeCountPred, predicates.MaxAzureDiskVolumeCountPred)
|
invalidPredicates.Insert(
|
||||||
|
predicates.MaxEBSVolumeCountPred,
|
||||||
|
predicates.MaxGCEPDVolumeCountPred,
|
||||||
|
predicates.MaxAzureDiskVolumeCountPred)
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.AttachVolumeLimit) {
|
||||||
|
invalidPredicates.Insert(predicates.MaxCSIVolumeCountPred)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// We do not consider CSI volumes here because CSI
|
||||||
|
// volumes can not be used inline.
|
||||||
if vol.AWSElasticBlockStore != nil {
|
if vol.AWSElasticBlockStore != nil {
|
||||||
invalidPredicates.Insert(predicates.MaxEBSVolumeCountPred)
|
invalidPredicates.Insert(predicates.MaxEBSVolumeCountPred)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -489,6 +489,10 @@ func (c *configFactory) invalidatePredicatesForPv(pv *v1.PersistentVolume) {
|
||||||
invalidPredicates.Insert(predicates.MaxAzureDiskVolumeCountPred)
|
invalidPredicates.Insert(predicates.MaxAzureDiskVolumeCountPred)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if pv.Spec.CSI != nil && utilfeature.DefaultFeatureGate.Enabled(features.AttachVolumeLimit) {
|
||||||
|
invalidPredicates.Insert(predicates.MaxCSIVolumeCountPred)
|
||||||
|
}
|
||||||
|
|
||||||
// If PV contains zone related label, it may impact cached NoVolumeZoneConflict
|
// If PV contains zone related label, it may impact cached NoVolumeZoneConflict
|
||||||
for k := range pv.Labels {
|
for k := range pv.Labels {
|
||||||
if isZoneRegionLabel(k) {
|
if isZoneRegionLabel(k) {
|
||||||
|
|
@ -565,6 +569,10 @@ func (c *configFactory) invalidatePredicatesForPvc(pvc *v1.PersistentVolumeClaim
|
||||||
// The bound volume type may change
|
// The bound volume type may change
|
||||||
invalidPredicates := sets.NewString(maxPDVolumeCountPredicateKeys...)
|
invalidPredicates := sets.NewString(maxPDVolumeCountPredicateKeys...)
|
||||||
|
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.AttachVolumeLimit) {
|
||||||
|
invalidPredicates.Insert(predicates.MaxCSIVolumeCountPred)
|
||||||
|
}
|
||||||
|
|
||||||
// The bound volume's label may change
|
// The bound volume's label may change
|
||||||
invalidPredicates.Insert(predicates.NoVolumeZoneConflictPred)
|
invalidPredicates.Insert(predicates.NoVolumeZoneConflictPred)
|
||||||
|
|
||||||
|
|
@ -585,6 +593,10 @@ func (c *configFactory) invalidatePredicatesForPvcUpdate(old, new *v1.Persistent
|
||||||
}
|
}
|
||||||
// The bound volume type may change
|
// The bound volume type may change
|
||||||
invalidPredicates.Insert(maxPDVolumeCountPredicateKeys...)
|
invalidPredicates.Insert(maxPDVolumeCountPredicateKeys...)
|
||||||
|
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.AttachVolumeLimit) {
|
||||||
|
invalidPredicates.Insert(predicates.MaxCSIVolumeCountPred)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c.equivalencePodCache.InvalidatePredicates(invalidPredicates)
|
c.equivalencePodCache.InvalidatePredicates(invalidPredicates)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package(default_visibility = ["//visibility:public"])
|
||||||
load(
|
load(
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
"go_library",
|
"go_library",
|
||||||
|
"go_test",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
|
|
@ -10,6 +11,7 @@ go_library(
|
||||||
srcs = ["flags.go"],
|
srcs = ["flags.go"],
|
||||||
importpath = "k8s.io/kubernetes/pkg/util/flag",
|
importpath = "k8s.io/kubernetes/pkg/util/flag",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
"//vendor/github.com/spf13/pflag:go_default_library",
|
"//vendor/github.com/spf13/pflag:go_default_library",
|
||||||
],
|
],
|
||||||
|
|
@ -27,3 +29,10 @@ filegroup(
|
||||||
srcs = [":package-srcs"],
|
srcs = [":package-srcs"],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["flags_test.go"],
|
||||||
|
embed = [":go_default_library"],
|
||||||
|
deps = ["//vendor/github.com/spf13/pflag:go_default_library"],
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,14 @@ limitations under the License.
|
||||||
package flag
|
package flag
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
|
||||||
|
utilnet "k8s.io/apimachinery/pkg/util/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PrintFlags logs the flags in the flagset
|
// PrintFlags logs the flags in the flagset
|
||||||
|
|
@ -27,3 +33,129 @@ func PrintFlags(flags *pflag.FlagSet) {
|
||||||
glog.V(1).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
|
glog.V(1).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(mikedanese): remove these flag wrapper types when we remove command line flags
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ pflag.Value = &IPVar{}
|
||||||
|
_ pflag.Value = &IPPortVar{}
|
||||||
|
_ pflag.Value = &PortRangeVar{}
|
||||||
|
)
|
||||||
|
|
||||||
|
// IPVar is used for validating a command line option that represents an IP. It implements the pflag.Value interface
|
||||||
|
type IPVar struct {
|
||||||
|
Val *string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set sets the flag value
|
||||||
|
func (v IPVar) Set(s string) error {
|
||||||
|
if len(s) == 0 {
|
||||||
|
v.Val = nil
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if net.ParseIP(s) == nil {
|
||||||
|
return fmt.Errorf("%q is not a valid IP address", s)
|
||||||
|
}
|
||||||
|
if v.Val == nil {
|
||||||
|
// it's okay to panic here since this is programmer error
|
||||||
|
panic("the string pointer passed into IPVar should not be nil")
|
||||||
|
}
|
||||||
|
*v.Val = s
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// String returns the flag value
|
||||||
|
func (v IPVar) String() string {
|
||||||
|
if v.Val == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *v.Val
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type gets the flag type
|
||||||
|
func (v IPVar) Type() string {
|
||||||
|
return "ip"
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPPortVar is used for validating a command line option that represents an IP and a port. It implements the pflag.Value interface
|
||||||
|
type IPPortVar struct {
|
||||||
|
Val *string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set sets the flag value
|
||||||
|
func (v IPPortVar) Set(s string) error {
|
||||||
|
if len(s) == 0 {
|
||||||
|
v.Val = nil
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.Val == nil {
|
||||||
|
// it's okay to panic here since this is programmer error
|
||||||
|
panic("the string pointer passed into IPPortVar should not be nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Both IP and IP:port are valid.
|
||||||
|
// Attempt to parse into IP first.
|
||||||
|
if net.ParseIP(s) != nil {
|
||||||
|
*v.Val = s
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can not parse into IP, now assume IP:port.
|
||||||
|
host, port, err := net.SplitHostPort(s)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("%q is not in a valid format (ip or ip:port): %v", s, err)
|
||||||
|
}
|
||||||
|
if net.ParseIP(host) == nil {
|
||||||
|
return fmt.Errorf("%q is not a valid IP address", host)
|
||||||
|
}
|
||||||
|
if _, err := strconv.Atoi(port); err != nil {
|
||||||
|
return fmt.Errorf("%q is not a valid number", port)
|
||||||
|
}
|
||||||
|
*v.Val = s
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// String returns the flag value
|
||||||
|
func (v IPPortVar) String() string {
|
||||||
|
if v.Val == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *v.Val
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type gets the flag type
|
||||||
|
func (v IPPortVar) Type() string {
|
||||||
|
return "ipport"
|
||||||
|
}
|
||||||
|
|
||||||
|
// PortRangeVar is used for validating a command line option that represents a port range. It implements the pflag.Value interface
|
||||||
|
type PortRangeVar struct {
|
||||||
|
Val *string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set sets the flag value
|
||||||
|
func (v PortRangeVar) Set(s string) error {
|
||||||
|
if _, err := utilnet.ParsePortRange(s); err != nil {
|
||||||
|
return fmt.Errorf("%q is not a valid port range: %v", s, err)
|
||||||
|
}
|
||||||
|
if v.Val == nil {
|
||||||
|
// it's okay to panic here since this is programmer error
|
||||||
|
panic("the string pointer passed into PortRangeVar should not be nil")
|
||||||
|
}
|
||||||
|
*v.Val = s
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// String returns the flag value
|
||||||
|
func (v PortRangeVar) String() string {
|
||||||
|
if v.Val == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *v.Val
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type gets the flag type
|
||||||
|
func (v PortRangeVar) Type() string {
|
||||||
|
return "port-range"
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ go_library(
|
||||||
"//pkg/features:go_default_library",
|
"//pkg/features:go_default_library",
|
||||||
"//pkg/util/strings:go_default_library",
|
"//pkg/util/strings:go_default_library",
|
||||||
"//pkg/volume:go_default_library",
|
"//pkg/volume:go_default_library",
|
||||||
"//pkg/volume/csi/labelmanager:go_default_library",
|
"//pkg/volume/csi/nodeupdater:go_default_library",
|
||||||
"//pkg/volume/util:go_default_library",
|
"//pkg/volume/util:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/storage/v1beta1:go_default_library",
|
"//staging/src/k8s.io/api/storage/v1beta1:go_default_library",
|
||||||
|
|
@ -29,6 +29,7 @@ go_library(
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/client/informers/externalversions:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/client/informers/externalversions:go_default_library",
|
||||||
"//staging/src/k8s.io/csi-api/pkg/client/informers/externalversions/csi/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/csi-api/pkg/client/informers/externalversions/csi/v1alpha1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/csi-api/pkg/client/listers/csi/v1alpha1:go_default_library",
|
||||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
||||||
"//vendor/github.com/golang/glog:go_default_library",
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
"//vendor/google.golang.org/grpc:go_default_library",
|
"//vendor/google.golang.org/grpc:go_default_library",
|
||||||
|
|
@ -46,6 +47,7 @@ go_test(
|
||||||
],
|
],
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
"//pkg/volume:go_default_library",
|
"//pkg/volume:go_default_library",
|
||||||
"//pkg/volume/csi/fake:go_default_library",
|
"//pkg/volume/csi/fake:go_default_library",
|
||||||
"//pkg/volume/testing:go_default_library",
|
"//pkg/volume/testing:go_default_library",
|
||||||
|
|
@ -59,10 +61,15 @@ go_test(
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||||
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature/testing:go_default_library",
|
||||||
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/testing:go_default_library",
|
"//staging/src/k8s.io/client-go/testing:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
"//staging/src/k8s.io/client-go/util/testing:go_default_library",
|
||||||
|
"//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned/fake:go_default_library",
|
||||||
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
"//vendor/github.com/container-storage-interface/spec/lib/go/csi/v0:go_default_library",
|
||||||
|
"//vendor/github.com/golang/glog:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -78,7 +85,7 @@ filegroup(
|
||||||
srcs = [
|
srcs = [
|
||||||
":package-srcs",
|
":package-srcs",
|
||||||
"//pkg/volume/csi/fake:all-srcs",
|
"//pkg/volume/csi/fake:all-srcs",
|
||||||
"//pkg/volume/csi/labelmanager:all-srcs",
|
"//pkg/volume/csi/nodeupdater:all-srcs",
|
||||||
],
|
],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,16 @@ func (c *csiAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) (string
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip, err := c.plugin.skipAttach(csiSource.Driver)
|
||||||
|
if err != nil {
|
||||||
|
glog.Error(log("attacher.Attach failed to find if driver is attachable: %v", err))
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if skip {
|
||||||
|
glog.V(4).Infof(log("skipping attach for driver %s", csiSource.Driver))
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
node := string(nodeName)
|
node := string(nodeName)
|
||||||
pvName := spec.PersistentVolume.GetName()
|
pvName := spec.PersistentVolume.GetName()
|
||||||
attachID := getAttachmentName(csiSource.VolumeHandle, csiSource.Driver, node)
|
attachID := getAttachmentName(csiSource.VolumeHandle, csiSource.Driver, node)
|
||||||
|
|
@ -120,6 +130,16 @@ func (c *csiAttacher) WaitForAttach(spec *volume.Spec, attachID string, pod *v1.
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip, err := c.plugin.skipAttach(source.Driver)
|
||||||
|
if err != nil {
|
||||||
|
glog.Error(log("attacher.Attach failed to find if driver is attachable: %v", err))
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if skip {
|
||||||
|
glog.V(4).Infof(log("Driver is not attachable, skip waiting for attach"))
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
return c.waitForVolumeAttachment(source.VolumeHandle, attachID, timeout)
|
return c.waitForVolumeAttachment(source.VolumeHandle, attachID, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,11 +241,22 @@ func (c *csiAttacher) VolumesAreAttached(specs []*volume.Spec, nodeName types.No
|
||||||
glog.Error(log("attacher.VolumesAreAttached failed: %v", err))
|
glog.Error(log("attacher.VolumesAreAttached failed: %v", err))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
skip, err := c.plugin.skipAttach(source.Driver)
|
||||||
|
if err != nil {
|
||||||
|
glog.Error(log("Failed to check CSIDriver for %s: %s", source.Driver, err))
|
||||||
|
} else {
|
||||||
|
if skip {
|
||||||
|
// This volume is not attachable, pretend it's attached
|
||||||
|
attached[spec] = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
attachID := getAttachmentName(source.VolumeHandle, source.Driver, string(nodeName))
|
attachID := getAttachmentName(source.VolumeHandle, source.Driver, string(nodeName))
|
||||||
glog.V(4).Info(log("probing attachment status for VolumeAttachment %v", attachID))
|
glog.V(4).Info(log("probing attachment status for VolumeAttachment %v", attachID))
|
||||||
attach, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{})
|
attach, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
attached[spec] = false
|
||||||
glog.Error(log("attacher.VolumesAreAttached failed for attach.ID=%v: %v", attachID, err))
|
glog.Error(log("attacher.VolumesAreAttached failed for attach.ID=%v: %v", attachID, err))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
@ -325,19 +356,7 @@ func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMo
|
||||||
|
|
||||||
// Start MountDevice
|
// Start MountDevice
|
||||||
nodeName := string(c.plugin.host.GetNodeName())
|
nodeName := string(c.plugin.host.GetNodeName())
|
||||||
attachID := getAttachmentName(csiSource.VolumeHandle, csiSource.Driver, nodeName)
|
publishVolumeInfo, err := c.plugin.getPublishVolumeInfo(c.k8s, csiSource.VolumeHandle, csiSource.Driver, nodeName)
|
||||||
|
|
||||||
// search for attachment by VolumeAttachment.Spec.Source.PersistentVolumeName
|
|
||||||
attachment, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{})
|
|
||||||
if err != nil {
|
|
||||||
return err // This err already has enough context ("VolumeAttachment xyz not found")
|
|
||||||
}
|
|
||||||
|
|
||||||
if attachment == nil {
|
|
||||||
err = errors.New("no existing VolumeAttachment found")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
publishVolumeInfo := attachment.Status.AttachmentMetadata
|
|
||||||
|
|
||||||
nodeStageSecrets := map[string]string{}
|
nodeStageSecrets := map[string]string{}
|
||||||
if csiSource.NodeStageSecretRef != nil {
|
if csiSource.NodeStageSecretRef != nil {
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,11 @@ import (
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
|
||||||
api "k8s.io/api/core/v1"
|
api "k8s.io/api/core/v1"
|
||||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
kstrings "k8s.io/kubernetes/pkg/util/strings"
|
kstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
"k8s.io/kubernetes/pkg/volume/util"
|
"k8s.io/kubernetes/pkg/volume/util"
|
||||||
|
|
@ -49,6 +51,7 @@ var (
|
||||||
"nodeName",
|
"nodeName",
|
||||||
"attachmentID",
|
"attachmentID",
|
||||||
}
|
}
|
||||||
|
currentPodInfoMountVersion = "v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type csiMountMgr struct {
|
type csiMountMgr struct {
|
||||||
|
|
@ -113,9 +116,6 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
csi := c.csiClient
|
csi := c.csiClient
|
||||||
nodeName := string(c.plugin.host.GetNodeName())
|
|
||||||
attachID := getAttachmentName(csiSource.VolumeHandle, csiSource.Driver, nodeName)
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
|
@ -134,20 +134,13 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// search for attachment by VolumeAttachment.Spec.Source.PersistentVolumeName
|
// search for attachment by VolumeAttachment.Spec.Source.PersistentVolumeName
|
||||||
if c.volumeInfo == nil {
|
if c.volumeInfo == nil {
|
||||||
attachment, err := c.k8s.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{})
|
nodeName := string(c.plugin.host.GetNodeName())
|
||||||
|
c.volumeInfo, err = c.plugin.getPublishVolumeInfo(c.k8s, c.volumeID, c.driverName, nodeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Error(log("mounter.SetupAt failed while getting volume attachment [id=%v]: %v", attachID, err))
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if attachment == nil {
|
|
||||||
glog.Error(log("unable to find VolumeAttachment [id=%s]", attachID))
|
|
||||||
return errors.New("no existing VolumeAttachment found")
|
|
||||||
}
|
|
||||||
c.volumeInfo = attachment.Status.AttachmentMetadata
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attribs := csiSource.VolumeAttributes
|
attribs := csiSource.VolumeAttributes
|
||||||
|
|
@ -174,6 +167,22 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
|
||||||
accessMode = c.spec.PersistentVolume.Spec.AccessModes[0]
|
accessMode = c.spec.PersistentVolume.Spec.AccessModes[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inject pod information into volume_attributes
|
||||||
|
podAttrs, err := c.podAttributes()
|
||||||
|
if err != nil {
|
||||||
|
glog.Error(log("mouter.SetUpAt failed to assemble volume attributes: %v", err))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if podAttrs != nil {
|
||||||
|
if attribs == nil {
|
||||||
|
attribs = podAttrs
|
||||||
|
} else {
|
||||||
|
for k, v := range podAttrs {
|
||||||
|
attribs[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fsType := csiSource.FSType
|
fsType := csiSource.FSType
|
||||||
err = csi.NodePublishVolume(
|
err = csi.NodePublishVolume(
|
||||||
ctx,
|
ctx,
|
||||||
|
|
@ -228,6 +237,39 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *csiMountMgr) podAttributes() (map[string]string, error) {
|
||||||
|
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIPodInfo) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
if c.plugin.csiDriverLister == nil {
|
||||||
|
return nil, errors.New("CSIDriver lister does not exist")
|
||||||
|
}
|
||||||
|
|
||||||
|
csiDriver, err := c.plugin.csiDriverLister.Get(c.driverName)
|
||||||
|
if err != nil {
|
||||||
|
if apierrs.IsNotFound(err) {
|
||||||
|
glog.V(4).Infof(log("CSIDriver %q not found, not adding pod information", c.driverName))
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// if PodInfoOnMountVersion is not set or not v1 we do not set pod attributes
|
||||||
|
if csiDriver.Spec.PodInfoOnMountVersion == nil || *csiDriver.Spec.PodInfoOnMountVersion != currentPodInfoMountVersion {
|
||||||
|
glog.V(4).Infof(log("CSIDriver %q does not require pod information", c.driverName))
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
attrs := map[string]string{
|
||||||
|
"csi.storage.k8s.io/pod.name": c.pod.Name,
|
||||||
|
"csi.storage.k8s.io/pod.namespace": c.pod.Namespace,
|
||||||
|
"csi.storage.k8s.io/pod.uid": string(c.pod.UID),
|
||||||
|
"csi.storage.k8s.io/serviceAccount.name": c.pod.Spec.ServiceAccountName,
|
||||||
|
}
|
||||||
|
glog.V(4).Infof(log("CSIDriver %q requires pod information", c.driverName))
|
||||||
|
return attrs, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *csiMountMgr) GetAttributes() volume.Attributes {
|
func (c *csiMountMgr) GetAttributes() volume.Attributes {
|
||||||
mounter := c.plugin.host.GetMounter(c.plugin.GetPluginName())
|
mounter := c.plugin.host.GetMounter(c.plugin.GetPluginName())
|
||||||
path := c.GetPath()
|
path := c.GetPath()
|
||||||
|
|
|
||||||
|
|
@ -29,15 +29,18 @@ import (
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
api "k8s.io/api/core/v1"
|
api "k8s.io/api/core/v1"
|
||||||
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
csiapiinformer "k8s.io/csi-api/pkg/client/informers/externalversions"
|
csiapiinformer "k8s.io/csi-api/pkg/client/informers/externalversions"
|
||||||
csiinformer "k8s.io/csi-api/pkg/client/informers/externalversions/csi/v1alpha1"
|
csiinformer "k8s.io/csi-api/pkg/client/informers/externalversions/csi/v1alpha1"
|
||||||
|
csilister "k8s.io/csi-api/pkg/client/listers/csi/v1alpha1"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
"k8s.io/kubernetes/pkg/features"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
"k8s.io/kubernetes/pkg/volume/csi/labelmanager"
|
"k8s.io/kubernetes/pkg/volume/csi/nodeupdater"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -60,6 +63,7 @@ const (
|
||||||
type csiPlugin struct {
|
type csiPlugin struct {
|
||||||
host volume.VolumeHost
|
host volume.VolumeHost
|
||||||
blockEnabled bool
|
blockEnabled bool
|
||||||
|
csiDriverLister csilister.CSIDriverLister
|
||||||
csiDriverInformer csiinformer.CSIDriverInformer
|
csiDriverInformer csiinformer.CSIDriverInformer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,7 +94,7 @@ type csiDriversStore struct {
|
||||||
// corresponding sockets
|
// corresponding sockets
|
||||||
var csiDrivers csiDriversStore
|
var csiDrivers csiDriversStore
|
||||||
|
|
||||||
var lm labelmanager.Interface
|
var nodeUpdater nodeupdater.Interface
|
||||||
|
|
||||||
// RegistrationCallback is called by kubelet's plugin watcher upon detection
|
// RegistrationCallback is called by kubelet's plugin watcher upon detection
|
||||||
// of a new registration socket opened by CSI Driver registrar side car.
|
// of a new registration socket opened by CSI Driver registrar side car.
|
||||||
|
|
@ -114,13 +118,13 @@ func RegistrationCallback(pluginName string, endpoint string, versions []string,
|
||||||
// TODO (verult) retry with exponential backoff, possibly added in csi client library.
|
// TODO (verult) retry with exponential backoff, possibly added in csi client library.
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), csiTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
driverNodeID, _, _, err := csi.NodeGetInfo(ctx)
|
driverNodeID, maxVolumePerNode, _, err := csi.NodeGetInfo(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error during CSI NodeGetInfo() call: %v", err)
|
return nil, fmt.Errorf("error during CSI NodeGetInfo() call: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calling nodeLabelManager to update annotations and labels for newly registered CSI driver
|
// Calling nodeLabelManager to update annotations and labels for newly registered CSI driver
|
||||||
err = lm.AddLabels(pluginName, driverNodeID)
|
err = nodeUpdater.AddLabelsAndLimits(pluginName, driverNodeID, maxVolumePerNode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Unregister the driver and return error
|
// Unregister the driver and return error
|
||||||
csiDrivers.Lock()
|
csiDrivers.Lock()
|
||||||
|
|
@ -138,13 +142,14 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error {
|
||||||
|
|
||||||
// Initializing csiDrivers map and label management channels
|
// Initializing csiDrivers map and label management channels
|
||||||
csiDrivers = csiDriversStore{driversMap: map[string]csiDriver{}}
|
csiDrivers = csiDriversStore{driversMap: map[string]csiDriver{}}
|
||||||
lm = labelmanager.NewLabelManager(host.GetNodeName(), host.GetKubeClient())
|
nodeUpdater = nodeupdater.NewNodeUpdater(host.GetNodeName(), host.GetKubeClient())
|
||||||
|
|
||||||
csiClient := host.GetCSIClient()
|
csiClient := host.GetCSIClient()
|
||||||
if csiClient != nil {
|
if csiClient != nil {
|
||||||
// Start informer for CSIDrivers.
|
// Start informer for CSIDrivers.
|
||||||
factory := csiapiinformer.NewSharedInformerFactory(csiClient, csiResyncPeriod)
|
factory := csiapiinformer.NewSharedInformerFactory(csiClient, csiResyncPeriod)
|
||||||
p.csiDriverInformer = factory.Csi().V1alpha1().CSIDrivers()
|
p.csiDriverInformer = factory.Csi().V1alpha1().CSIDrivers()
|
||||||
|
p.csiDriverLister = p.csiDriverInformer.Lister()
|
||||||
go factory.Start(wait.NeverStop)
|
go factory.Start(wait.NeverStop)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -487,3 +492,48 @@ func (p *csiPlugin) ConstructBlockVolumeSpec(podUID types.UID, specVolName, mapP
|
||||||
|
|
||||||
return volume.NewSpecFromPersistentVolume(pv, false), nil
|
return volume.NewSpecFromPersistentVolume(pv, false), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *csiPlugin) skipAttach(driver string) (bool, error) {
|
||||||
|
if !utilfeature.DefaultFeatureGate.Enabled(features.CSISkipAttach) {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
if p.csiDriverLister == nil {
|
||||||
|
return false, errors.New("CSIDriver lister does not exist")
|
||||||
|
}
|
||||||
|
csiDriver, err := p.csiDriverLister.Get(driver)
|
||||||
|
if err != nil {
|
||||||
|
if apierrs.IsNotFound(err) {
|
||||||
|
// Don't skip attach if CSIDriver does not exist
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if csiDriver.Spec.AttachRequired != nil && *csiDriver.Spec.AttachRequired == false {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *csiPlugin) getPublishVolumeInfo(client clientset.Interface, handle, driver, nodeName string) (map[string]string, error) {
|
||||||
|
skip, err := p.skipAttach(driver)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if skip {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
attachID := getAttachmentName(handle, driver, nodeName)
|
||||||
|
|
||||||
|
// search for attachment by VolumeAttachment.Spec.Source.PersistentVolumeName
|
||||||
|
attachment, err := client.StorageV1beta1().VolumeAttachments().Get(attachID, meta.GetOptions{})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err // This err already has enough context ("VolumeAttachment xyz not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
if attachment == nil {
|
||||||
|
err = errors.New("no existing VolumeAttachment found")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return attachment.Status.AttachmentMetadata, nil
|
||||||
|
}
|
||||||
|
|
|
||||||
250
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/volume/csi/labelmanager/labelmanager.go
generated
vendored
250
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/volume/csi/labelmanager/labelmanager.go
generated
vendored
|
|
@ -1,250 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2018 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Package labelmanager includes internal functions used to add/delete labels to
|
|
||||||
// kubernetes nodes for corresponding CSI drivers
|
|
||||||
package labelmanager
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/golang/glog"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/types"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
|
||||||
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
|
||||||
"k8s.io/client-go/util/retry"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Name of node annotation that contains JSON map of driver names to node
|
|
||||||
// names
|
|
||||||
annotationKey = "csi.volume.kubernetes.io/nodeid"
|
|
||||||
)
|
|
||||||
|
|
||||||
// labelManagementStruct is struct of channels used for communication between the driver registration
|
|
||||||
// code and the go routine responsible for managing the node's labels
|
|
||||||
type labelManagerStruct struct {
|
|
||||||
nodeName types.NodeName
|
|
||||||
k8s kubernetes.Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
// Interface implements an interface for managing labels of a node
|
|
||||||
type Interface interface {
|
|
||||||
AddLabels(driverName string, driverNodeId string) error
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewLabelManager initializes labelManagerStruct and returns available interfaces
|
|
||||||
func NewLabelManager(nodeName types.NodeName, kubeClient kubernetes.Interface) Interface {
|
|
||||||
return labelManagerStruct{
|
|
||||||
nodeName: nodeName,
|
|
||||||
k8s: kubeClient,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// nodeLabelManager waits for labeling requests initiated by the driver's registration
|
|
||||||
// process.
|
|
||||||
func (lm labelManagerStruct) AddLabels(driverName string, driverNodeId string) error {
|
|
||||||
err := verifyAndAddNodeId(string(lm.nodeName), lm.k8s.CoreV1().Nodes(), driverName, driverNodeId)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to update node %s's annotation with error: %+v", lm.nodeName, err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clones the given map and returns a new map with the given key and value added.
|
|
||||||
// Returns the given map, if annotationKey is empty.
|
|
||||||
func cloneAndAddAnnotation(
|
|
||||||
annotations map[string]string,
|
|
||||||
annotationKey,
|
|
||||||
annotationValue string) map[string]string {
|
|
||||||
if annotationKey == "" {
|
|
||||||
// Don't need to add an annotation.
|
|
||||||
return annotations
|
|
||||||
}
|
|
||||||
// Clone.
|
|
||||||
newAnnotations := map[string]string{}
|
|
||||||
for key, value := range annotations {
|
|
||||||
newAnnotations[key] = value
|
|
||||||
}
|
|
||||||
newAnnotations[annotationKey] = annotationValue
|
|
||||||
return newAnnotations
|
|
||||||
}
|
|
||||||
|
|
||||||
func verifyAndAddNodeId(
|
|
||||||
k8sNodeName string,
|
|
||||||
k8sNodesClient corev1.NodeInterface,
|
|
||||||
csiDriverName string,
|
|
||||||
csiDriverNodeId string) error {
|
|
||||||
// Add or update annotation on Node object
|
|
||||||
retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error {
|
|
||||||
// Retrieve the latest version of Node before attempting update, so that
|
|
||||||
// existing changes are not overwritten. RetryOnConflict uses
|
|
||||||
// exponential backoff to avoid exhausting the apiserver.
|
|
||||||
result, getErr := k8sNodesClient.Get(k8sNodeName, metav1.GetOptions{})
|
|
||||||
if getErr != nil {
|
|
||||||
glog.Errorf("Failed to get latest version of Node: %v", getErr)
|
|
||||||
return getErr // do not wrap error
|
|
||||||
}
|
|
||||||
|
|
||||||
var previousAnnotationValue string
|
|
||||||
if result.ObjectMeta.Annotations != nil {
|
|
||||||
previousAnnotationValue =
|
|
||||||
result.ObjectMeta.Annotations[annotationKey]
|
|
||||||
glog.V(3).Infof(
|
|
||||||
"previousAnnotationValue=%q", previousAnnotationValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
existingDriverMap := map[string]string{}
|
|
||||||
if previousAnnotationValue != "" {
|
|
||||||
// Parse previousAnnotationValue as JSON
|
|
||||||
if err := json.Unmarshal([]byte(previousAnnotationValue), &existingDriverMap); err != nil {
|
|
||||||
return fmt.Errorf(
|
|
||||||
"failed to parse node's %q annotation value (%q) err=%v",
|
|
||||||
annotationKey,
|
|
||||||
previousAnnotationValue,
|
|
||||||
err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if val, ok := existingDriverMap[csiDriverName]; ok {
|
|
||||||
if val == csiDriverNodeId {
|
|
||||||
// Value already exists in node annotation, nothing more to do
|
|
||||||
glog.V(2).Infof(
|
|
||||||
"The key value {%q: %q} alredy eixst in node %q annotation, no need to update: %v",
|
|
||||||
csiDriverName,
|
|
||||||
csiDriverNodeId,
|
|
||||||
annotationKey,
|
|
||||||
previousAnnotationValue)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add/update annotation value
|
|
||||||
existingDriverMap[csiDriverName] = csiDriverNodeId
|
|
||||||
jsonObj, err := json.Marshal(existingDriverMap)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf(
|
|
||||||
"failed while trying to add key value {%q: %q} to node %q annotation. Existing value: %v",
|
|
||||||
csiDriverName,
|
|
||||||
csiDriverNodeId,
|
|
||||||
annotationKey,
|
|
||||||
previousAnnotationValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
result.ObjectMeta.Annotations = cloneAndAddAnnotation(
|
|
||||||
result.ObjectMeta.Annotations,
|
|
||||||
annotationKey,
|
|
||||||
string(jsonObj))
|
|
||||||
_, updateErr := k8sNodesClient.Update(result)
|
|
||||||
if updateErr == nil {
|
|
||||||
glog.V(2).Infof(
|
|
||||||
"Updated node %q successfully for CSI driver %q and CSI node name %q",
|
|
||||||
k8sNodeName,
|
|
||||||
csiDriverName,
|
|
||||||
csiDriverNodeId)
|
|
||||||
}
|
|
||||||
return updateErr // do not wrap error
|
|
||||||
})
|
|
||||||
if retryErr != nil {
|
|
||||||
return fmt.Errorf("node update failed: %v", retryErr)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetches Kubernetes node API object corresponding to k8sNodeName.
|
|
||||||
// If the csiDriverName is present in the node annotation, it is removed.
|
|
||||||
func verifyAndDeleteNodeId(
|
|
||||||
k8sNodeName string,
|
|
||||||
k8sNodesClient corev1.NodeInterface,
|
|
||||||
csiDriverName string) error {
|
|
||||||
retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error {
|
|
||||||
// Retrieve the latest version of Node before attempting update, so that
|
|
||||||
// existing changes are not overwritten. RetryOnConflict uses
|
|
||||||
// exponential backoff to avoid exhausting the apiserver.
|
|
||||||
result, getErr := k8sNodesClient.Get(k8sNodeName, metav1.GetOptions{})
|
|
||||||
if getErr != nil {
|
|
||||||
glog.Errorf("failed to get latest version of Node: %v", getErr)
|
|
||||||
return getErr // do not wrap error
|
|
||||||
}
|
|
||||||
|
|
||||||
var previousAnnotationValue string
|
|
||||||
if result.ObjectMeta.Annotations != nil {
|
|
||||||
previousAnnotationValue =
|
|
||||||
result.ObjectMeta.Annotations[annotationKey]
|
|
||||||
glog.V(3).Infof(
|
|
||||||
"previousAnnotationValue=%q", previousAnnotationValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
existingDriverMap := map[string]string{}
|
|
||||||
if previousAnnotationValue == "" {
|
|
||||||
// Value already exists in node annotation, nothing more to do
|
|
||||||
glog.V(2).Infof(
|
|
||||||
"The key %q does not exist in node %q annotation, no need to cleanup.",
|
|
||||||
csiDriverName,
|
|
||||||
annotationKey)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse previousAnnotationValue as JSON
|
|
||||||
if err := json.Unmarshal([]byte(previousAnnotationValue), &existingDriverMap); err != nil {
|
|
||||||
return fmt.Errorf(
|
|
||||||
"failed to parse node's %q annotation value (%q) err=%v",
|
|
||||||
annotationKey,
|
|
||||||
previousAnnotationValue,
|
|
||||||
err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, ok := existingDriverMap[csiDriverName]; !ok {
|
|
||||||
// Value already exists in node annotation, nothing more to do
|
|
||||||
glog.V(2).Infof(
|
|
||||||
"The key %q does not eixst in node %q annotation, no need to cleanup: %v",
|
|
||||||
csiDriverName,
|
|
||||||
annotationKey,
|
|
||||||
previousAnnotationValue)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add/update annotation value
|
|
||||||
delete(existingDriverMap, csiDriverName)
|
|
||||||
jsonObj, err := json.Marshal(existingDriverMap)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf(
|
|
||||||
"failed while trying to remove key %q from node %q annotation. Existing data: %v",
|
|
||||||
csiDriverName,
|
|
||||||
annotationKey,
|
|
||||||
previousAnnotationValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
result.ObjectMeta.Annotations = cloneAndAddAnnotation(
|
|
||||||
result.ObjectMeta.Annotations,
|
|
||||||
annotationKey,
|
|
||||||
string(jsonObj))
|
|
||||||
_, updateErr := k8sNodesClient.Update(result)
|
|
||||||
if updateErr == nil {
|
|
||||||
fmt.Printf(
|
|
||||||
"Updated node %q annotation to remove CSI driver %q.",
|
|
||||||
k8sNodeName,
|
|
||||||
csiDriverName)
|
|
||||||
}
|
|
||||||
return updateErr // do not wrap error
|
|
||||||
})
|
|
||||||
if retryErr != nil {
|
|
||||||
return fmt.Errorf("node update failed: %v", retryErr)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
@ -2,10 +2,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["labelmanager.go"],
|
srcs = ["nodeupdater.go"],
|
||||||
importpath = "k8s.io/kubernetes/pkg/volume/csi/labelmanager",
|
importpath = "k8s.io/kubernetes/pkg/volume/csi/nodeupdater",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/volume/util:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
193
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/volume/csi/nodeupdater/nodeupdater.go
generated
vendored
Normal file
193
cluster-autoscaler/vendor/k8s.io/kubernetes/pkg/volume/csi/nodeupdater/nodeupdater.go
generated
vendored
Normal file
|
|
@ -0,0 +1,193 @@
|
||||||
|
/*
|
||||||
|
Copyright 2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Package nodeupdater includes internal functions used to add/delete labels to
|
||||||
|
// kubernetes nodes for corresponding CSI drivers
|
||||||
|
package nodeupdater
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
|
"k8s.io/api/core/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/types"
|
||||||
|
"k8s.io/client-go/kubernetes"
|
||||||
|
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||||
|
"k8s.io/client-go/util/retry"
|
||||||
|
"k8s.io/kubernetes/pkg/volume/util"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Name of node annotation that contains JSON map of driver names to node
|
||||||
|
// names
|
||||||
|
annotationKey = "csi.volume.kubernetes.io/nodeid"
|
||||||
|
)
|
||||||
|
|
||||||
|
// labelManagementStruct is struct of channels used for communication between the driver registration
|
||||||
|
// code and the go routine responsible for managing the node's labels
|
||||||
|
type nodeUpdateStruct struct {
|
||||||
|
nodeName types.NodeName
|
||||||
|
k8s kubernetes.Interface
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interface implements an interface for managing labels of a node
|
||||||
|
type Interface interface {
|
||||||
|
AddLabelsAndLimits(driverName string, driverNodeId string, maxLimit int64) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewNodeupdater initializes nodeUpdateStruct and returns available interfaces
|
||||||
|
func NewNodeUpdater(nodeName types.NodeName, kubeClient kubernetes.Interface) Interface {
|
||||||
|
return nodeUpdateStruct{
|
||||||
|
nodeName: nodeName,
|
||||||
|
k8s: kubeClient,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLabelsAndLimits nodeUpdater waits for labeling requests initiated by the driver's registration
|
||||||
|
// process and updates labels and attach limits
|
||||||
|
func (nodeUpdater nodeUpdateStruct) AddLabelsAndLimits(driverName string, driverNodeId string, maxLimit int64) error {
|
||||||
|
err := addLabelsAndLimits(string(nodeUpdater.nodeName), nodeUpdater.k8s.CoreV1().Nodes(), driverName, driverNodeId, maxLimit)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func addMaxAttachLimitToNode(node *v1.Node, driverName string, maxLimit int64) *v1.Node {
|
||||||
|
if maxLimit <= 0 {
|
||||||
|
glog.V(4).Infof("skipping adding attach limit for %s", driverName)
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
if node.Status.Capacity == nil {
|
||||||
|
node.Status.Capacity = v1.ResourceList{}
|
||||||
|
}
|
||||||
|
if node.Status.Allocatable == nil {
|
||||||
|
node.Status.Allocatable = v1.ResourceList{}
|
||||||
|
}
|
||||||
|
limitKeyName := util.GetCSIAttachLimitKey(driverName)
|
||||||
|
node.Status.Capacity[v1.ResourceName(limitKeyName)] = *resource.NewQuantity(maxLimit, resource.DecimalSI)
|
||||||
|
node.Status.Allocatable[v1.ResourceName(limitKeyName)] = *resource.NewQuantity(maxLimit, resource.DecimalSI)
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clones the given map and returns a new map with the given key and value added.
|
||||||
|
// Returns the given map, if annotationKey is empty.
|
||||||
|
func cloneAndAddAnnotation(
|
||||||
|
annotations map[string]string,
|
||||||
|
annotationKey,
|
||||||
|
annotationValue string) map[string]string {
|
||||||
|
if annotationKey == "" {
|
||||||
|
// Don't need to add an annotation.
|
||||||
|
return annotations
|
||||||
|
}
|
||||||
|
// Clone.
|
||||||
|
newAnnotations := map[string]string{}
|
||||||
|
for key, value := range annotations {
|
||||||
|
newAnnotations[key] = value
|
||||||
|
}
|
||||||
|
newAnnotations[annotationKey] = annotationValue
|
||||||
|
return newAnnotations
|
||||||
|
}
|
||||||
|
|
||||||
|
func addNodeIdToNode(node *v1.Node, driverName string, csiDriverNodeId string) (*v1.Node, error) {
|
||||||
|
var previousAnnotationValue string
|
||||||
|
if node.ObjectMeta.Annotations != nil {
|
||||||
|
previousAnnotationValue =
|
||||||
|
node.ObjectMeta.Annotations[annotationKey]
|
||||||
|
glog.V(3).Infof(
|
||||||
|
"previousAnnotationValue=%q", previousAnnotationValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
existingDriverMap := map[string]string{}
|
||||||
|
if previousAnnotationValue != "" {
|
||||||
|
// Parse previousAnnotationValue as JSON
|
||||||
|
if err := json.Unmarshal([]byte(previousAnnotationValue), &existingDriverMap); err != nil {
|
||||||
|
return node, fmt.Errorf(
|
||||||
|
"failed to parse node's %q annotation value (%q) err=%v",
|
||||||
|
annotationKey,
|
||||||
|
previousAnnotationValue,
|
||||||
|
err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if val, ok := existingDriverMap[driverName]; ok {
|
||||||
|
if val == csiDriverNodeId {
|
||||||
|
// Value already exists in node annotation, nothing more to do
|
||||||
|
glog.V(2).Infof(
|
||||||
|
"The key value {%q: %q} alredy eixst in node %q annotation, no need to update: %v",
|
||||||
|
driverName,
|
||||||
|
csiDriverNodeId,
|
||||||
|
annotationKey,
|
||||||
|
previousAnnotationValue)
|
||||||
|
return node, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add/update annotation value
|
||||||
|
existingDriverMap[driverName] = csiDriverNodeId
|
||||||
|
jsonObj, err := json.Marshal(existingDriverMap)
|
||||||
|
if err != nil {
|
||||||
|
return node, fmt.Errorf(
|
||||||
|
"failed while trying to add key value {%q: %q} to node %q annotation. Existing value: %v",
|
||||||
|
driverName,
|
||||||
|
csiDriverNodeId,
|
||||||
|
annotationKey,
|
||||||
|
previousAnnotationValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
node.ObjectMeta.Annotations = cloneAndAddAnnotation(
|
||||||
|
node.ObjectMeta.Annotations,
|
||||||
|
annotationKey,
|
||||||
|
string(jsonObj))
|
||||||
|
return node, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func addLabelsAndLimits(nodeName string, nodeClient corev1.NodeInterface, driverName string, csiDriverNodeId string, maxLimit int64) error {
|
||||||
|
retryErr := retry.RetryOnConflict(retry.DefaultRetry, func() error {
|
||||||
|
// Retrieve the latest version of Node before attempting update, so that
|
||||||
|
// existing changes are not overwritten. RetryOnConflict uses
|
||||||
|
// exponential backoff to avoid exhausting the apiserver.
|
||||||
|
node, getErr := nodeClient.Get(nodeName, metav1.GetOptions{})
|
||||||
|
if getErr != nil {
|
||||||
|
glog.Errorf("Failed to get latest version of Node: %v", getErr)
|
||||||
|
return getErr // do not wrap error
|
||||||
|
}
|
||||||
|
var labelErr error
|
||||||
|
node, labelErr = addNodeIdToNode(node, driverName, csiDriverNodeId)
|
||||||
|
if labelErr != nil {
|
||||||
|
return labelErr
|
||||||
|
}
|
||||||
|
node = addMaxAttachLimitToNode(node, driverName, maxLimit)
|
||||||
|
|
||||||
|
_, updateErr := nodeClient.Update(node)
|
||||||
|
if updateErr == nil {
|
||||||
|
glog.V(2).Infof(
|
||||||
|
"Updated node %q successfully for CSI driver %q and CSI node name %q",
|
||||||
|
nodeName,
|
||||||
|
driverName,
|
||||||
|
csiDriverNodeId)
|
||||||
|
}
|
||||||
|
return updateErr // do not wrap error
|
||||||
|
})
|
||||||
|
if retryErr != nil {
|
||||||
|
return fmt.Errorf("error setting attach limit and labels for %s with : %v", driverName, retryErr)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -49,6 +49,7 @@ go_test(
|
||||||
name = "go_default_test",
|
name = "go_default_test",
|
||||||
srcs = [
|
srcs = [
|
||||||
"atomic_writer_test.go",
|
"atomic_writer_test.go",
|
||||||
|
"attach_limit_test.go",
|
||||||
"device_util_linux_test.go",
|
"device_util_linux_test.go",
|
||||||
"nested_volumes_test.go",
|
"nested_volumes_test.go",
|
||||||
"resize_util_test.go",
|
"resize_util_test.go",
|
||||||
|
|
@ -57,6 +58,7 @@ go_test(
|
||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/apis/core/install:go_default_library",
|
"//pkg/apis/core/install:go_default_library",
|
||||||
|
"//pkg/apis/core/v1/helper:go_default_library",
|
||||||
"//pkg/kubelet/apis:go_default_library",
|
"//pkg/kubelet/apis:go_default_library",
|
||||||
"//pkg/util/mount:go_default_library",
|
"//pkg/util/mount:go_default_library",
|
||||||
"//pkg/util/slice:go_default_library",
|
"//pkg/util/slice:go_default_library",
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ limitations under the License.
|
||||||
|
|
||||||
package util
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/sha1"
|
||||||
|
"encoding/hex"
|
||||||
|
)
|
||||||
|
|
||||||
// This file is a common place holder for volume limit utility constants
|
// This file is a common place holder for volume limit utility constants
|
||||||
// shared between volume package and scheduler
|
// shared between volume package and scheduler
|
||||||
|
|
||||||
|
|
@ -26,4 +31,25 @@ const (
|
||||||
AzureVolumeLimitKey = "attachable-volumes-azure-disk"
|
AzureVolumeLimitKey = "attachable-volumes-azure-disk"
|
||||||
// GCEVolumeLimitKey stores resource name that will store volume limits for GCE node
|
// GCEVolumeLimitKey stores resource name that will store volume limits for GCE node
|
||||||
GCEVolumeLimitKey = "attachable-volumes-gce-pd"
|
GCEVolumeLimitKey = "attachable-volumes-gce-pd"
|
||||||
|
|
||||||
|
// CSIAttachLimitPrefix defines prefix used for CSI volumes
|
||||||
|
CSIAttachLimitPrefix = "attachable-volumes-csi-"
|
||||||
|
|
||||||
|
// ResourceNameLengthLimit stores maximum allowed Length for a ResourceName
|
||||||
|
ResourceNameLengthLimit = 63
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GetCSIAttachLimitKey returns limit key used for CSI volumes
|
||||||
|
func GetCSIAttachLimitKey(driverName string) string {
|
||||||
|
csiPrefixLength := len(CSIAttachLimitPrefix)
|
||||||
|
totalkeyLength := csiPrefixLength + len(driverName)
|
||||||
|
if totalkeyLength >= ResourceNameLengthLimit {
|
||||||
|
charsFromDriverName := driverName[:23]
|
||||||
|
hash := sha1.New()
|
||||||
|
hash.Write([]byte(driverName))
|
||||||
|
hashed := hex.EncodeToString(hash.Sum(nil))
|
||||||
|
hashed = hashed[:16]
|
||||||
|
return CSIAttachLimitPrefix + charsFromDriverName + hashed
|
||||||
|
}
|
||||||
|
return CSIAttachLimitPrefix + driverName
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue