knative.dev/pkg@v0.0.0-20260602142205-ac97e43f6622/hack/update-codegen.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2018 The Knative 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 set -o errexit 18 set -o nounset 19 set -o pipefail 20 21 source $(dirname $0)/../vendor/knative.dev/hack/codegen-library.sh 22 23 echo "=== Update Codegen for $MODULE_NAME" 24 25 group "Knative Codegen" 26 27 # Knative Injection 28 ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ 29 knative.dev/pkg/client knative.dev/pkg/apis \ 30 "duck:v1alpha1,v1beta1,v1" \ 31 --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt 32 33 # Based on: https://github.com/kubernetes/kubernetes/blob/8ddabd0da5cc54761f3216c08e99fa1a9f7ee2c5/hack/lib/init.sh#L116 34 # The '-path' is a hack to workaround the lack of portable `-depth 2`. 35 K8S_TYPES=$(find ./vendor/k8s.io/api -type d -path '*/*/*/*/*/*' | cut -d'/' -f 5-6 | sort | sed 's@/@:@g' | 36 grep -v "abac:" | \ 37 grep -v "admission:" | \ 38 grep -v "componentconfig:" | \ 39 grep -v "imagepolicy:" | \ 40 grep -v "resource:" | \ 41 grep -v "storagemigration:" \ 42 grep -v "alpha" \ 43 ) 44 45 OUTPUT_PKG="knative.dev/pkg/client/injection/kube" \ 46 VERSIONED_CLIENTSET_PKG="k8s.io/client-go/kubernetes" \ 47 EXTERNAL_INFORMER_PKG="k8s.io/client-go/informers" \ 48 ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ 49 k8s.io/client-go \ 50 k8s.io/api \ 51 "${K8S_TYPES}" \ 52 --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt \ 53 --force-genreconciler-kinds "Namespace,ConfigMap,Deployment,Secret,Service,Pod,CronJob,NetworkPolicy,Node,ValidatingWebhookConfiguration,MutatingWebhookConfiguration,ServiceAccount" 54 55 OUTPUT_PKG="knative.dev/pkg/client/injection/apiextensions" \ 56 VERSIONED_CLIENTSET_PKG="k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" \ 57 ${REPO_ROOT_DIR}/hack/generate-knative.sh "injection" \ 58 k8s.io/apiextensions-apiserver/pkg/client \ 59 k8s.io/apiextensions-apiserver/pkg/apis \ 60 "apiextensions:v1beta1,v1" \ 61 --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt \ 62 --force-genreconciler-kinds "CustomResourceDefinition" 63 64 65 group "Kubernetes Codegen" 66 67 # Only deepcopy the Duck types, as they are not real resources. 68 go run k8s.io/code-generator/cmd/deepcopy-gen \ 69 --output-file zz_generated.deepcopy.go \ 70 --go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt \ 71 knative.dev/pkg/apis \ 72 knative.dev/pkg/apis/duck/v1alpha1 \ 73 knative.dev/pkg/apis/duck/v1beta1 \ 74 knative.dev/pkg/apis/duck/v1 \ 75 knative.dev/pkg/tracker \ 76 knative.dev/pkg/logging \ 77 knative.dev/pkg/testing \ 78 knative.dev/pkg/testing/duck \ 79 knative.dev/pkg/webhook/resourcesemantics/conversion/internal 80 81 group "Update deps post-codegen" 82 83 # Make sure our dependencies are up-to-date 84 ${REPO_ROOT_DIR}/hack/update-deps.sh