*: add example for running on kubernetes

This commit is contained in:
Eric Chiang
2016-08-10 17:50:55 -07:00
parent 73e2349270
commit d313e5d493
11 changed files with 239 additions and 11 deletions

View File

@@ -94,7 +94,7 @@ func cmd() *cobra.Command {
}
// This sets the OAuth2 client and oidc client.
a.ctx = context.WithValue(a.ctx, oauth2.HTTPClient, &client)
a.ctx = context.WithValue(a.ctx, oauth2.HTTPClient, client)
}
// TODO(ericchiang): Retry with backoff

View File

@@ -47,23 +47,25 @@ func (s *Storage) UnmarshalYAML(unmarshal func(interface{}) error) error {
return err
}
s.Type = storageMeta.Type
var c struct {
Config StorageConfig `yaml:"config"`
}
// TODO(ericchiang): replace this with a registration process.
var err error
switch storageMeta.Type {
case "kubernetes":
c.Config = &kubernetes.Config{}
var config struct {
Config kubernetes.Config `yaml:"config"`
}
err = unmarshal(&config)
s.Config = &config.Config
case "memory":
c.Config = &memory.Config{}
var config struct {
Config memory.Config `yaml:"config"`
}
err = unmarshal(&config)
s.Config = &config.Config
default:
return fmt.Errorf("unknown storage type %q", storageMeta.Type)
}
if err := unmarshal(c); err != nil {
return err
}
s.Config = c.Config
return nil
return err
}
// StorageConfig is a configuration that can create a storage.