Skip to content

Commit ba96bfe

Browse files
committed
add update_supported_features.sh
1 parent 54fd807 commit ba96bfe

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

.github/workflows/supported_features.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ jobs:
2323
echo "found diff between the current and the expected supportedFeatures"
2424
echo -e "expected: ${GREEN}${expected_features}${NC}"
2525
echo -e "current: ${RED}${current_features}${NC}"
26-
echo -e "${YELLOW}Please run \`go run hack/supportedfeatures/main.go\` and update +kubebuilder:validation:Enum in gatewayclass_types.go${NC}"
26+
echo -e "${YELLOW}Please run \`hack/supportedfeatures/update_supported_features.sh\` to update kubebuilder:validation:Enum list${NC}"
2727
exit 1
2828
fi

apis/v1/gatewayclass_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,5 +266,7 @@ type GatewayClassList struct {
266266

267267
// SupportedFeature is used to describe distinct features that are covered by
268268
// conformance tests.
269+
// +NOTE kububuilder enum validation below has a freshness check configured.
270+
// +Please refrain from adding a line between the line below and `type SupportedFeature string`.
269271
// +kubebuilder:validation:Enum=Gateway;GatewayPort8080;GatewayStaticAddresses;HTTPRoute;HTTPRouteBackendProtocolH2C;HTTPRouteBackendProtocolWebSocket;HTTPRouteBackendTimeout;HTTPRouteDestinationPortMatching;HTTPRouteHostRewrite;HTTPRouteMethodMatching;HTTPRouteParentRefPort;HTTPRoutePathRedirect;HTTPRoutePathRewrite;HTTPRoutePortRedirect;HTTPRouteQueryParamMatching;HTTPRouteRequestMirror;HTTPRouteRequestMultipleMirrors;HTTPRouteRequestTimeout;HTTPRouteResponseHeaderModification;HTTPRouteSchemeRedirect;Mesh;ReferenceGrant;TLSRoute
270272
type SupportedFeature string
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Copyright 2024 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
expected_features=$(go run hack/supportedfeatures/main.go)
18+
sed -i -E "/^\/\/\s\+kubebuilder:validation:Enum=/ {N; s|(\/\/\s\+kubebuilder:validation:Enum=)(.*)(\ntype\sSupportedFeature\sstring)|\1$expected_features\3|}"

0 commit comments

Comments
 (0)