Skip to content

Commit

Permalink
Beta resources: Setting storage version to v1beta1, not serving v1alpha2
Browse files Browse the repository at this point in the history
This affects resources that graduated to v1beta1 in the v0.5.0 release.
Although that specific change is relatively small, it required a lot of
related work:

* Restructuring examples to remove v1alpha2 examples where they were no
  longer useful and their installation would fail
* Updating conformance tests to use v1beta1 where possible
* Some related fixes to v1alpha2 blog post to account for removal of
  v1alpha2 example
  • Loading branch information
robscott committed Aug 19, 2022
1 parent bb549d0 commit 521bb71
Show file tree
Hide file tree
Showing 130 changed files with 220 additions and 899 deletions.
2 changes: 1 addition & 1 deletion apis/v1alpha2/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=gateway-api,shortName=gtw
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:unservedversion
// +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.gatewayClassName`
// +kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.addresses[*].value`
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha2/gatewayclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=gateway-api,scope=Cluster,shortName=gc
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:unservedversion
// +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.spec.controllerName`
// +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha2/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=gateway-api
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:unservedversion
// +kubebuilder:printcolumn:name="Hostnames",type=string,JSONPath=`.spec.hostnames`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

Expand Down
1 change: 1 addition & 0 deletions apis/v1beta1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=gateway-api,shortName=gtw
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.gatewayClassName`
// +kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.addresses[*].value`
Expand Down
1 change: 1 addition & 0 deletions apis/v1beta1/gatewayclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
// +genclient:nonNamespaced
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=gateway-api,scope=Cluster,shortName=gc
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.spec.controllerName`
// +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status`
Expand Down
1 change: 1 addition & 0 deletions apis/v1beta1/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=gateway-api
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Hostnames",type=string,JSONPath=`.spec.hostnames`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
Expand Down

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.

6 changes: 3 additions & 3 deletions config/crd/standard/gateway.networking.k8s.io_gateways.yaml

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

6 changes: 3 additions & 3 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.

6 changes: 3 additions & 3 deletions conformance/base/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
labels:
gateway-conformance: infra
---
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: same-namespace
Expand All @@ -28,7 +28,7 @@ spec:
namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: all-namespaces
Expand All @@ -43,7 +43,7 @@ spec:
namespaces:
from: All
---
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: backend-namespaces
Expand Down
2 changes: 2 additions & 0 deletions conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"testing"

"sigs.k8s.io/gateway-api/apis/v1alpha2"
"sigs.k8s.io/gateway-api/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/tests"
"sigs.k8s.io/gateway-api/conformance/utils/flags"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
Expand All @@ -40,6 +41,7 @@ func TestConformance(t *testing.T) {
t.Fatalf("Error initializing Kubernetes client: %v", err)
}
v1alpha2.AddToScheme(client.Scheme())
v1beta1.AddToScheme(client.Scheme())

t.Logf("Running conformance tests with %s GatewayClass", *flags.GatewayClassName)

Expand Down
16 changes: 8 additions & 8 deletions conformance/tests/gateway-secret-invalid-reference-grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
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/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
)
Expand All @@ -40,16 +40,16 @@ var GatewaySecretInvalidReferenceGrant = suite.ConformanceTest{
gwNN := types.NamespacedName{Name: "gateway-secret-invalid-reference-grant", Namespace: "gateway-conformance-infra"}

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: gateway-secret-invalid-reference-grant
Expand Down
16 changes: 8 additions & 8 deletions conformance/tests/gateway-secret-missing-reference-grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
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/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
)
Expand All @@ -40,16 +40,16 @@ var GatewaySecretMissingReferenceGrant = suite.ConformanceTest{
gwNN := types.NamespacedName{Name: "gateway-secret-missing-reference-grant", Namespace: "gateway-conformance-infra"}

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: gateway-secret-missing-reference-grant
Expand Down
16 changes: 8 additions & 8 deletions conformance/tests/gateway-secret-missing-referenced-secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
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/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
)
Expand All @@ -39,16 +39,16 @@ var GatewaySecretMissingReferencedSecret = suite.ConformanceTest{
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"),
listeners := []v1beta1.ListenerStatus{{
Name: v1beta1.SectionName("https"),
SupportedKinds: []v1beta1.RouteGroupKind{{
Group: (*v1beta1.Group)(&v1beta1.GroupVersion.Group),
Kind: v1beta1.Kind("HTTPRoute"),
}},
Conditions: []metav1.Condition{{
Type: string(v1alpha2.ListenerConditionResolvedRefs),
Type: string(v1beta1.ListenerConditionResolvedRefs),
Status: metav1.ConditionFalse,
Reason: string(v1alpha2.ListenerReasonInvalidCertificateRef),
Reason: string(v1beta1.ListenerReasonInvalidCertificateRef),
}},
}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: gateway-secret-missing-referenced-secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
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/apis/v1beta1"
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
)
Expand All @@ -40,17 +40,17 @@ var GatewaySecretReferenceGrantAllInNamespace = suite.ConformanceTest{
gwNN := types.NamespacedName{Name: "gateway-secret-reference-grant", Namespace: "gateway-conformance-infra"}

t.Run("Gateway listener should have a true ResolvedRefs condition and a true Ready condition", func(t *testing.T) {
listeners := []v1alpha2.ListenerStatus{{
Name: v1alpha2.SectionName("https"),
SupportedKinds: []v1alpha2.RouteGroupKind{{
Group: (*v1alpha2.Group)(&v1alpha2.GroupVersion.Group),
Kind: v1alpha2.Kind("HTTPRoute"),
listeners := []v1beta1.ListenerStatus{{
Name: v1beta1.SectionName("https"),
SupportedKinds: []v1beta1.RouteGroupKind{{
Group: (*v1beta1.Group)(&v1beta1.GroupVersion.Group),
Kind: v1beta1.Kind("HTTPRoute"),
}},
Conditions: []metav1.Condition{
{
Type: string(v1alpha2.ListenerConditionReady),
Type: string(v1beta1.ListenerConditionReady),
Status: metav1.ConditionTrue,
Reason: string(v1alpha2.ListenerReasonReady),
Reason: string(v1beta1.ListenerReasonReady),
},
},
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: gateway-secret-reference-grant
Expand Down
Loading

0 comments on commit 521bb71

Please sign in to comment.