Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
Use appscode/grpc-go-addons (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha committed Feb 21, 2018
1 parent 691544b commit 722bac6
Show file tree
Hide file tree
Showing 168 changed files with 12,091 additions and 13,176 deletions.
38 changes: 19 additions & 19 deletions docs/reference/swift_run.md
Expand Up @@ -24,25 +24,25 @@ swift run [flags]
### Options

```
--api-domain string Domain used to server swift api
--cacert-file string File containing CA certificate
--cert-file string File container server TLS certificate
--connector string Name of connector used to connect to Tiller server. Valid values are: incluster, direct, kubeconfig, appscode
--cors-origin-allow-subdomain Allow CORS request from subdomains of origin
--cors-origin-host string Allowed CORS origin host e.g, domain[:port]
--enable-cors Enable CORS support
-h, --help help for run
--key-file string File containing server TLS private key
--kube-context string Kube context used by 'kubeconfig' connection
--ops-addr string Address to listen on for web interface and telemetry. (default ":56790")
--plaintext-addr string host:port used to server plaintext apis (default ":9855")
--secure-addr string host:port used to server secure apis (default ":50055")
--tiller-cacert-file string File containing CA certificate for Tiller server
--tiller-client-cert-file string File container client TLS certificate for Tiller server
--tiller-client-key-file string File containing client TLS private key for Tiller server
--tiller-endpoint string Endpoint of Tiller server, eg, [scheme://]host:port
--tiller-insecure-skip-verify Skip certificate verification for Tiller server
--tiller-timeout duration Timeout used to connect to Tiller server (default 5m0s)
--api-domain string Domain used for apiserver (prod: api.appscode.com
--connector string Name of connector used to connect to Tiller server. Valid values are: incluster, direct, kubeconfig, appscode
--cors-origin-allow-subdomain Allow CORS request from subdomains of origin (default true)
--cors-origin-host string Allowed CORS origin host e.g, domain[:port] (default "*")
--enable-cors Enable CORS support
-h, --help help for run
--kube-context string Kube context used by 'kubeconfig' connection
--log-rpc log RPC request and response
--plaintext-addr string host:port used to serve http json apis (default ":9855")
--secure-addr string host:port used to serve secure apis (default ":50055")
--tiller-ca-file string File containing CA certificate for Tiller server
--tiller-client-cert-file string File container client TLS certificate for Tiller server
--tiller-client-private-key-file string File containing client TLS private key for Tiller server
--tiller-endpoint string Endpoint of Tiller server, eg, [scheme://]host:port
--tiller-insecure-skip-verify Skip certificate verification for Tiller server
--tiller-timeout duration Timeout used to connect to Tiller server (default 5m0s)
--tls-ca-file string File containing CA certificate
--tls-cert-file string File container server TLS certificate
--tls-private-key-file string File containing server TLS private key
```

### Options inherited from parent commands
Expand Down
75 changes: 36 additions & 39 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 16 additions & 22 deletions glide.yaml
Expand Up @@ -2,47 +2,41 @@ package: github.com/appscode/swift
import:
- package: github.com/appscode/go
version: master
- package: github.com/appscode/grpc-go-addons
version: master
- package: github.com/appscode/kutil
version: release-6.0
- package: github.com/golang/glog
- package: golang.org/x/net
version: da118f7b8e5954f39d0d2130ab35d4bf0e3cb344
- package: golang.org/x/text
version: 470f45bf29f4147d6fbd7dfd0a02a848e49f5bf4
- package: github.com/golang/protobuf
version: 6e4cc92cc905d5f4a73041c1b8228ea08f4c6147
version: v1.0.0
- package: github.com/grpc-ecosystem/go-grpc-middleware
version: master
- package: github.com/grpc-ecosystem/go-grpc-prometheus
version: v1.1
- package: github.com/grpc-ecosystem/grpc-gateway
version: v1.3.1-ac
repo: https://github.com/appscode/grpc-gateway.git
vcs: git
- package: github.com/hashicorp/go-version
repo: https://github.com/appscode/go-version.git
vcs: git
version: master
- package: github.com/soheilhy/cmux
version: e09e9389d85d8492d313d73d1469c029e710623f
- package: github.com/jpillora/go-ogle-analytics
- package: github.com/pkg/errors
version: v0.8.0
- package: github.com/sirupsen/logrus
version: v1.0.4
- package: github.com/spf13/cobra
version: master
- package: github.com/spf13/pflag
version: v1.0.0
- package: github.com/xeipuuv/gojsonschema
- package: golang.org/x/net
- package: google.golang.org/genproto
- package: google.golang.org/grpc
version: v1.9.2
- package: google.golang.org/genproto
- package: k8s.io/api
version: kubernetes-1.9.0
- package: k8s.io/apiextensions-apiserver
version: kubernetes-1.9.0
- package: k8s.io/apimachinery
version: kubernetes-1.9.0
- package: k8s.io/client-go
version: v6.0.0
- package: k8s.io/kubernetes
version: v1.9.0
- package: k8s.io/helm
repo: https://github.com/appscode/helm.git
version: 2.8.0-ac
- package: github.com/grpc-ecosystem/go-grpc-prometheus
version: master
- package: github.com/jpillora/go-ogle-analytics
testImport:
- package: github.com/stretchr/testify
version: v1.1.4
4 changes: 3 additions & 1 deletion pkg/cmds/main.go → pkg/cmds/root.go
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"strings"

"github.com/appscode/go/signals"
v "github.com/appscode/go/version"
"github.com/appscode/kutil/tools/analytics"
"github.com/jpillora/go-ogle-analytics"
Expand Down Expand Up @@ -42,7 +43,8 @@ func NewRootCmd(version string) *cobra.Command {
flag.CommandLine.Parse([]string{})
rootCmd.PersistentFlags().BoolVar(&enableAnalytics, "analytics", enableAnalytics, "Send analytical events to Google Analytics")

rootCmd.AddCommand(NewCmdRun(version))
stopCh := signals.SetupSignalHandler()
rootCmd.AddCommand(NewCmdRun(stopCh))
rootCmd.AddCommand(v.NewCmdVersion())

return rootCmd
Expand Down
52 changes: 18 additions & 34 deletions pkg/cmds/run.go
Expand Up @@ -3,50 +3,34 @@ package cmds
import (
_ "net/http/pprof"

"github.com/appscode/go/hold"
"github.com/appscode/swift/pkg/connectors"
"github.com/appscode/swift/pkg/extpoints"
"github.com/appscode/swift/pkg/cmds/server"
_ "github.com/appscode/swift/pkg/release"
apiCmd "github.com/appscode/swift/pkg/server/cmd"
"github.com/appscode/swift/pkg/server/cmd/options"
"github.com/spf13/cobra"
)

func NewCmdRun(version string) *cobra.Command {
opt := options.New()
func NewCmdRun(stopCh <-chan struct{}) *cobra.Command {
o := server.NewSwiftOptions()

cmd := &cobra.Command{
Use: "run",
Short: "Run swift apis",
DisableAutoGenTag: true,
Run: func(cmd *cobra.Command, args []string) {
extpoints.Connectors.Register(&connectors.InClusterConnector{
TillerCACertFile: opt.TillerCACertFile,
TillerClientCertFile: opt.TillerClientCertFile,
TillerClientKeyFile: opt.TillerClientKeyFile,
InsecureSkipVerify: opt.InsecureSkipVerify,
Timeout: opt.Timeout,
}, connectors.UIDInClusterConnector)

extpoints.Connectors.Register(&connectors.DirectConnector{
TillerEndpoint: opt.TillerEndpoint,
TillerCACertFile: opt.TillerCACertFile,
TillerClientCertFile: opt.TillerClientCertFile,
TillerClientKeyFile: opt.TillerClientKeyFile,
InsecureSkipVerify: opt.InsecureSkipVerify,
Timeout: opt.Timeout,
}, connectors.UIDDirectConnector)

extpoints.Connectors.Register(&connectors.KubeconfigConnector{
Context: opt.KubeContext,
InsecureSkipVerify: opt.InsecureSkipVerify,
Timeout: opt.Timeout,
}, connectors.UIDKubeconfigConnector)

apiCmd.Run(opt)
hold.Hold()
RunE: func(c *cobra.Command, args []string) error {
if err := o.Complete(); err != nil {
return err
}
if err := o.Validate(args); err != nil {
return err
}
if err := o.RunServer(stopCh); err != nil {
return err
}
return nil
},
}

opt.AddFlags(cmd.Flags())
flags := cmd.Flags()
o.AddFlags(flags)

return cmd
}

0 comments on commit 722bac6

Please sign in to comment.