Skip to content

Commit

Permalink
feat(meshexternalservice): add servername (#10445)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
  • Loading branch information
lukidzi authored Jun 12, 2024
1 parent 8938b8f commit 551f23e
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ spec:
- Secured
- SkipAll
type: string
serverName:
description: ServerName overrides the default Server Name
Indicator set by Kuma.
type: string
subjectAltNames:
description: SubjectAltNames list of names to verify in the
certificate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ spec:
- Secured
- SkipAll
type: string
serverName:
description: ServerName overrides the default Server Name
Indicator set by Kuma.
type: string
subjectAltNames:
description: SubjectAltNames list of names to verify in the
certificate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ spec:
- Secured
- SkipAll
type: string
serverName:
description: ServerName overrides the default Server Name
Indicator set by Kuma.
type: string
subjectAltNames:
description: SubjectAltNames list of names to verify in the
certificate.
Expand Down
4 changes: 4 additions & 0 deletions app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,10 @@ spec:
- Secured
- SkipAll
type: string
serverName:
description: ServerName overrides the default Server Name
Indicator set by Kuma.
type: string
subjectAltNames:
description: SubjectAltNames list of names to verify in the
certificate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ spec:
- Secured
- SkipAll
type: string
serverName:
description: ServerName overrides the default Server Name
Indicator set by Kuma.
type: string
subjectAltNames:
description: SubjectAltNames list of names to verify in the
certificate.
Expand Down
4 changes: 4 additions & 0 deletions docs/generated/raw/crds/kuma.io_meshexternalservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ spec:
- Secured
- SkipAll
type: string
serverName:
description: ServerName overrides the default Server Name
Indicator set by Kuma.
type: string
subjectAltNames:
description: SubjectAltNames list of names to verify in the
certificate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ type Verification struct {
// Mode defines if proxy should skip verification, one of `SkipSAN`, `SkipCA`, `Secured`, `SkipAll`. Default `Secured`.
// +kubebuilder:default=Secured
Mode *VerificationMode `json:"mode,omitempty"`
// ServerName overrides the default Server Name Indicator set by Kuma.
ServerName *string `json:"serverName,omitempty"`
// SubjectAltNames list of names to verify in the certificate.
SubjectAltNames *[]SANMatch `json:"subjectAltNames,omitempty"`
// CaCert defines a certificate of CA.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ properties:
- Secured
- SkipAll
type: string
serverName:
description: ServerName overrides the default Server Name Indicator set by Kuma.
type: string
subjectAltNames:
description: SubjectAltNames list of names to verify in the certificate.
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ tls:
min: TLS15
max: TLS16
verification:
serverName: not[]valid
mode: Unknown
subjectAltNames:
- type: Regex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ violations:
message: '"min" must be one of ["TLSAuto", "TLS10", "TLS11", "TLS12", "TLS13"]'
- field: spec.tls.version.max
message: '"max" must be one of ["TLSAuto", "TLS10", "TLS11", "TLS12", "TLS13"]'
- field: spec.tls.verification.serverName
message: must be a valid DNS name
- field: spec.tls.verification.mode
message: '"mode" must be one of ["SkipSAN", "SkipCA", "SkipAll", "Secured"]'
- field: spec.tls.verification.subjectAltNames[0].type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ tls:
max: TLS13
allowRenegotiation: false
verification:
serverName: "example.com"
subjectAltNames:
- type: Exact
value: example.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func validateTls(tls *Tls) validators.ValidationError {

if tls.Verification != nil {
path := validators.RootedAt("verification")
if tls.Verification.ServerName != nil && !govalidator.IsDNSName(*tls.Verification.ServerName) {
verr.AddViolationAt(path.Field("serverName"), "must be a valid DNS name")
}
if tls.Verification.Mode != nil {
if !slices.Contains(allVerificationModes, string(*tls.Verification.Mode)) {
verr.AddErrorAt(path.Field("mode"), validators.MakeFieldMustBeOneOfErr("mode", allVerificationModes...))
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ spec:
- Secured
- SkipAll
type: string
serverName:
description: ServerName overrides the default Server Name
Indicator set by Kuma.
type: string
subjectAltNames:
description: SubjectAltNames list of names to verify in the
certificate.
Expand Down

0 comments on commit 551f23e

Please sign in to comment.