Allow no provisioners.

This commit is contained in:
Mariano Cano 2019-12-16 11:22:24 -08:00
parent ba11f6acb7
commit 6d6f496331
2 changed files with 6 additions and 9 deletions

View file

@ -76,9 +76,6 @@ func (c *AuthConfig) Validate(audiences provisioner.Audiences) error {
if c == nil { if c == nil {
return errors.New("authority cannot be undefined") return errors.New("authority cannot be undefined")
} }
if len(c.Provisioners) == 0 {
return errors.New("authority.provisioners cannot be empty")
}
// Check that only one K8sSA is enabled // Check that only one K8sSA is enabled
var k8sCount int var k8sCount int

View file

@ -255,12 +255,6 @@ func TestAuthConfigValidate(t *testing.T) {
err: errors.New("authority cannot be undefined"), err: errors.New("authority cannot be undefined"),
} }
}, },
"fail-empty-provisioners": func(t *testing.T) AuthConfigValidateTest {
return AuthConfigValidateTest{
ac: &AuthConfig{},
err: errors.New("authority.provisioners cannot be empty"),
}
},
"fail-invalid-provisioners": func(t *testing.T) AuthConfigValidateTest { "fail-invalid-provisioners": func(t *testing.T) AuthConfigValidateTest {
return AuthConfigValidateTest{ return AuthConfigValidateTest{
ac: &AuthConfig{ ac: &AuthConfig{
@ -283,6 +277,12 @@ func TestAuthConfigValidate(t *testing.T) {
err: errors.New("claims: MinTLSCertDuration must be greater than 0"), err: errors.New("claims: MinTLSCertDuration must be greater than 0"),
} }
}, },
"ok-empty-provisioners": func(t *testing.T) AuthConfigValidateTest {
return AuthConfigValidateTest{
ac: &AuthConfig{},
asn1dn: x509util.ASN1DN{},
}
},
"ok-empty-asn1dn-template": func(t *testing.T) AuthConfigValidateTest { "ok-empty-asn1dn-template": func(t *testing.T) AuthConfigValidateTest {
return AuthConfigValidateTest{ return AuthConfigValidateTest{
ac: &AuthConfig{ ac: &AuthConfig{