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
|
||||
AllowPrivileged: true
|
||||
Image: {{ Image "kube-apiserver" }}
|
||||
APIServerCount: {{ APIServerCount }}
|
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/kops/upup/pkg/api"
|
||||
"k8s.io/kops/upup/pkg/fi"
|
||||
"k8s.io/kops/util/pkg/vfs"
|
||||
"math/big"
|
||||
"net"
|
||||
|
@ -98,6 +99,8 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap) {
|
|||
dest["GetInstanceGroup"] = tf.GetInstanceGroup
|
||||
|
||||
dest["CloudTags"] = tf.CloudTags
|
||||
|
||||
dest["APIServerCount"] = tf.APIServerCount
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
// 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