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

Cherry picking several more PRs before 0.5.1 release #1393

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 1 deletion apis/v1alpha2/object_reference_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ type BackendObjectReference struct {
Namespace *Namespace `json:"namespace,omitempty"`

// Port specifies the destination port number to use for this resource.
// Port is required when the referent is a Kubernetes Service.
// Port is required when the referent is a Kubernetes Service. In this
// case, the port number is the service port number, not the target port.
// For other resources, destination port might be derived from the referent
// resource or this field.
//
Expand Down
2 changes: 2 additions & 0 deletions apis/v1alpha2/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ const (
// Possible reasons for this condition to be false are:
//
// * "RefNotPermitted"
// * "InvalidKind"
// * "BackendNotFound"
//
// Controllers may raise this condition with other reasons,
// but should prefer to use the reasons listed above to improve
Expand Down
3 changes: 2 additions & 1 deletion apis/v1beta1/object_reference_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ type BackendObjectReference struct {
Namespace *Namespace `json:"namespace,omitempty"`

// Port specifies the destination port number to use for this resource.
// Port is required when the referent is a Kubernetes Service.
// Port is required when the referent is a Kubernetes Service. In this
// case, the port number is the service port number, not the target port.
// For other resources, destination port might be derived from the referent
// resource or this field.
//
Expand Down
2 changes: 2 additions & 0 deletions apis/v1beta1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ const (
// Possible reasons for this condition to be false are:
//
// * "RefNotPermitted"
// * "InvalidKind"
// * "BackendNotFound"
//
// Controllers may raise this condition with other reasons,
// but should prefer to use the reasons listed above to improve
Expand Down
38 changes: 24 additions & 14 deletions config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml

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.

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.

38 changes: 24 additions & 14 deletions config/crd/standard/gateway.networking.k8s.io_httproutes.yaml

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

58 changes: 58 additions & 0 deletions conformance/tests/gateway-secret-missing-referenced-secret.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
Copyright 2022 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package tests

import (
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

"sigs.k8s.io/gateway-api/apis/v1alpha2"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
)

func init() {
ConformanceTests = append(ConformanceTests, GatewaySecretMissingReferencedSecret)
}

var GatewaySecretMissingReferencedSecret = suite.ConformanceTest{
ShortName: "GatewaySecretMissingReferencedSecret",
Description: "A Gateway should fail to become ready if the Gateway has a certificateRef for a nonexistent Secret",
Manifests: []string{"tests/gateway-secret-missing-referenced-secret.yaml"},
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
gwNN := types.NamespacedName{Name: "gateway-secret-missing-referenced-secret", Namespace: "gateway-conformance-infra"}

t.Run("Gateway listener should have a false ResolvedRefs condition with reason InvalidCertificateRef", func(t *testing.T) {
listeners := []v1alpha2.ListenerStatus{{
Name: v1alpha2.SectionName("https"),
SupportedKinds: []v1alpha2.RouteGroupKind{{
Group: (*v1alpha2.Group)(&v1alpha2.GroupVersion.Group),
Kind: v1alpha2.Kind("HTTPRoute"),
}},
Conditions: []metav1.Condition{{
Type: string(v1alpha2.ListenerConditionResolvedRefs),
Status: metav1.ConditionFalse,
Reason: string(v1alpha2.ListenerReasonInvalidCertificateRef),
}},
}}

kubernetes.GatewayStatusMustHaveListeners(t, s.Client, gwNN, listeners, 60)
})
},
}
19 changes: 19 additions & 0 deletions conformance/tests/gateway-secret-missing-referenced-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
name: gateway-secret-missing-referenced-secret
namespace: gateway-conformance-infra
spec:
gatewayClassName: "{GATEWAY_CLASS_NAME}"
listeners:
- name: https
port: 443
protocol: HTTPS
allowedRoutes:
namespaces:
from: All
tls:
certificateRefs:
- group: ""
kind: Secret
name: nonexistent-secret