chore: update static scheme (#588)

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
This commit is contained in:
Michael Crenshaw
2024-06-28 11:55:02 -04:00
committed by GitHub
parent f38075deb3
commit fa0e8d60a3
3 changed files with 1855 additions and 678 deletions

1
go.mod
View File

@@ -100,6 +100,7 @@ require (
)
replace (
// After bumping these versions, run hack/update_static_schema.sh in case the schema has changed.
k8s.io/api => k8s.io/api v0.29.6
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.29.6
k8s.io/apimachinery => k8s.io/apimachinery v0.29.6

18
hack/update_static_schema.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euox pipefail
# Get the k8s library version from go.mod, stripping the trailing newline
k8s_lib_version=$(grep "k8s.io/client-go" go.mod | awk '{print $2}' | head -n 1 | tr -d '\n')
# Download the parser file from the k8s library
curl -sL "https://raw.githubusercontent.com/kubernetes/client-go/$k8s_lib_version/applyconfigurations/internal/internal.go" -o pkg/utils/kube/scheme/parser.go
# Add a line to the beginning of the file saying that this is the script that generated it.
sed -i '' '1s/^/\/\/ Code generated by hack\/update_static_schema.sh; DO NOT EDIT.\n\/\/ Everything below is downloaded from applyconfigurations\/internal\/internal.go in kubernetes\/client-go.\n\n/' pkg/utils/kube/scheme/parser.go
# Replace "package internal" with "package scheme" in the parser file
sed -i '' 's/package internal/package scheme/' pkg/utils/kube/scheme/parser.go
# Replace "func Parser" with "func StaticParser"
sed -i '' 's/func Parser/func StaticParser/' pkg/utils/kube/scheme/parser.go

File diff suppressed because it is too large Load Diff