mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
Fixed validation of tls.caSecretName=None
This commit is contained in:
parent
cd44faad43
commit
18197de483
2 changed files with 8 additions and 5 deletions
|
@ -71,11 +71,13 @@ func (s TLSSpec) GetAltNames() (dnsNames, ipAddresses, emailAddresses []string,
|
|||
|
||||
// Validate the given spec
|
||||
func (s TLSSpec) Validate() error {
|
||||
if err := k8sutil.ValidateOptionalResourceName(s.CASecretName); err != nil {
|
||||
return maskAny(err)
|
||||
}
|
||||
if _, _, _, err := s.GetAltNames(); err != nil {
|
||||
return maskAny(err)
|
||||
if s.IsSecure() {
|
||||
if err := k8sutil.ValidateOptionalResourceName(s.CASecretName); err != nil {
|
||||
return maskAny(err)
|
||||
}
|
||||
if _, _, _, err := s.GetAltNames(); err != nil {
|
||||
return maskAny(err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ func TestTLSSpecValidate(t *testing.T) {
|
|||
// Valid
|
||||
assert.Nil(t, TLSSpec{CASecretName: ""}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: "foo"}.Validate())
|
||||
assert.Nil(t, TLSSpec{CASecretName: "None"}.Validate())
|
||||
assert.Nil(t, TLSSpec{AltNames: []string{}}.Validate())
|
||||
assert.Nil(t, TLSSpec{AltNames: []string{"foo"}}.Validate())
|
||||
assert.Nil(t, TLSSpec{AltNames: []string{"email@example.com", "127.0.0.1"}}.Validate())
|
||||
|
|
Loading…
Reference in a new issue