Skip to content

Commit db18d56

Browse files
authored
Merge pull request kubernetes-sigs#789 from robscott/v1alpha1-crds
Versioning CRD yaml to simplify only installing v1alpha2
2 parents b56d255 + 1ddf27a commit db18d56

20 files changed

+33
-83
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
apis/generated/** linguist-generated=true
99
apis/**/generated.pb.go linguist-generated=true
1010
apis/**/generated.proto linguist-generated=true
11-
config/crd/bases/** linguist-generated=true
11+
config/crd/v1alpha1/** linguist-generated=true
12+
config/crd/v1alpha2/** linguist-generated=true
1213
pkg/client/** linguist-generated=true
1314

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ install: crd example
5151
# Install the CRD's to a pre-existing cluster.
5252
.PHONY: crd
5353
crd:
54-
kubectl kustomize config/crd | kubectl apply -f -
54+
kubectl kustomize config/crd/v1alpha2 | kubectl apply -f -
5555

5656
# Install the example resources to a pre-existing cluster.
5757
.PHONY: example

config/crd/kustomization.yaml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
resources:
2-
- bases/networking.x-k8s.io_gatewayclasses.yaml
3-
- bases/networking.x-k8s.io_gateways.yaml
4-
- bases/networking.x-k8s.io_httproutes.yaml
5-
- bases/networking.x-k8s.io_tcproutes.yaml
6-
- bases/networking.x-k8s.io_tlsroutes.yaml
7-
- bases/networking.x-k8s.io_udproutes.yaml
8-
- bases/networking.x-k8s.io_backendpolicies.yaml
9-
- bases/gateway.networking.k8s.io_gatewayclasses.yaml
10-
- bases/gateway.networking.k8s.io_gateways.yaml
11-
- bases/gateway.networking.k8s.io_httproutes.yaml
12-
- bases/gateway.networking.k8s.io_tcproutes.yaml
13-
- bases/gateway.networking.k8s.io_tlsroutes.yaml
14-
- bases/gateway.networking.k8s.io_udproutes.yaml
2+
- v1alpha2/gateway.networking.k8s.io_gatewayclasses.yaml
3+
- v1alpha2/gateway.networking.k8s.io_gateways.yaml
4+
- v1alpha2/gateway.networking.k8s.io_httproutes.yaml
5+
- v1alpha2/gateway.networking.k8s.io_referencepolicies.yaml
6+
- v1alpha2/gateway.networking.k8s.io_tcproutes.yaml
7+
- v1alpha2/gateway.networking.k8s.io_tlsroutes.yaml
8+
- v1alpha2/gateway.networking.k8s.io_udproutes.yaml

hack/update-codegen.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,22 @@ fi
4545

4646
readonly COMMON_FLAGS="${VERIFY_FLAG:-} --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt"
4747

48-
echo "Generating CRDs and deepcopy"
48+
echo "Generating v1alpha1 CRDs and deepcopy"
4949
go run sigs.k8s.io/controller-tools/cmd/controller-gen \
5050
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
5151
crd:crdVersions=v1 \
52-
output:crd:artifacts:config=config/crd/bases \
53-
paths=./...
52+
output:crd:artifacts:config=config/crd/v1alpha1 \
53+
paths=./apis/v1alpha1
5454

55-
# TODO(robscott): Change this once v1alpha2 has received formal API approval.
56-
sed -i -e 's/controller\-gen\.kubebuilder\.io\/version\:\ v0\.5\.0/api\-approved\.kubernetes\.io\:\ unapproved/g' config/crd/bases/gateway.networking.k8s.io*
55+
echo "Generating v1alpha2 CRDs and deepcopy"
56+
go run sigs.k8s.io/controller-tools/cmd/controller-gen \
57+
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
58+
crd:crdVersions=v1 \
59+
output:crd:artifacts:config=config/crd/v1alpha2 \
60+
paths=./apis/v1alpha2
5761

62+
# TODO(robscott): Change this once v1alpha2 has received formal API approval.
63+
sed -i -e 's/controller\-gen\.kubebuilder\.io\/version\:\ v0\.5\.0/api\-approved\.kubernetes\.io\:\ unapproved/g' config/crd/v1alpha2/gateway.networking.k8s.io*
5864

5965
for VERSION in v1alpha1 v1alpha2
6066
do

hack/verify-crds.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.

hack/verify-examples-kind.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,20 @@ res=0
5151
KIND_CREATE_ATTEMPTED=true
5252
kind create cluster --name "${CLUSTER_NAME}" --kubeconfig "${KUBECONFIG}" || res=$?
5353

54-
# Install CRDs
55-
kubectl apply --kubeconfig "${KUBECONFIG}" -f config/crd/bases || res=$?
54+
for VERSION in v1alpha1 v1alpha2
55+
do
56+
# Install CRDs
57+
kubectl apply --kubeconfig "${KUBECONFIG}" -f config/crd/"${VERSION}" || res=$?
5658

57-
# Temporary workaround for https://github.com/kubernetes/kubernetes/issues/104090
58-
sleep 8
59+
# Temporary workaround for https://github.com/kubernetes/kubernetes/issues/104090
60+
sleep 8
5961

60-
# Install all example gateway-api resources.
61-
kubectl apply --kubeconfig "${KUBECONFIG}" --recursive -f examples || res=$?
62+
# Install all example gateway-api resources.
63+
kubectl apply --kubeconfig "${KUBECONFIG}" --recursive -f examples/"${VERSION}" || res=$?
64+
65+
# Uninstall CRDs
66+
kubectl delete --kubeconfig "${KUBECONFIG}" -f config/crd/"${VERSION}" || res=$?
67+
done
6268

6369
# Clean up and exit
6470
cleanup || res=$?

0 commit comments

Comments
 (0)