Adding better validation of k8s authType config
@@ -35,6 +35,9 @@ type APIConfig struct {
// Validate validates the K8s API config
func (c *APIConfig) Validate() error {
+ if c.AuthType != AuthTypeNone && c.AuthType != AuthTypeTLS && c.AuthType != AuthTypeServiceAccount {
+ return errors.New("Invalid authType for kubernetes: " + string(c.AuthType))
+ }
if c.AuthType == AuthTypeTLS && (c.ClientCertPath == "" || c.ClientKeyPath == "") {
return errors.New("For TLS auth, you must set both the kubernetesAPI.clientCertPath " +
"and kubernetesAPI.clientKeyPath config values")
