Skip to content

Commit

Permalink
Merge pull request #789 from robscott/v1alpha1-crds
Browse files Browse the repository at this point in the history
Versioning CRD yaml to simplify only installing v1alpha2
  • Loading branch information
k8s-ci-robot authored Aug 19, 2021
2 parents b56d255 + 1ddf27a commit db18d56
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 83 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
apis/generated/** linguist-generated=true
apis/**/generated.pb.go linguist-generated=true
apis/**/generated.proto linguist-generated=true
config/crd/bases/** linguist-generated=true
config/crd/v1alpha1/** linguist-generated=true
config/crd/v1alpha2/** linguist-generated=true
pkg/client/** linguist-generated=true

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ install: crd example
# Install the CRD's to a pre-existing cluster.
.PHONY: crd
crd:
kubectl kustomize config/crd | kubectl apply -f -
kubectl kustomize config/crd/v1alpha2 | kubectl apply -f -

# Install the example resources to a pre-existing cluster.
.PHONY: example
Expand Down
20 changes: 7 additions & 13 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
resources:
- bases/networking.x-k8s.io_gatewayclasses.yaml
- bases/networking.x-k8s.io_gateways.yaml
- bases/networking.x-k8s.io_httproutes.yaml
- bases/networking.x-k8s.io_tcproutes.yaml
- bases/networking.x-k8s.io_tlsroutes.yaml
- bases/networking.x-k8s.io_udproutes.yaml
- bases/networking.x-k8s.io_backendpolicies.yaml
- bases/gateway.networking.k8s.io_gatewayclasses.yaml
- bases/gateway.networking.k8s.io_gateways.yaml
- bases/gateway.networking.k8s.io_httproutes.yaml
- bases/gateway.networking.k8s.io_tcproutes.yaml
- bases/gateway.networking.k8s.io_tlsroutes.yaml
- bases/gateway.networking.k8s.io_udproutes.yaml
- v1alpha2/gateway.networking.k8s.io_gatewayclasses.yaml
- v1alpha2/gateway.networking.k8s.io_gateways.yaml
- v1alpha2/gateway.networking.k8s.io_httproutes.yaml
- v1alpha2/gateway.networking.k8s.io_referencepolicies.yaml
- v1alpha2/gateway.networking.k8s.io_tcproutes.yaml
- v1alpha2/gateway.networking.k8s.io_tlsroutes.yaml
- v1alpha2/gateway.networking.k8s.io_udproutes.yaml
16 changes: 11 additions & 5 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,22 @@ fi

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

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

# TODO(robscott): Change this once v1alpha2 has received formal API approval.
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*
echo "Generating v1alpha2 CRDs and deepcopy"
go run sigs.k8s.io/controller-tools/cmd/controller-gen \
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
crd:crdVersions=v1 \
output:crd:artifacts:config=config/crd/v1alpha2 \
paths=./apis/v1alpha2

# TODO(robscott): Change this once v1alpha2 has received formal API approval.
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*

for VERSION in v1alpha1 v1alpha2
do
Expand Down
57 changes: 0 additions & 57 deletions hack/verify-crds.sh

This file was deleted.

18 changes: 12 additions & 6 deletions hack/verify-examples-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,20 @@ res=0
KIND_CREATE_ATTEMPTED=true
kind create cluster --name "${CLUSTER_NAME}" --kubeconfig "${KUBECONFIG}" || res=$?

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

# Temporary workaround for https://github.com/kubernetes/kubernetes/issues/104090
sleep 8
# Temporary workaround for https://github.com/kubernetes/kubernetes/issues/104090
sleep 8

# Install all example gateway-api resources.
kubectl apply --kubeconfig "${KUBECONFIG}" --recursive -f examples || res=$?
# Install all example gateway-api resources.
kubectl apply --kubeconfig "${KUBECONFIG}" --recursive -f examples/"${VERSION}" || res=$?

# Uninstall CRDs
kubectl delete --kubeconfig "${KUBECONFIG}" -f config/crd/"${VERSION}" || res=$?
done

# Clean up and exit
cleanup || res=$?
Expand Down

0 comments on commit db18d56

Please sign in to comment.