parent
d34273543e
commit
4acaf27a5d
|
|
@ -1,20 +1,48 @@
|
||||||
hash: b2ea8a2133857a3860d2a63eec76a9eed71565f69723848ee17b77aacc49905b
|
hash: 427db08c70ab32596f9230f0111e24996f73b1b66ddd7365dd0b1b38c0ae367f
|
||||||
updated: 2017-05-10T14:44:44.907924292+02:00
|
updated: 2017-05-19T17:11:37.120200516+02:00
|
||||||
imports:
|
imports:
|
||||||
- name: cloud.google.com/go
|
- name: cloud.google.com/go
|
||||||
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
|
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
|
||||||
subpackages:
|
subpackages:
|
||||||
- compute/metadata
|
- compute/metadata
|
||||||
- internal
|
- internal
|
||||||
|
- name: github.com/aws/aws-sdk-go
|
||||||
|
version: 63ce630574a5ec05ecd8e8de5cea16332a5a684d
|
||||||
|
subpackages:
|
||||||
|
- aws
|
||||||
|
- aws/awserr
|
||||||
|
- aws/awsutil
|
||||||
|
- aws/client
|
||||||
|
- aws/client/metadata
|
||||||
|
- aws/corehandlers
|
||||||
|
- aws/credentials
|
||||||
|
- aws/credentials/ec2rolecreds
|
||||||
|
- aws/credentials/endpointcreds
|
||||||
|
- aws/credentials/stscreds
|
||||||
|
- aws/defaults
|
||||||
|
- aws/ec2metadata
|
||||||
|
- aws/endpoints
|
||||||
|
- aws/request
|
||||||
|
- aws/session
|
||||||
|
- aws/signer/v4
|
||||||
|
- private/protocol
|
||||||
|
- private/protocol/ec2query
|
||||||
|
- private/protocol/json/jsonutil
|
||||||
|
- private/protocol/jsonrpc
|
||||||
|
- private/protocol/query
|
||||||
|
- private/protocol/query/queryutil
|
||||||
|
- private/protocol/rest
|
||||||
|
- private/protocol/restxml
|
||||||
|
- private/protocol/xml/xmlutil
|
||||||
|
- private/waiter
|
||||||
|
- service/autoscaling
|
||||||
|
- service/ec2
|
||||||
|
- service/ecr
|
||||||
|
- service/elb
|
||||||
|
- service/route53
|
||||||
|
- service/sts
|
||||||
- name: github.com/blang/semver
|
- name: github.com/blang/semver
|
||||||
version: 31b736133b98f26d5e078ec9eb591666edfd091f
|
version: 31b736133b98f26d5e078ec9eb591666edfd091f
|
||||||
- name: github.com/coreos/etcd
|
|
||||||
version: 7e6d876385396bf3ea8f1b58ab24b697a3d9f5d8
|
|
||||||
subpackages:
|
|
||||||
- client
|
|
||||||
- pkg/pathutil
|
|
||||||
- pkg/types
|
|
||||||
- version
|
|
||||||
- name: github.com/coreos/go-oidc
|
- name: github.com/coreos/go-oidc
|
||||||
version: 5644a2f50e2d2d5ba0b474bc5bc55fea1925936d
|
version: 5644a2f50e2d2d5ba0b474bc5bc55fea1925936d
|
||||||
subpackages:
|
subpackages:
|
||||||
|
|
@ -23,10 +51,6 @@ imports:
|
||||||
- key
|
- key
|
||||||
- oauth2
|
- oauth2
|
||||||
- oidc
|
- oidc
|
||||||
- name: github.com/coreos/go-semver
|
|
||||||
version: 568e959cd89871e61434c1143528d9162da89ef2
|
|
||||||
subpackages:
|
|
||||||
- semver
|
|
||||||
- name: github.com/coreos/pkg
|
- name: github.com/coreos/pkg
|
||||||
version: fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8
|
version: fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8
|
||||||
subpackages:
|
subpackages:
|
||||||
|
|
@ -53,6 +77,8 @@ imports:
|
||||||
- swagger
|
- swagger
|
||||||
- name: github.com/ghodss/yaml
|
- name: github.com/ghodss/yaml
|
||||||
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
|
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
|
||||||
|
- name: github.com/go-ini/ini
|
||||||
|
version: 2e44421e256d82ebbf3d4d4fcabe8930b905eff3
|
||||||
- name: github.com/go-openapi/jsonpointer
|
- name: github.com/go-openapi/jsonpointer
|
||||||
version: 46af16f9f7b149af66e5d1bd010e3574dc06de98
|
version: 46af16f9f7b149af66e5d1bd010e3574dc06de98
|
||||||
- name: github.com/go-openapi/jsonreference
|
- name: github.com/go-openapi/jsonreference
|
||||||
|
|
@ -78,6 +104,8 @@ imports:
|
||||||
version: 3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
|
version: 3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
|
||||||
- name: github.com/imdario/mergo
|
- name: github.com/imdario/mergo
|
||||||
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
|
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
|
||||||
|
- name: github.com/jmespath/go-jmespath
|
||||||
|
version: 3433f3ea46d9f8019119e7dd41274e112a2359a9
|
||||||
- name: github.com/jonboulle/clockwork
|
- name: github.com/jonboulle/clockwork
|
||||||
version: 72f9bd7c4e0c2a40055ab3d0f09654f730cce982
|
version: 72f9bd7c4e0c2a40055ab3d0f09654f730cce982
|
||||||
- name: github.com/juju/ratelimit
|
- name: github.com/juju/ratelimit
|
||||||
|
|
@ -104,6 +132,8 @@ imports:
|
||||||
version: 5bd2802263f21d8788851d5305584c82a5c75d7e
|
version: 5bd2802263f21d8788851d5305584c82a5c75d7e
|
||||||
- name: github.com/Sirupsen/logrus
|
- name: github.com/Sirupsen/logrus
|
||||||
version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
|
version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f
|
||||||
|
subpackages:
|
||||||
|
- client
|
||||||
- name: github.com/spf13/pflag
|
- name: github.com/spf13/pflag
|
||||||
version: 5ccb023bc27df288a957c5e994cd44fd19619465
|
version: 5ccb023bc27df288a957c5e994cd44fd19619465
|
||||||
- name: github.com/ugorji/go
|
- name: github.com/ugorji/go
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ import:
|
||||||
version: ^0.3.0
|
version: ^0.3.0
|
||||||
- package: github.com/Sirupsen/logrus
|
- package: github.com/Sirupsen/logrus
|
||||||
version: ^0.11.5
|
version: ^0.11.5
|
||||||
- package: github.com/coreos/etcd
|
|
||||||
version: ^3.1.7
|
|
||||||
subpackages:
|
subpackages:
|
||||||
- client
|
- client
|
||||||
- package: github.com/lib/pq
|
- package: github.com/lib/pq
|
||||||
|
|
@ -14,12 +12,13 @@ import:
|
||||||
subpackages:
|
subpackages:
|
||||||
- context
|
- context
|
||||||
- package: k8s.io/apimachinery
|
- package: k8s.io/apimachinery
|
||||||
|
version: 84c15da65eb86243c295d566203d7689cc6ac04b
|
||||||
subpackages:
|
subpackages:
|
||||||
- pkg/util/json
|
- pkg/util/json
|
||||||
- pkg/util/remotecommand
|
- pkg/util/remotecommand
|
||||||
- package: k8s.io/client-go
|
- package: k8s.io/client-go
|
||||||
version: ^2.0.0
|
version: ^2.0.0
|
||||||
- package: k8s.io/kubernetes
|
- package: k8s.io/kubernetes
|
||||||
version: ^1.6.2
|
version: ee39d359dd0896c4c0eccf23f033f158ad3d3bd7
|
||||||
subpackages:
|
subpackages:
|
||||||
- pkg/client/unversioned/remotecommand
|
- pkg/client/unversioned/remotecommand
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
etcdclient "github.com/coreos/etcd/client"
|
|
||||||
"golang.org/x/net/context"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/pkg/api"
|
"k8s.io/client-go/pkg/api"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
|
|
@ -38,7 +36,6 @@ var (
|
||||||
type Config struct {
|
type Config struct {
|
||||||
KubeClient *kubernetes.Clientset //TODO: move clients to the better place?
|
KubeClient *kubernetes.Clientset //TODO: move clients to the better place?
|
||||||
RestClient *rest.RESTClient
|
RestClient *rest.RESTClient
|
||||||
EtcdClient etcdclient.KeysAPI
|
|
||||||
TeamsAPIClient *teams.API
|
TeamsAPIClient *teams.API
|
||||||
OpConfig config.Config
|
OpConfig config.Config
|
||||||
InfrastructureRoles map[string]spec.PgUser // inherited from the controller
|
InfrastructureRoles map[string]spec.PgUser // inherited from the controller
|
||||||
|
|
@ -146,22 +143,6 @@ func (c *Cluster) initUsers() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cluster) etcdKeyExists(keyName string) (bool, error) {
|
|
||||||
options := etcdclient.GetOptions{}
|
|
||||||
resp, err := c.EtcdClient.Get(context.Background(), keyName, &options)
|
|
||||||
if err != nil {
|
|
||||||
etcdErr, ok := err.(etcdclient.Error)
|
|
||||||
if !ok {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
if etcdErr.Code == etcdclient.ErrorCodeKeyNotFound {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp != nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Cluster) Create(stopCh <-chan struct{}) error {
|
func (c *Cluster) Create(stopCh <-chan struct{}) error {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
defer c.mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
|
|
@ -182,13 +163,6 @@ func (c *Cluster) Create(stopCh <-chan struct{}) error {
|
||||||
|
|
||||||
c.setStatus(spec.ClusterStatusCreating)
|
c.setStatus(spec.ClusterStatusCreating)
|
||||||
|
|
||||||
keyExist, err := c.etcdKeyExists(fmt.Sprintf("/%s/%s", c.OpConfig.EtcdScope, c.Metadata.Name))
|
|
||||||
if err != nil {
|
|
||||||
c.logger.Warnf("Can't check etcd key: %s", err)
|
|
||||||
}
|
|
||||||
if keyExist {
|
|
||||||
c.logger.Warnf("Etcd key for the cluster already exists")
|
|
||||||
}
|
|
||||||
//TODO: service will create endpoint implicitly
|
//TODO: service will create endpoint implicitly
|
||||||
ep, err := c.createEndpoint()
|
ep, err := c.createEndpoint()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package cluster
|
package cluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/json"
|
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
"k8s.io/client-go/pkg/apis/apps/v1beta1"
|
||||||
"k8s.io/client-go/pkg/labels"
|
"k8s.io/client-go/pkg/labels"
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
etcdclient "github.com/coreos/etcd/client"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/pkg/api/v1"
|
"k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
|
|
@ -21,7 +20,6 @@ type Config struct {
|
||||||
RestConfig *rest.Config
|
RestConfig *rest.Config
|
||||||
KubeClient *kubernetes.Clientset
|
KubeClient *kubernetes.Clientset
|
||||||
RestClient *rest.RESTClient
|
RestClient *rest.RESTClient
|
||||||
EtcdClient etcdclient.KeysAPI
|
|
||||||
TeamsAPIClient *teams.API
|
TeamsAPIClient *teams.API
|
||||||
InfrastructureRoles map[string]spec.PgUser
|
InfrastructureRoles map[string]spec.PgUser
|
||||||
}
|
}
|
||||||
|
|
@ -122,10 +120,6 @@ func (c *Controller) initController() {
|
||||||
DeleteFunc: c.podDelete,
|
DeleteFunc: c.podDelete,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := c.initEtcdClient(c.opConfig.EtcdHost); err != nil {
|
|
||||||
c.logger.Fatalf("Can't get etcd client: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.clusterEventQueues = make([]*cache.FIFO, c.opConfig.Workers)
|
c.clusterEventQueues = make([]*cache.FIFO, c.opConfig.Workers)
|
||||||
for i := range c.clusterEventQueues {
|
for i := range c.clusterEventQueues {
|
||||||
c.clusterEventQueues[i] = cache.NewFIFO(func(obj interface{}) (string, error) {
|
c.clusterEventQueues[i] = cache.NewFIFO(func(obj interface{}) (string, error) {
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package controller
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
etcdclient "github.com/coreos/etcd/client"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (c *Controller) initEtcdClient(etcdHost string) error {
|
|
||||||
etcdURL := fmt.Sprintf("http://%s", etcdHost)
|
|
||||||
|
|
||||||
cfg, err := etcdclient.New(etcdclient.Config{
|
|
||||||
Endpoints: []string{etcdURL},
|
|
||||||
Transport: etcdclient.DefaultTransport,
|
|
||||||
HeaderTimeoutPerRequest: time.Second,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
c.EtcdClient = etcdclient.NewKeysAPI(cfg)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
@ -23,7 +23,6 @@ func (c *Controller) makeClusterConfig() cluster.Config {
|
||||||
return cluster.Config{
|
return cluster.Config{
|
||||||
KubeClient: c.KubeClient,
|
KubeClient: c.KubeClient,
|
||||||
RestClient: c.RestClient,
|
RestClient: c.RestClient,
|
||||||
EtcdClient: c.EtcdClient,
|
|
||||||
TeamsAPIClient: c.TeamsAPIClient,
|
TeamsAPIClient: c.TeamsAPIClient,
|
||||||
OpConfig: config.Copy(c.opConfig),
|
OpConfig: config.Copy(c.opConfig),
|
||||||
InfrastructureRoles: infrastructureRoles,
|
InfrastructureRoles: infrastructureRoles,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue