This is a huge commit, it does following things:

1. refactor kubesphere dependency service client creation, we can
disable dependency by config
2. dependencies can be configured by configuration file
3. refactor cmd package using cobra.Command, so we can use hypersphere
to invoke command sepearately. Later we only need to build one image to
contains all kubesphere core components. One command to rule them all!
4. live reloading configuration currently not implemented
This commit is contained in:
Jeff
2019-09-03 15:20:22 +08:00
parent 52a1c2e619
commit 96d2ac4112
233 changed files with 26414 additions and 1927 deletions

View File

@@ -0,0 +1,61 @@
package s2is3
import (
"github.com/spf13/pflag"
"kubesphere.io/kubesphere/pkg/utils/reflectutils"
)
type S3Options struct {
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
DisableSSL bool `json:"disableSSL,omitempty" yaml:"disableSSL,omitempty"`
ForcePathStyle bool `json:"forcePathStyle,omitempty" yaml:"forePathStyle,omitempty"`
AccessKeyID string `json:"accessKeyID,omitempty" yaml:"accessKeyID,omitempty"`
SecretAccessKey string `json:"secretAccessKey,omitempty" yaml:"secretAccessKey,omitempty"`
SessionToken string `json:"sessionToken,omitempty" yaml:"sessionToken,omitempty"`
Bucket string `json:"bucket,omitempty" yaml:"bucket,omitempty"`
}
func NewS3Options() *S3Options {
return &S3Options{
Endpoint: "",
Region: "",
DisableSSL: true,
ForcePathStyle: true,
AccessKeyID: "",
SecretAccessKey: "",
SessionToken: "",
Bucket: "",
}
}
func (s *S3Options) Validate() []error {
errors := []error{}
return errors
}
func (s *S3Options) ApplyTo(options *S3Options) {
reflectutils.Override(options, s)
}
func (s *S3Options) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&s.Endpoint, "s3-endpoint", s.Endpoint, ""+
"Endpoint to access to s3 object storage service, if left blank, the following options "+
"will be ignored.")
fs.StringVar(&s.Region, "s3-region", s.Region, ""+
"Region of s3 that will access to, like us-east-1.")
fs.StringVar(&s.AccessKeyID, "s3-access-key-id", "AKIAIOSFODNN7EXAMPLE", "access key of s2i s3")
fs.StringVar(&s.SecretAccessKey, "s3-secret-access-key", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "secret access key of s2i s3")
fs.StringVar(&s.SessionToken, "s3-session-token", s.SessionToken, "session token of s2i s3")
fs.StringVar(&s.Bucket, "s3-bucket", "s2i-binaries", "bucket name of s2i s3")
fs.BoolVar(&s.DisableSSL, "s3-disable-SSL", s.DisableSSL, "disable ssl")
fs.BoolVar(&s.ForcePathStyle, "s3-force-path-style", true, "force path style")
}