Skip to content

Commit 38e8d36

Browse files
k8s-ci-robotsubi9
authored andcommitted
yaml file matches with the example text.Merge pull request kubernetes-sigs#1334 from mlavacca/conformance-gateway-unexisting-secret
conformance: listener references invalid secret
2 parents 914a630 + b2a847f commit 38e8d36

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
Copyright 2022 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package tests
18+
19+
import (
20+
"testing"
21+
22+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23+
"k8s.io/apimachinery/pkg/types"
24+
25+
"sigs.k8s.io/gateway-api/apis/v1alpha2"
26+
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
27+
"sigs.k8s.io/gateway-api/conformance/utils/suite"
28+
)
29+
30+
func init() {
31+
ConformanceTests = append(ConformanceTests, GatewaySecretMissingReferencedSecret)
32+
}
33+
34+
var GatewaySecretMissingReferencedSecret = suite.ConformanceTest{
35+
ShortName: "GatewaySecretMissingReferencedSecret",
36+
Description: "A Gateway should fail to become ready if the Gateway has a certificateRef for a nonexistent Secret",
37+
Manifests: []string{"tests/gateway-secret-missing-referenced-secret.yaml"},
38+
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
39+
gwNN := types.NamespacedName{Name: "gateway-secret-missing-referenced-secret", Namespace: "gateway-conformance-infra"}
40+
41+
t.Run("Gateway listener should have a false ResolvedRefs condition with reason InvalidCertificateRef", func(t *testing.T) {
42+
listeners := []v1alpha2.ListenerStatus{{
43+
Name: v1alpha2.SectionName("https"),
44+
SupportedKinds: []v1alpha2.RouteGroupKind{{
45+
Group: (*v1alpha2.Group)(&v1alpha2.GroupVersion.Group),
46+
Kind: v1alpha2.Kind("HTTPRoute"),
47+
}},
48+
Conditions: []metav1.Condition{{
49+
Type: string(v1alpha2.ListenerConditionResolvedRefs),
50+
Status: metav1.ConditionFalse,
51+
Reason: string(v1alpha2.ListenerReasonInvalidCertificateRef),
52+
}},
53+
}}
54+
55+
kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, gwNN, listeners)
56+
})
57+
},
58+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: gateway.networking.k8s.io/v1alpha2
2+
kind: Gateway
3+
metadata:
4+
name: gateway-secret-missing-referenced-secret
5+
namespace: gateway-conformance-infra
6+
spec:
7+
gatewayClassName: "{GATEWAY_CLASS_NAME}"
8+
listeners:
9+
- name: https
10+
port: 443
11+
protocol: HTTPS
12+
allowedRoutes:
13+
namespaces:
14+
from: All
15+
tls:
16+
certificateRefs:
17+
- group: ""
18+
kind: Secret
19+
name: nonexistent-secret

examples/experimental/v1beta1/http-redirect-rewrite/httproute-rewrite.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ spec:
1212
- type: URLRewrite
1313
urlRewrite:
1414
hostname: elsewhere.example
15+
path:
16+
type: ReplacePrefixMatch
17+
replacePrefixMatch: /fennel
1518
backendRefs:
1619
- name: example-svc
1720
weight: 1

0 commit comments

Comments
 (0)