mirror of https://github.com/kubernetes/kops.git
Merge pull request #72 from justinsb/upup_polish_2
upup: misc polish marching towards v1
This commit is contained in:
commit
b57c3ca1ab
|
@ -157,10 +157,18 @@ func (c *CreateClusterCmd) Run() error {
|
|||
if c.Config.KubernetesVersion == "" {
|
||||
return fmt.Errorf("Must either specify a KubernetesVersion (-kubernetes-version) or provide an asset with the release bundle")
|
||||
}
|
||||
defaultReleaseAsset := fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/v%s/kubernetes-server-linux-amd64.tar.gz", c.Config.KubernetesVersion)
|
||||
glog.Infof("Adding default kubernetes release asset: %s", defaultReleaseAsset)
|
||||
// TODO: Verify it exists, get the hash (that will check that KubernetesVersion is valid)
|
||||
c.Config.Assets = append(c.Config.Assets, defaultReleaseAsset)
|
||||
//defaultReleaseAsset := fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/v%s/kubernetes-server-linux-amd64.tar.gz", c.Config.KubernetesVersion)
|
||||
//glog.Infof("Adding default kubernetes release asset: %s", defaultReleaseAsset)
|
||||
|
||||
defaultKubeletAsset := fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/v%s/bin/linux/amd64/kubelet", c.Config.KubernetesVersion)
|
||||
glog.Infof("Adding default kubelet release asset: %s", defaultKubeletAsset)
|
||||
|
||||
defaultKubectlAsset := fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/v%s/bin/linux/amd64/kubectl", c.Config.KubernetesVersion)
|
||||
glog.Infof("Adding default kubelet release asset: %s", defaultKubectlAsset)
|
||||
|
||||
// TODO: Verify assets exist, get the hash (that will check that KubernetesVersion is valid)
|
||||
|
||||
c.Config.Assets = append(c.Config.Assets, defaultKubeletAsset, defaultKubectlAsset)
|
||||
}
|
||||
|
||||
if c.Config.NodeUp.Location == "" {
|
||||
|
@ -169,12 +177,6 @@ func (c *CreateClusterCmd) Run() error {
|
|||
c.Config.NodeUp.Location = location
|
||||
}
|
||||
|
||||
if useProtokube {
|
||||
location := "https://kubeupv2.s3.amazonaws.com/protokube/protokube.tar.gz"
|
||||
glog.Infof("Using default protokube location: %q", location)
|
||||
c.Config.Assets = append(c.Config.Assets, location)
|
||||
}
|
||||
|
||||
var cloud fi.Cloud
|
||||
|
||||
var project string
|
||||
|
|
|
@ -37,6 +37,9 @@ Tokens:
|
|||
"system:logging": {{ GetOrCreateSecret "system:logging" }}
|
||||
"system:monitoring": {{ GetOrCreateSecret "system:monitoring" }}
|
||||
"system:dns": {{ GetOrCreateSecret "system:dns" }}
|
||||
{{ if HasTag "_kope_routing" }}
|
||||
"kope-routing": {{ GetOrCreateSecret "kope-routing" }}
|
||||
{{ end }}
|
||||
|
||||
Tags:
|
||||
{{ range $tag := Args }}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# kope-routing podspec
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: kope-routing
|
||||
namespace: kube-system
|
||||
spec:
|
||||
hostNetwork: true
|
||||
containers:
|
||||
- name: kope-routing
|
||||
image: kope/route-controller
|
||||
#resources:
|
||||
# requests:
|
||||
# cpu: {{ .KubeProxy.CPURequest }}
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
# - /usr/bin/route-controller --boot-id=/var/lib/kope-routing/boot-id --kubeconfig=/var/lib/kope-routing/kubeconfig --healthz-port=10247 1>>/var/log/kope-routing.log 2>&1
|
||||
- /usr/bin/route-controller --provider=gre --boot-id=/var/lib/kope-routing/boot-id --kubeconfig=/var/lib/kope-routing/kubeconfig --healthz-port=10247
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /etc/ssl/certs
|
||||
name: ssl-certs-host
|
||||
readOnly: true
|
||||
# - mountPath: /var/log
|
||||
# name: varlog
|
||||
# readOnly: false
|
||||
- mountPath: /var/lib/kope-routing/kubeconfig
|
||||
name: kubeconfig
|
||||
readOnly: true
|
||||
- mountPath: /var/lib/kope-routing/boot-id
|
||||
name: host-boot-id
|
||||
readOnly: true
|
||||
volumes:
|
||||
- hostPath:
|
||||
path: /usr/share/ca-certificates
|
||||
name: ssl-certs-host
|
||||
- hostPath:
|
||||
path: /var/lib/kope-routing/kubeconfig
|
||||
name: kubeconfig
|
||||
- hostPath:
|
||||
path: /proc/sys/kernel/random/boot_id
|
||||
name: host-boot-id
|
||||
# - hostPath:
|
||||
# path: /var/log
|
||||
# name: varlog
|
|
@ -0,0 +1,17 @@
|
|||
apiVersion: v1
|
||||
kind: Config
|
||||
users:
|
||||
- name: kope-routing
|
||||
user:
|
||||
token: {{ .GetToken "kope-routing" }}
|
||||
clusters:
|
||||
- name: local
|
||||
cluster:
|
||||
certificate-authority-data: {{ Base64Encode .CACertificate.AsString }}
|
||||
server: https://{{ .MasterInternalName }}
|
||||
contexts:
|
||||
- context:
|
||||
cluster: local
|
||||
user: kope-routing
|
||||
name: service-account-context
|
||||
current-context: service-account-context
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"mode": "0400"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"ifNotExists": true
|
||||
}
|
|
@ -36,7 +36,7 @@ func (e *SecurityGroup) Find(c *fi.Context) (*SecurityGroup, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
filters := cloud.BuildFilters(nil) // TODO: Do we need any filters here - done by group-name
|
||||
filters := cloud.BuildFilters(e.Name)
|
||||
filters = append(filters, awsup.NewEC2Filter("vpc-id", *vpcID))
|
||||
filters = append(filters, awsup.NewEC2Filter("group-name", *e.Name))
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ func (l *Loader) Build(baseDir string) (map[string]fi.Task, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
glog.Infof("options: %s", fi.DebugAsJsonStringIndent(l.config))
|
||||
glog.V(1).Infof("options: %s", fi.DebugAsJsonStringIndent(l.config))
|
||||
|
||||
// Second pass: load everything else
|
||||
tw = &loader.TreeWalker{
|
||||
|
@ -218,7 +218,7 @@ func (l *Loader) processDeferrals() error {
|
|||
return fmt.Errorf("Unable to find task %q, referenced from %s:%s", *name, taskKey, path)
|
||||
}
|
||||
|
||||
glog.Infof("Replacing task %q at %s:%s", *name, taskKey, path)
|
||||
glog.V(4).Infof("Replacing task %q at %s:%s", *name, taskKey, path)
|
||||
v.Set(reflect.ValueOf(primary))
|
||||
}
|
||||
return utils.SkipReflection
|
||||
|
@ -372,7 +372,7 @@ func (l *Loader) loadObjectMap(key string, data map[string]interface{}) (map[str
|
|||
|
||||
o := reflect.New(t)
|
||||
|
||||
glog.Warningf("replace with partial unmarshal...")
|
||||
// TODO replace with partial unmarshal...
|
||||
jsonValue, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error marshalling to json: %v", err)
|
||||
|
@ -381,7 +381,7 @@ func (l *Loader) loadObjectMap(key string, data map[string]interface{}) (map[str
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("error parsing %q: %v", key, err)
|
||||
}
|
||||
glog.Infof("Built %s:%s => %v", key, k, o.Interface())
|
||||
glog.V(4).Infof("Built %s:%s => %v", key, k, o.Interface())
|
||||
|
||||
if inferredName {
|
||||
hn, ok := o.Interface().(fi.HasName)
|
||||
|
|
|
@ -5,8 +5,11 @@ import (
|
|||
"github.com/golang/glog"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
const MaxAttemptsWithNoProgress = 3
|
||||
|
||||
type executor struct {
|
||||
context *Context
|
||||
}
|
||||
|
@ -43,10 +46,13 @@ func (e *executor) RunTasks(taskMap map[string]Task) error {
|
|||
}
|
||||
}
|
||||
|
||||
noProgressCount := 0
|
||||
for {
|
||||
var canRun []*taskState
|
||||
doneCount := 0
|
||||
for _, ts := range taskStates {
|
||||
if ts.done {
|
||||
doneCount++
|
||||
continue
|
||||
}
|
||||
ready := true
|
||||
|
@ -61,6 +67,7 @@ func (e *executor) RunTasks(taskMap map[string]Task) error {
|
|||
}
|
||||
}
|
||||
|
||||
glog.Infof("Tasks: %d done / %d total; %d can run", doneCount, len(taskStates), len(canRun))
|
||||
if len(canRun) == 0 {
|
||||
break
|
||||
}
|
||||
|
@ -86,12 +93,19 @@ func (e *executor) RunTasks(taskMap map[string]Task) error {
|
|||
|
||||
if !progress {
|
||||
if len(errors) != 0 {
|
||||
// TODO: Sleep and re-attempt?
|
||||
return fmt.Errorf("did not make any progress executing task. Example error: %v", errors[0])
|
||||
noProgressCount++
|
||||
if noProgressCount == MaxAttemptsWithNoProgress {
|
||||
return fmt.Errorf("did not make any progress executing task. Example error: %v", errors[0])
|
||||
} else {
|
||||
glog.Infof("No progress made, sleeping before retrying failed tasks")
|
||||
time.Sleep(10 * time.Second)
|
||||
}
|
||||
} else {
|
||||
// Logic error!
|
||||
panic("did not make progress executing tasks; but no errors reported")
|
||||
}
|
||||
} else {
|
||||
noProgressCount = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,10 +120,11 @@ type APIServerConfig struct {
|
|||
type KubeControllerManagerConfig struct {
|
||||
CloudProvider string `flag:"cloud-provider"`
|
||||
|
||||
Master string `flag:"master"`
|
||||
ClusterName string `flag:"cluster-name"`
|
||||
ClusterCIDR string `flag:"cluster-cidr"`
|
||||
AllocateNodeCIDRs *bool `flag:"allocate-node-cidrs"`
|
||||
Master string `flag:"master"`
|
||||
ClusterName string `flag:"cluster-name"`
|
||||
ClusterCIDR string `flag:"cluster-cidr"`
|
||||
AllocateNodeCIDRs *bool `flag:"allocate-node-cidrs"`
|
||||
ConfigureCloudRoutes *bool `flag:"configure-cloud-routes"`
|
||||
// TODO: Name verbosity or LogLevel
|
||||
LogLevel int `flag:"v"`
|
||||
LeaderElect *bool `flag:"leader-elect"`
|
||||
|
|
|
@ -39,9 +39,14 @@ func (c *DeleteCluster) ListResources() (map[string]DeletableResource, error) {
|
|||
|
||||
resources := make(map[string]DeletableResource)
|
||||
|
||||
filters := cloud.BuildFilters(nil)
|
||||
tags := cloud.BuildTags(nil, nil)
|
||||
|
||||
var filters []*ec2.Filter
|
||||
for k, v := range tags {
|
||||
filter := awsup.NewEC2Filter("tag:"+k, v)
|
||||
filters = append(filters, filter)
|
||||
}
|
||||
|
||||
{
|
||||
glog.V(2).Infof("Listing all Autoscaling groups matching cluster tags")
|
||||
var asgNames []*string
|
||||
|
|
Loading…
Reference in New Issue