Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nds: add validation for tls_skip_verify #18333

Merged
merged 3 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/18333.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
services: Add validation message when `tls_skip_verify` is set to `true` on a Nomad service
```
5 changes: 5 additions & 0 deletions nomad/structs/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ func (sc *ServiceCheck) validateNomad() error {
return fmt.Errorf("tls_server_name may only be set for Consul service checks")
}

// tls_skip_verify is consul only
if sc.TLSSkipVerify {
return fmt.Errorf("tls_skip_verify may only be set for Consul service checks")
lgfa29 marked this conversation as resolved.
Show resolved Hide resolved
}

return nil
}

Expand Down
15 changes: 15 additions & 0 deletions nomad/structs/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,21 @@ func TestService_Validate(t *testing.T) {
},
expErr: true,
},
{
name: "provider nomad with tls skip verify",
input: &Service{
Name: "testservice",
Provider: "nomad",
Checks: []*ServiceCheck{
{
Name: "servicecheck",
Type: "http",
TLSSkipVerify: true,
},
},
},
expErr: true,
},
{
name: "provider nomad with connect",
input: &Service{
Expand Down