mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Merge 5 fragile proto-bindings scripts into 1
Each of these scripts is basically identical, and all were too brittle. Now they should be more resilient and easier to manage. The script still needs to be updated if we add new ones, which I do not love. More cleanup to follow.
This commit is contained in:
parent
589300dd84
commit
e0ecccff3f
@ -72,7 +72,7 @@ function kube::protoc::format() {
|
||||
|
||||
# Run gofmt to clean up the generated code.
|
||||
kube::golang::verify_go_version
|
||||
gofmt -l -s -w "${package}/api.pb.go"
|
||||
gofmt -s -w "${package}/api.pb.go"
|
||||
}
|
||||
|
||||
# Compares the contents of $1 and $2
|
||||
|
@ -39,8 +39,7 @@ BASH_TARGETS=(
|
||||
update-generated-protobuf
|
||||
update-codegen
|
||||
update-generated-runtime
|
||||
update-generated-device-plugin
|
||||
update-generated-dynamic-resource-allocation
|
||||
update-generated-proto-bindings
|
||||
update-generated-api-compatibility-data
|
||||
update-generated-docs
|
||||
update-generated-swagger-docs
|
||||
|
@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script generates `*/api.pb.go` from the protobuf file `*/api.proto`.
|
||||
# Example:
|
||||
# kube::protoc::generate_proto "${DEVICE_PLUGIN_ALPHA}"
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"
|
||||
DEVICE_PLUGIN_ALPHA="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/deviceplugin/v1alpha/"
|
||||
DEVICE_PLUGIN_V1BETA1="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1/"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
kube::protoc::generate_proto "${DEVICE_PLUGIN_ALPHA}"
|
||||
kube::protoc::generate_proto "${DEVICE_PLUGIN_V1BETA1}"
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script generates `*/api.pb.go` from the protobuf file `*/api.proto`.
|
||||
# Example:
|
||||
# kube::protoc::generate_proto "${DYNAMIC_RESOURCE_ALLOCATION_ALPHA}"
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"
|
||||
DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha1/"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
kube::protoc::generate_proto "${DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1}"
|
@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
# NOTE: All output from this script needs to be copied back to the calling
|
||||
# source tree. This is managed in kube::build::copy_output in build/common.sh.
|
||||
# If the output set is changed update that function.
|
||||
|
||||
"${KUBE_ROOT}/build/run.sh" hack/update-generated-dynamic-resource-allocation-dockerized.sh "$@"
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
KUBE_KMS_V1BETA1="${KUBE_ROOT}/staging/src/k8s.io/kms/apis/v1beta1/"
|
||||
KUBE_KMS_V2ALPHA1="${KUBE_ROOT}/staging/src/k8s.io/kms/apis/v2alpha1/"
|
||||
KUBE_KMS_V2="${KUBE_ROOT}/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2alpha1/"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
kube::protoc::generate_proto "${KUBE_KMS_V1BETA1}"
|
||||
kube::protoc::generate_proto "${KUBE_KMS_V2ALPHA1}"
|
||||
kube::protoc::generate_proto "${KUBE_KMS_V2}"
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
# NOTE: All output from this script needs to be copied back to the calling
|
||||
# source tree. This is managed in kube::build::copy_output in build/common.sh.
|
||||
# If the output set is changed update that function.
|
||||
|
||||
"${KUBE_ROOT}/build/run.sh" hack/update-generated-kms-dockerized.sh "$@"
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script generates `*/api.pb.go` from the protobuf file `*/api.proto`.
|
||||
# Example:
|
||||
# kube::protoc::generate_proto "${KUBELET_PLUGIN_REGISTRATION_V1ALPHA}"
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"
|
||||
|
||||
dirs=(
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1alpha1/"
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1beta1/"
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1/"
|
||||
"pkg/kubelet/pluginmanager/pluginwatcher/example_plugin_apis/v1beta1/"
|
||||
"pkg/kubelet/pluginmanager/pluginwatcher/example_plugin_apis/v1beta2/"
|
||||
)
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
|
||||
for d in "${dirs[@]}"; do
|
||||
kube::protoc::generate_proto "${KUBE_ROOT}/${d}"
|
||||
done
|
@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
# NOTE: All output from this script needs to be copied back to the calling
|
||||
# source tree. This is managed in kube::build::copy_output in build/common.sh.
|
||||
# If the output set is changed update that function.
|
||||
|
||||
"${KUBE_ROOT}/build/run.sh" hack/update-generated-kubelet-plugin-registration-dockerized.sh "$@"
|
@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script generates `*/api.pb.go` from the protobuf file `*/api.proto`.
|
||||
# Example:
|
||||
# kube::protoc::generate_proto "${POD_RESOURCES}"
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"
|
||||
|
||||
dirs=(
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/podresources/v1alpha1/"
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/"
|
||||
)
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
|
||||
for d in "${dirs[@]}"; do
|
||||
kube::protoc::generate_proto "${KUBE_ROOT}/${d}"
|
||||
done
|
||||
|
@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script generates `/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/api.pb.go`
|
||||
# from the protobuf file `/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/api.proto`
|
||||
# for pods.
|
||||
# Usage: `hack/update-generated-pod-resources.sh`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
|
||||
# NOTE: All output from this script needs to be copied back to the calling
|
||||
# source tree. This is managed in kube::build::copy_output in build/common.sh.
|
||||
# If the output set is changed update that function.
|
||||
|
||||
"${KUBE_ROOT}/build/run.sh" hack/update-generated-pod-resources-dockerized.sh "$@"
|
51
hack/update-generated-proto-bindings-dockerized.sh
Executable file
51
hack/update-generated-proto-bindings-dockerized.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script generates `*/api.pb.go` files from protobuf files `*/api.proto`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
|
||||
# Each element of this array is a directory containing subdirectories which
|
||||
# eventually contain a file named "api.proto".
|
||||
APIS=(
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/podresources"
|
||||
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/deviceplugin"
|
||||
|
||||
"staging/src/k8s.io/kms/apis"
|
||||
"staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2"
|
||||
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/dra"
|
||||
|
||||
"staging/src/k8s.io/kubelet/pkg/apis/pluginregistration"
|
||||
"pkg/kubelet/pluginmanager/pluginwatcher/example_plugin_apis"
|
||||
)
|
||||
|
||||
for api in "${APIS[@]}"; do
|
||||
# This can't use `git ls-files` because it runs in a container without the
|
||||
# .git dir synced.
|
||||
find "${api}" -type f -name "api.proto" \
|
||||
| while read -r F; do
|
||||
D="$(dirname "${F}")"
|
||||
kube::protoc::generate_proto "${KUBE_ROOT}/${D}"
|
||||
done
|
||||
done
|
@ -24,4 +24,4 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
# source tree. This is managed in kube::build::copy_output in build/common.sh.
|
||||
# If the output set is changed update that function.
|
||||
|
||||
"${KUBE_ROOT}/build/run.sh" hack/update-generated-device-plugin-dockerized.sh "$@"
|
||||
"${KUBE_ROOT}/build/run.sh" hack/update-generated-proto-bindings-dockerized.sh
|
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script checks whether updating of device plugin API is needed or not. We
|
||||
# should run `hack/update-generated-device-plugin.sh` if device plugin API is
|
||||
# out of date.
|
||||
# Usage: `hack/verify-generated-device-plugin.sh`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
ERROR="Device plugin api is out of date. Please run hack/update-generated-device-plugin.sh"
|
||||
DEVICE_PLUGIN_ALPHA="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/deviceplugin/v1alpha/"
|
||||
DEVICE_PLUGIN_V1BETA1="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1/"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
kube::golang::setup_env
|
||||
|
||||
function cleanup {
|
||||
rm -rf "${DEVICE_PLUGIN_ALPHA}/_tmp/"
|
||||
rm -rf "${DEVICE_PLUGIN_V1BETA1}/_tmp/"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir -p "${DEVICE_PLUGIN_ALPHA}/_tmp"
|
||||
cp "${DEVICE_PLUGIN_ALPHA}/api.pb.go" "${DEVICE_PLUGIN_ALPHA}/_tmp/"
|
||||
mkdir -p "${DEVICE_PLUGIN_V1BETA1}/_tmp"
|
||||
cp "${DEVICE_PLUGIN_V1BETA1}/api.pb.go" "${DEVICE_PLUGIN_V1BETA1}/_tmp/"
|
||||
|
||||
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-device-plugin.sh"
|
||||
kube::protoc::diff "${DEVICE_PLUGIN_ALPHA}/api.pb.go" "${DEVICE_PLUGIN_ALPHA}/_tmp/api.pb.go" "${ERROR}"
|
||||
echo "Generated device plugin alpha api is up to date."
|
||||
kube::protoc::diff "${DEVICE_PLUGIN_V1BETA1}/api.pb.go" "${DEVICE_PLUGIN_V1BETA1}/_tmp/api.pb.go" "${ERROR}"
|
||||
echo "Generated device plugin beta api is up to date."
|
@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2022 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script checks whether updating of device plugin API is needed or not. We
|
||||
# should run `hack/update-generated-dynamic-resource-allocation.sh` if device plugin API is
|
||||
# out of date.
|
||||
# Usage: `hack/verify-generated-dynamic-resource-allocation.sh`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
ERROR="Dynamic resource allocation kubelet plugin api is out of date. Please run hack/update-generated-dynamic-resource-allocation.sh"
|
||||
DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/dra/v1alpha1/"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
kube::golang::setup_env
|
||||
|
||||
function cleanup {
|
||||
rm -rf "${DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1}/_tmp/"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir -p "${DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1}/_tmp"
|
||||
cp "${DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1}/api.pb.go" "${DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1}/_tmp/"
|
||||
|
||||
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-dynamic-resource-allocation.sh"
|
||||
kube::protoc::diff "${DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1}/api.pb.go" "${DYNAMIC_RESOURCE_ALLOCATION_V1ALPHA1}/_tmp/api.pb.go" "${ERROR}"
|
||||
echo "Generated dynamic resource allocation kubelet plugin alpha api is up to date."
|
@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script checks whether updating of KMS gRPC is needed or not. We should
|
||||
# run `hack/update-generated-kms.sh` if KMS gRPC is out of date.
|
||||
# Usage: `hack/verify-generated-kms.sh`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
ERROR="KMS gRPC is out of date. Please run hack/update-generated-kms.sh"
|
||||
KUBE_KMS_V1BETA1="${KUBE_ROOT}/staging/src/k8s.io/kms/apis/v1beta1/"
|
||||
KUBE_KMS_V2ALPHA1="${KUBE_ROOT}/staging/src/k8s.io/kms/apis/v2alpha1/"
|
||||
KUBE_KMS_V2="${KUBE_ROOT}/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/v2alpha1/"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
kube::golang::setup_env
|
||||
|
||||
function cleanup {
|
||||
rm -rf "${KUBE_KMS_V1BETA1}/_tmp/"
|
||||
rm -rf "${KUBE_KMS_V2ALPHA1}/_tmp/"
|
||||
rm -rf "${KUBE_KMS_V2}/_tmp/"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir -p "${KUBE_KMS_V1BETA1}/_tmp"
|
||||
cp "${KUBE_KMS_V1BETA1}/api.pb.go" "${KUBE_KMS_V1BETA1}/_tmp/"
|
||||
mkdir -p "${KUBE_KMS_V2ALPHA1}/_tmp"
|
||||
cp "${KUBE_KMS_V2ALPHA1}/api.pb.go" "${KUBE_KMS_V2ALPHA1}/_tmp/"
|
||||
mkdir -p "${KUBE_KMS_V2}/_tmp"
|
||||
cp "${KUBE_KMS_V2}/api.pb.go" "${KUBE_KMS_V2}/_tmp/"
|
||||
|
||||
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-kms.sh"
|
||||
kube::protoc::diff "${KUBE_KMS_V1BETA1}/api.pb.go" "${KUBE_KMS_V1BETA1}/_tmp/api.pb.go" "${ERROR}"
|
||||
echo "Generated kms v1beta1 api is up to date."
|
||||
kube::protoc::diff "${KUBE_KMS_V2ALPHA1}/api.pb.go" "${KUBE_KMS_V2ALPHA1}/_tmp/api.pb.go" "${ERROR}"
|
||||
echo "Generated kms v2alpha1 api is up to date."
|
||||
kube::protoc::diff "${KUBE_KMS_V2}/api.pb.go" "${KUBE_KMS_V2}/_tmp/api.pb.go" "${ERROR}"
|
||||
echo "Generated kms v2 api is up to date."
|
@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script checks whether updating of kubelet plugin registration API is
|
||||
# needed or not. We should run
|
||||
# `hack/update-generated-kubelet-plugin-registration.sh` if kubelet plugin
|
||||
# registration API is out of date.
|
||||
# Usage: `hack/verify-generated-kubelet-plugin-registration.sh`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
ERROR="Kubelet Plugin Registration api is out of date. Please run hack/update-generated-kubelet-plugin-registration.sh"
|
||||
KUBELET_PLUGIN_REGISTRATION_V1ALPHA="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1alpha1/"
|
||||
KUBELET_PLUGIN_REGISTRATION_V1BETA="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/pluginregistration/v1beta1/"
|
||||
|
||||
source "${KUBE_ROOT}/hack/lib/protoc.sh"
|
||||
kube::golang::setup_env
|
||||
|
||||
function cleanup {
|
||||
rm -rf "${KUBELET_PLUGIN_REGISTRATION_V1ALPHA}/_tmp/"
|
||||
rm -rf "${KUBELET_PLUGIN_REGISTRATION_V1BETA}/_tmp/"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir -p "${KUBELET_PLUGIN_REGISTRATION_V1ALPHA}/_tmp"
|
||||
mkdir -p "${KUBELET_PLUGIN_REGISTRATION_V1BETA}/_tmp"
|
||||
|
||||
cp "${KUBELET_PLUGIN_REGISTRATION_V1ALPHA}/api.pb.go" "${KUBELET_PLUGIN_REGISTRATION_V1ALPHA}/_tmp/"
|
||||
cp "${KUBELET_PLUGIN_REGISTRATION_V1BETA}/api.pb.go" "${KUBELET_PLUGIN_REGISTRATION_V1BETA}/_tmp/"
|
||||
|
||||
# Check V1Alpha
|
||||
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-kubelet-plugin-registration.sh"
|
||||
kube::protoc::diff "${KUBELET_PLUGIN_REGISTRATION_V1ALPHA}/api.pb.go" "${KUBELET_PLUGIN_REGISTRATION_V1ALPHA}/_tmp/api.pb.go" "${ERROR}"
|
||||
echo "Generated Kubelet Plugin Registration api is up to date."
|
||||
|
||||
# Check V1Beta
|
||||
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-kubelet-plugin-registration.sh"
|
||||
kube::protoc::diff "${KUBELET_PLUGIN_REGISTRATION_V1BETA}/api.pb.go" "${KUBELET_PLUGIN_REGISTRATION_V1BETA}/_tmp/api.pb.go" "${ERROR}"
|
||||
echo "Generated Kubelet Plugin Registration api is up to date."
|
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script checks whether updating of Pod resources API is needed or not. We
|
||||
# should run `hack/update-generated-pod-resources.sh` if Pod resources API is
|
||||
# out of date.
|
||||
# Usage: `hack/verify-generated-pod-resources.sh`.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
POD_RESOURCES="${KUBE_ROOT}/staging/src/k8s.io/kubelet/pkg/apis/podresources/v1/"
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
function cleanup {
|
||||
rm -rf "${POD_RESOURCES}/_tmp/"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir -p "${POD_RESOURCES}/_tmp"
|
||||
cp "${POD_RESOURCES}/api.pb.go" "${POD_RESOURCES}/_tmp/"
|
||||
|
||||
ret=0
|
||||
KUBE_VERBOSE=3 "${KUBE_ROOT}/hack/update-generated-pod-resources.sh"
|
||||
diff -I "gzipped FileDescriptorProto" -I "0x" -Naupr "${POD_RESOURCES}/_tmp/api.pb.go" "${POD_RESOURCES}/api.pb.go" || ret=$?
|
||||
if [[ $ret -eq 0 ]]; then
|
||||
echo "Generated pod resources api is up to date."
|
||||
cp "${POD_RESOURCES}/_tmp/api.pb.go" "${POD_RESOURCES}/"
|
||||
else
|
||||
echo "Generated pod resources api is out of date. Please run hack/update-generated-pod-resources.sh"
|
||||
exit 1
|
||||
fi
|
49
hack/verify-generated-proto-bindings.sh
Executable file
49
hack/verify-generated-proto-bindings.sh
Executable file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script checks whether updating of protobuf bindings is needed.
|
||||
# Run `hack/update-generated-proto-bindings.sh` to regenerate them.
|
||||
#
|
||||
# Usage: `hack/verify-generated-proto-bindings.sh`.
|
||||
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::util::ensure_clean_working_dir
|
||||
|
||||
_tmpdir="$(kube::realpath "$(mktemp -d -t "$(basename "$0").XXXXXX")")"
|
||||
git worktree add -f -q "${_tmpdir}" HEAD
|
||||
kube::util::trap_add "git worktree remove -f ${_tmpdir}" EXIT
|
||||
cd "${_tmpdir}"
|
||||
|
||||
# Regenerate.
|
||||
hack/update-generated-proto-bindings.sh
|
||||
|
||||
# Test for diffs
|
||||
diffs=$(git status --porcelain | wc -l)
|
||||
if [[ ${diffs} -gt 0 ]]; then
|
||||
git status
|
||||
git diff
|
||||
echo
|
||||
echo "Proto bindings need to be regenerated" >&2
|
||||
echo "Please run 'hack/update-generated-proto-bindings.sh'" >&2
|
||||
exit 1
|
||||
fi
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// To regenerate api.pb.go run hack/update-generated-kms.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package v2alpha1;
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// To regenerate api.pb.go run hack/update-generated-kms.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package v1beta1;
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// To regenerate api.pb.go run hack/update-generated-kms.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package v2alpha1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// To regenerate api.pb.go run hack/update-generated-device-plugin.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package deviceplugin;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// To regenerate api.pb.go run hack/update-generated-device-plugin.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package v1beta1;
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// To regenerate api.pb.go run hack/update-generated-kubelet-plugin-registration.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
@ -78,4 +78,4 @@ message NodeUnprepareResourceRequest {
|
||||
|
||||
message NodeUnprepareResourceResponse {
|
||||
// Intentionally empty.
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// To regenerate api.pb.go run hack/update-generated-kubelet-plugin-registration.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package pluginregistration;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// To regenerate api.pb.go run hack/update-generated-kubelet-plugin-registration.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package pluginregistration;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// To regenerate api.pb.go run hack/update-generated-kubelet-plugin-registration.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package pluginregistration;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// To regenerate api.pb.go run hack/update-generated-pod-resources.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package v1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// To regenerate api.pb.go run hack/update-generated-pod-resources.sh
|
||||
// To regenerate api.pb.go run hack/update-generated-proto-bindings.sh
|
||||
syntax = "proto3";
|
||||
|
||||
package v1alpha1;
|
||||
@ -45,4 +45,4 @@ message ContainerResources {
|
||||
message ContainerDevices {
|
||||
string resource_name = 1;
|
||||
repeated string device_ids = 2;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user