devlopment branch (#1736)

This commit is contained in:
zryfish
2020-01-02 20:52:00 +08:00
committed by GitHub
parent ff0ffe8650
commit eceadec69c
440 changed files with 61524 additions and 3699 deletions

View File

@@ -59,7 +59,7 @@ type ElasticSearchClient struct {
client Client
}
func NewLoggingClient(options *ElasticSearchOptions) (*ElasticSearchClient, error) {
func NewLoggingClient(options *Options) (*ElasticSearchClient, error) {
var version, index string
esClient := &ElasticSearchClient{}

View File

@@ -5,42 +5,42 @@ import (
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)
type ElasticSearchOptions struct {
type Options struct {
Host string `json:"host" yaml:"host"`
IndexPrefix string `json:"indexPrefix,omitempty" yaml:"indexPrefix"`
Version string `json:"version" yaml:"version"`
}
func NewElasticSearchOptions() *ElasticSearchOptions {
return &ElasticSearchOptions{
func NewElasticSearchOptions() *Options {
return &Options{
Host: "",
IndexPrefix: "fluentbit",
Version: "",
}
}
func (s *ElasticSearchOptions) ApplyTo(options *ElasticSearchOptions) {
func (s *Options) ApplyTo(options *Options) {
if s.Host != "" {
reflectutils.Override(options, s)
}
}
func (s *ElasticSearchOptions) Validate() []error {
func (s *Options) Validate() []error {
errs := []error{}
return errs
}
func (s *ElasticSearchOptions) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.Host, "elasticsearch-host", s.Host, ""+
func (s *Options) AddFlags(fs *pflag.FlagSet, c *Options) {
fs.StringVar(&s.Host, "elasticsearch-host", c.Host, ""+
"ElasticSearch logging service host. KubeSphere is using elastic as log store, "+
"if this filed left blank, KubeSphere will use kubernetes builtin log API instead, and"+
" the following elastic search options will be ignored.")
fs.StringVar(&s.IndexPrefix, "index-prefix", s.IndexPrefix, ""+
fs.StringVar(&s.IndexPrefix, "index-prefix", c.IndexPrefix, ""+
"Index name prefix. KubeSphere will retrieve logs against indices matching the prefix.")
fs.StringVar(&s.Version, "elasticsearch-version", s.Version, ""+
fs.StringVar(&s.Version, "elasticsearch-version", c.Version, ""+
"ElasticSearch major version, e.g. 5/6/7, if left blank, will detect automatically."+
"Currently, minimum supported version is 5.x")
}