diff --git a/cmd/elasticsearch_discovery/main.go b/cmd/elasticsearch_discovery/main.go deleted file mode 100644 index 51c97547c..000000000 --- a/cmd/elasticsearch_discovery/main.go +++ /dev/null @@ -1,91 +0,0 @@ -package main - -import ( - "fmt" - "os" - "strings" - "time" - - "github.com/appscode/log" - logs "github.com/appscode/log/golog" - "k8s.io/kubernetes/pkg/api" - kubernetes "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" - rest "k8s.io/kubernetes/pkg/client/restclient" -) - -func flattenSubsets(subsets []api.EndpointSubset) []string { - ips := []string{} - for _, ss := range subsets { - for _, addr := range ss.Addresses { - ips = append(ips, fmt.Sprintf(`"%s"`, addr.IP)) - } - } - return ips -} - -func main() { - logs.InitLogs() - defer logs.FlushLogs() - log.Info("Kubernetes Elasticsearch Cluster discovery") - - ////// Collect service name and namespace ////// - args := os.Args[1:] - if len(args) < 2 { - log.Fatalln("Provide Kubernetes Service Name and Namespace Name") - } - var serviceName, namespace string - serviceName = args[0] - namespace = args[1] - log.Infof("Searching for %s.%s", serviceName, namespace) - //////////////////////////////////////////////// - cnf, err := rest.InClusterConfig() - if err != nil { - log.Fatalf("Failed to make client: %v", err) - } - - c, err := kubernetes.NewForConfig(cnf) - if err != nil { - log.Fatalf("Failed to make client: %v", err) - } - - var elasticsearch *api.Service - // Look for endpoints associated with the Elasticsearch loggging service. - // First wait for the service to become available. - for t := time.Now(); time.Since(t) < 5*time.Minute; time.Sleep(10 * time.Second) { - elasticsearch, err = c.Core().Services(namespace).Get(serviceName) - if err == nil { - break - } - } - // If we did not find an elasticsearch logging service then log a warning - // and return without adding any unicast hosts. - if elasticsearch == nil { - log.Warningf("Failed to find the Kubernetes service: %v", err) - return - } - - var endpoints *api.Endpoints - addrs := []string{} - // Wait for some endpoints. - count := 0 - for t := time.Now(); time.Since(t) < 5*time.Minute; time.Sleep(10 * time.Second) { - endpoints, err = c.Core().Endpoints(namespace).Get(serviceName) - if err != nil { - continue - } - addrs = flattenSubsets(endpoints.Subsets) - log.Infof("Found %s", addrs) - if len(addrs) > 0 && len(addrs) == count { - break - } - count = len(addrs) - } - // If there was an error finding endpoints then log a warning and quit. - if err != nil { - log.Warningf("Error finding endpoints: %v", err) - return - } - - log.Infof("Endpoints = %s", addrs) - fmt.Printf("discovery.zen.ping.unicast.hosts: [%s]\n", strings.Join(addrs, ", ")) -} diff --git a/cmd/elasticsearch_discovery/version.go b/cmd/elasticsearch_discovery/version.go deleted file mode 100644 index 5ebabb36e..000000000 --- a/cmd/elasticsearch_discovery/version.go +++ /dev/null @@ -1,35 +0,0 @@ -package main - -import ( - v "github.com/appscode/go/version" -) - -var ( - Version string - VersionStrategy string - Os string - Arch string - CommitHash string - GitBranch string - GitTag string - CommitTimestamp string - BuildTimestamp string - BuildHost string - BuildHostOs string - BuildHostArch string -) - -func init() { - v.Version.Version = Version - v.Version.VersionStrategy = VersionStrategy - v.Version.Os = Os - v.Version.Arch = Arch - v.Version.CommitHash = CommitHash - v.Version.GitBranch = GitBranch - v.Version.GitTag = GitTag - v.Version.CommitTimestamp = CommitTimestamp - v.Version.BuildTimestamp = BuildTimestamp - v.Version.BuildHost = BuildHost - v.Version.BuildHostOs = BuildHostOs - v.Version.BuildHostArch = BuildHostArch -} diff --git a/hack/make.py b/hack/make.py index 4dda14834..9b6084300 100755 --- a/hack/make.py +++ b/hack/make.py @@ -38,15 +38,6 @@ def check_antipackage(): libbuild.REPO_ROOT = expandvars('$GOPATH') + '/src/github.com/k8sdb/kubedb' BUILD_METADATA = libbuild.metadata(libbuild.REPO_ROOT) libbuild.BIN_MATRIX = { - 'elasticsearch_discovery': { - 'type': 'go', - 'release': True, - 'go_version': True, - 'use_cgo': False, - 'distro': { - 'linux': ['amd64'] - } - }, "kubedb": { 'type': 'go', 'release': True,