Skip to content

Commit

Permalink
Fix indentation errors and warnings.
Browse files Browse the repository at this point in the history
Add missing vendor files to echo-basic:
conformance/echo-basic/vendor/github.com/paultag/sniff/LICENSE
conformance/echo-basic/vendor/github.com/paultag/sniff/parser/parser.go
  • Loading branch information
candita committed Aug 19, 2024
1 parent 77d5132 commit 75551a0
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 40 deletions.
65 changes: 32 additions & 33 deletions conformance/base/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,9 @@ spec:
selector:
app: backendtlspolicy-test
ports:
- protocol: TCP
port: 443
targetPort: 8443
- protocol: TCP
port: 443
targetPort: 8443
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -762,34 +762,33 @@ spec:
app: backendtlspolicy-test
spec:
containers:
- name: backendtlspolicy-test
image: gcr.io/k8s-staging-gateway-api/echo-basic:v20240412-v1.0.0-394-g40c666fd
volumeMounts:
- name: secret-volume
mountPath: /etc/secret-volume
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CA_CERT
value: /etc/secret-volume/crt
- name: CA_CERT_KEY
value: /etc/secret-volume/key
resources:
requests:
cpu: 10m
volumes:
- name: backendtlspolicy-test
image: gcr.io/k8s-staging-gateway-api/echo-basic:v20240412-v1.0.0-394-g40c666fd
volumeMounts:
- name: secret-volume
secret:
secretName: backend-tls-checks-certificate
items:
- key: tls.crt
path: crt
- key: tls.key
path: key
---
mountPath: /etc/secret-volume
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CA_CERT
value: /etc/secret-volume/crt
- name: CA_CERT_KEY
value: /etc/secret-volume/key
resources:
requests:
cpu: 10m
volumes:
- name: secret-volume
secret:
secretName: backend-tls-checks-certificate
items:
- key: tls.crt
path: crt
- key: tls.key
path: key
9 changes: 6 additions & 3 deletions conformance/echo-basic/echo-basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ func echoHandler(w http.ResponseWriter, r *http.Request) {
if strings.Contains(r.RequestURI, "backendTLS") {
sni, err = sniffForSNI(r.RemoteAddr)
if err != nil {
// Todo: research if for some test cases there won't be one
// TODO: research if for some test cases there won't be SNI available.
processError(w, err, http.StatusBadRequest)
return
}
}

Expand Down Expand Up @@ -340,14 +342,15 @@ func sniffForSNI(addr string) (string, error) {
return "", fmt.Errorf("could not read socket: %v", err)
}
// Take an incoming TLS Client Hello and return the SNI name.
sni, err = parser.GetHostname(data[:])
sni, err = parser.GetHostname(data)
if err != nil {
return "", fmt.Errorf("error getting SNI: %v", err)
}
if sni == "" {
return "", fmt.Errorf("no server name indication found")
} else {
return sni, nil
}
return sni, nil
}
}

Expand Down
13 changes: 13 additions & 0 deletions conformance/echo-basic/vendor/github.com/paultag/sniff/LICENSE

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

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

8 changes: 4 additions & 4 deletions conformance/tests/backendtlspolicy-normative.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ metadata:
namespace: gateway-conformance-infra
spec:
targetRefs:
- group: ""
kind: Service
name: "backendtlspolicy-test"
- group: ""
kind: Service
name: "backendtlspolicy-test"
validation:
caCertificateRefs:
group: ""
kind: Secret
name: "backend-tls-checks-certificate"
hostname: "abc.example.com"
hostname: "abc.example.com"

0 comments on commit 75551a0

Please sign in to comment.