2017-01-20 22:33:06 +00:00
|
|
|
/*
|
|
|
|
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 constants
|
|
|
|
|
2017-02-23 13:30:24 +00:00
|
|
|
import (
|
2017-05-29 17:15:04 +00:00
|
|
|
"path/filepath"
|
2017-02-23 13:30:24 +00:00
|
|
|
"time"
|
2017-02-23 17:43:09 +00:00
|
|
|
|
2017-06-22 18:10:11 +00:00
|
|
|
"k8s.io/api/core/v1"
|
2017-06-06 04:47:18 +00:00
|
|
|
"k8s.io/kubernetes/pkg/util/version"
|
2017-02-23 13:30:24 +00:00
|
|
|
)
|
2017-02-01 22:05:14 +00:00
|
|
|
|
2017-01-20 22:33:06 +00:00
|
|
|
const (
|
2017-02-23 13:30:24 +00:00
|
|
|
// KubernetesDir is the directory kubernetes owns for storing various configuration files
|
|
|
|
KubernetesDir = "/etc/kubernetes"
|
2017-02-10 06:14:40 +00:00
|
|
|
|
2017-05-31 03:04:17 +00:00
|
|
|
ManifestsSubDirName = "manifests"
|
|
|
|
|
2017-01-20 22:33:06 +00:00
|
|
|
CACertAndKeyBaseName = "ca"
|
|
|
|
CACertName = "ca.crt"
|
|
|
|
CAKeyName = "ca.key"
|
|
|
|
|
|
|
|
APIServerCertAndKeyBaseName = "apiserver"
|
|
|
|
APIServerCertName = "apiserver.crt"
|
|
|
|
APIServerKeyName = "apiserver.key"
|
2017-01-23 19:45:48 +00:00
|
|
|
|
|
|
|
APIServerKubeletClientCertAndKeyBaseName = "apiserver-kubelet-client"
|
|
|
|
APIServerKubeletClientCertName = "apiserver-kubelet-client.crt"
|
|
|
|
APIServerKubeletClientKeyName = "apiserver-kubelet-client.key"
|
2017-01-31 07:24:15 +00:00
|
|
|
|
2017-02-11 17:10:06 +00:00
|
|
|
ServiceAccountKeyBaseName = "sa"
|
|
|
|
ServiceAccountPublicKeyName = "sa.pub"
|
|
|
|
ServiceAccountPrivateKeyName = "sa.key"
|
|
|
|
|
2017-02-15 15:47:58 +00:00
|
|
|
FrontProxyCACertAndKeyBaseName = "front-proxy-ca"
|
|
|
|
FrontProxyCACertName = "front-proxy-ca.crt"
|
|
|
|
FrontProxyCAKeyName = "front-proxy-ca.key"
|
|
|
|
|
|
|
|
FrontProxyClientCertAndKeyBaseName = "front-proxy-client"
|
|
|
|
FrontProxyClientCertName = "front-proxy-client.crt"
|
|
|
|
FrontProxyClientKeyName = "front-proxy-client.key"
|
|
|
|
|
2017-02-23 19:28:03 +00:00
|
|
|
AdminKubeConfigFileName = "admin.conf"
|
|
|
|
KubeletKubeConfigFileName = "kubelet.conf"
|
|
|
|
ControllerManagerKubeConfigFileName = "controller-manager.conf"
|
|
|
|
SchedulerKubeConfigFileName = "scheduler.conf"
|
|
|
|
|
|
|
|
// Some well-known users and groups in the core Kubernetes authorization system
|
|
|
|
|
2017-06-07 18:07:49 +00:00
|
|
|
ControllerManagerUser = "system:kube-controller-manager"
|
|
|
|
SchedulerUser = "system:kube-scheduler"
|
|
|
|
MastersGroup = "system:masters"
|
|
|
|
NodesGroup = "system:nodes"
|
|
|
|
NodesClusterRoleBinding = "system:node"
|
2017-02-23 19:28:03 +00:00
|
|
|
|
2017-02-01 17:06:51 +00:00
|
|
|
// Constants for what we name our ServiceAccounts with limited access to the cluster in case of RBAC
|
|
|
|
KubeDNSServiceAccountName = "kube-dns"
|
|
|
|
KubeProxyServiceAccountName = "kube-proxy"
|
2017-02-01 22:05:14 +00:00
|
|
|
|
|
|
|
// APICallRetryInterval defines how long kubeadm should wait before retrying a failed API operation
|
|
|
|
APICallRetryInterval = 500 * time.Millisecond
|
2017-03-04 09:17:52 +00:00
|
|
|
// DiscoveryRetryInterval specifies how long kubeadm should wait before retrying to connect to the master when doing discovery
|
|
|
|
DiscoveryRetryInterval = 5 * time.Second
|
2017-02-06 17:34:06 +00:00
|
|
|
|
|
|
|
// Minimum amount of nodes the Service subnet should allow.
|
|
|
|
// We need at least ten, because the DNS service is always at the tenth cluster clusterIP
|
|
|
|
MinimumAddressesInServiceSubnet = 10
|
2017-02-16 20:22:30 +00:00
|
|
|
|
|
|
|
// DefaultTokenDuration specifies the default amount of time that a bootstrap token will be valid
|
2017-02-27 10:56:03 +00:00
|
|
|
// Default behaviour is "never expire" == 0
|
|
|
|
DefaultTokenDuration = 0
|
2017-02-16 20:22:30 +00:00
|
|
|
|
2017-02-23 17:43:09 +00:00
|
|
|
// LabelNodeRoleMaster specifies that a node is a master
|
|
|
|
// It's copied over to kubeadm until it's merged in core: https://github.com/kubernetes/kubernetes/pull/39112
|
|
|
|
LabelNodeRoleMaster = "node-role.kubernetes.io/master"
|
|
|
|
|
2017-02-23 09:33:16 +00:00
|
|
|
// MinExternalEtcdVersion indicates minimum external etcd version which kubeadm supports
|
|
|
|
MinExternalEtcdVersion = "3.0.14"
|
2017-01-20 22:33:06 +00:00
|
|
|
)
|
2017-02-23 13:30:24 +00:00
|
|
|
|
|
|
|
var (
|
2017-02-23 17:43:09 +00:00
|
|
|
|
|
|
|
// MasterToleration is the toleration to apply on the PodSpec for being able to run that Pod on the master
|
|
|
|
MasterToleration = v1.Toleration{
|
|
|
|
Key: LabelNodeRoleMaster,
|
|
|
|
Effect: v1.TaintEffectNoSchedule,
|
|
|
|
}
|
|
|
|
|
2017-05-29 17:15:04 +00:00
|
|
|
AuthorizationPolicyPath = filepath.Join(KubernetesDir, "abac_policy.json")
|
|
|
|
AuthorizationWebhookConfigPath = filepath.Join(KubernetesDir, "webhook_authz.conf")
|
2017-02-27 10:56:03 +00:00
|
|
|
|
|
|
|
// DefaultTokenUsages specifies the default functions a token will get
|
|
|
|
DefaultTokenUsages = []string{"signing", "authentication"}
|
2017-06-06 04:47:18 +00:00
|
|
|
|
|
|
|
// MinimumControlPlaneVersion specifies the minimum control plane version kubeadm can deploy
|
2017-06-30 14:46:34 +00:00
|
|
|
MinimumControlPlaneVersion = version.MustParseSemantic("v1.7.0")
|
2017-02-23 13:30:24 +00:00
|
|
|
)
|