mirror of https://github.com/kubernetes/kops.git
Set apiserver-count flag
This commit is contained in:
parent
6388a77fd4
commit
09b0175f73
|
@ -15,3 +15,4 @@ KubeAPIServer:
|
||||||
LogLevel: 2
|
LogLevel: 2
|
||||||
AllowPrivileged: true
|
AllowPrivileged: true
|
||||||
Image: {{ Image "kube-apiserver" }}
|
Image: {{ Image "kube-apiserver" }}
|
||||||
|
APIServerCount: {{ APIServerCount }}
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kops/upup/pkg/api"
|
"k8s.io/kops/upup/pkg/api"
|
||||||
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
"k8s.io/kops/util/pkg/vfs"
|
"k8s.io/kops/util/pkg/vfs"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
|
@ -98,6 +99,8 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap) {
|
||||||
dest["GetInstanceGroup"] = tf.GetInstanceGroup
|
dest["GetInstanceGroup"] = tf.GetInstanceGroup
|
||||||
|
|
||||||
dest["CloudTags"] = tf.CloudTags
|
dest["CloudTags"] = tf.CloudTags
|
||||||
|
|
||||||
|
dest["APIServerCount"] = tf.APIServerCount
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tf *TemplateFunctions) EtcdClusterMemberTags(etcd *api.EtcdClusterSpec, m *api.EtcdMemberSpec) map[string]string {
|
func (tf *TemplateFunctions) EtcdClusterMemberTags(etcd *api.EtcdClusterSpec, m *api.EtcdMemberSpec) map[string]string {
|
||||||
|
@ -240,3 +243,19 @@ func (tf *TemplateFunctions) GetInstanceGroup(name string) (*api.InstanceGroup,
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("InstanceGroup %q not found", name)
|
return nil, fmt.Errorf("InstanceGroup %q not found", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// APIServerCount returns the value for the kubeapiserver --apiserver-count flag
|
||||||
|
func (tf *TemplateFunctions) APIServerCount() int {
|
||||||
|
count := 0
|
||||||
|
for _, ig := range tf.instanceGroups {
|
||||||
|
if !ig.IsMaster() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
size := fi.IntValue(ig.Spec.MaxSize)
|
||||||
|
if size == 0 {
|
||||||
|
size = fi.IntValue(ig.Spec.MinSize)
|
||||||
|
}
|
||||||
|
count += size
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue