mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
vendor files
This commit is contained in:
1
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/.gitignore
generated
vendored
Normal file
1
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/.gitignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
elasticsearch_logging_discovery
|
41
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/BUILD
generated
vendored
Normal file
41
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/BUILD
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_binary",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "es-image",
|
||||
importpath = "k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image",
|
||||
library = ":go_default_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["elasticsearch_logging_discovery.go"],
|
||||
importpath = "k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image",
|
||||
deps = [
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/client/clientset_generated/internalclientset:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
|
||||
"//vendor/k8s.io/client-go/tools/clientcmd/api:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
25
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/Dockerfile
generated
vendored
Normal file
25
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/Dockerfile
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM docker.elastic.co/elasticsearch/elasticsearch:5.6.4
|
||||
|
||||
VOLUME ["/data"]
|
||||
EXPOSE 9200 9300
|
||||
|
||||
COPY elasticsearch_logging_discovery run.sh bin/
|
||||
COPY config/elasticsearch.yml config/log4j2.properties config/
|
||||
|
||||
USER root
|
||||
RUN chown -R elasticsearch:elasticsearch ./
|
||||
CMD ["bin/run.sh"]
|
31
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/Makefile
generated
vendored
Executable file
31
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/Makefile
generated
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
.PHONY: binary build push
|
||||
|
||||
PREFIX = gcr.io/google-containers
|
||||
IMAGE = elasticsearch
|
||||
TAG = v5.6.4
|
||||
|
||||
build:
|
||||
docker build --pull -t $(PREFIX)/$(IMAGE):$(TAG) .
|
||||
|
||||
push:
|
||||
gcloud docker -- push $(PREFIX)/$(IMAGE):$(TAG)
|
||||
|
||||
binary:
|
||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-w" elasticsearch_logging_discovery.go
|
||||
|
||||
clean:
|
||||
rm elasticsearch_logging_discovery
|
17
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/config/elasticsearch.yml
generated
vendored
Normal file
17
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/config/elasticsearch.yml
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
cluster.name: kubernetes-logging
|
||||
|
||||
node.name: ${NODE_NAME}
|
||||
node.master: ${NODE_MASTER}
|
||||
node.data: ${NODE_DATA}
|
||||
|
||||
transport.tcp.port: ${TRANSPORT_PORT}
|
||||
http.port: ${HTTP_PORT}
|
||||
|
||||
path.data: /data
|
||||
|
||||
network.host: 0.0.0.0
|
||||
|
||||
discovery.zen.minimum_master_nodes: ${MINIMUM_MASTER_NODES}
|
||||
|
||||
xpack.security.enabled: false
|
||||
xpack.monitoring.enabled: false
|
11
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/config/log4j2.properties
generated
vendored
Normal file
11
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/config/log4j2.properties
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
status = error
|
||||
|
||||
appender.console.type = Console
|
||||
appender.console.name = console
|
||||
appender.console.layout.type = PatternLayout
|
||||
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
|
||||
|
||||
rootLogger.level = info
|
||||
rootLogger.appenderRef.console.ref = console
|
||||
rootLogger.action = debug
|
||||
rootLogger.com.amazonaws = warn
|
128
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/elasticsearch_logging_discovery.go
generated
vendored
Normal file
128
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/elasticsearch_logging_discovery.go
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
clientapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
|
||||
)
|
||||
|
||||
func buildConfigFromEnvs(masterURL, kubeconfigPath string) (*restclient.Config, error) {
|
||||
if kubeconfigPath == "" && masterURL == "" {
|
||||
kubeconfig, err := restclient.InClusterConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return kubeconfig, nil
|
||||
}
|
||||
|
||||
return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
|
||||
&clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeconfigPath},
|
||||
&clientcmd.ConfigOverrides{ClusterInfo: clientapi.Cluster{Server: masterURL}}).ClientConfig()
|
||||
}
|
||||
|
||||
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() {
|
||||
flag.Parse()
|
||||
|
||||
glog.Info("Kubernetes Elasticsearch logging discovery")
|
||||
|
||||
cc, err := buildConfigFromEnvs(os.Getenv("APISERVER_HOST"), os.Getenv("KUBE_CONFIG_FILE"))
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to make client: %v", err)
|
||||
}
|
||||
client, err := clientset.NewForConfig(cc)
|
||||
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to make client: %v", err)
|
||||
}
|
||||
namespace := metav1.NamespaceSystem
|
||||
envNamespace := os.Getenv("NAMESPACE")
|
||||
if envNamespace != "" {
|
||||
if _, err := client.Core().Namespaces().Get(envNamespace, metav1.GetOptions{}); err != nil {
|
||||
glog.Fatalf("%s namespace doesn't exist: %v", envNamespace, err)
|
||||
}
|
||||
namespace = envNamespace
|
||||
}
|
||||
|
||||
var elasticsearch *api.Service
|
||||
serviceName := os.Getenv("ELASTICSEARCH_SERVICE_NAME")
|
||||
if serviceName == "" {
|
||||
serviceName = "elasticsearch-logging"
|
||||
}
|
||||
|
||||
// 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 = client.Core().Services(namespace).Get(serviceName, metav1.GetOptions{})
|
||||
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 {
|
||||
glog.Warningf("Failed to find the elasticsearch-logging 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 = client.Core().Endpoints(namespace).Get(serviceName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
addrs = flattenSubsets(endpoints.Subsets)
|
||||
glog.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 {
|
||||
glog.Warningf("Error finding endpoints: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
glog.Infof("Endpoints = %s", addrs)
|
||||
fmt.Printf("discovery.zen.ping.unicast.hosts: [%s]\n", strings.Join(addrs, ", "))
|
||||
}
|
29
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/run.sh
generated
vendored
Executable file
29
vendor/k8s.io/kubernetes/cluster/addons/fluentd-elasticsearch/es-image/run.sh
generated
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -ex
|
||||
|
||||
export NODE_NAME=${NODE_NAME:-${HOSTNAME}}
|
||||
export NODE_MASTER=${NODE_MASTER:-true}
|
||||
export NODE_DATA=${NODE_DATA:-true}
|
||||
export HTTP_PORT=${HTTP_PORT:-9200}
|
||||
export TRANSPORT_PORT=${TRANSPORT_PORT:-9300}
|
||||
export MINIMUM_MASTER_NODES=${MINIMUM_MASTER_NODES:-2}
|
||||
|
||||
chown -R elasticsearch:elasticsearch /data
|
||||
|
||||
./bin/elasticsearch_logging_discovery >> ./config/elasticsearch.yml
|
||||
exec su elasticsearch -c ./bin/es-docker
|
Reference in New Issue
Block a user