Skip to content

Commit fa0e8d6

Browse files
authored
chore: update static scheme (argoproj#588)
Signed-off-by: Michael Crenshaw <[email protected]>
1 parent f38075d commit fa0e8d6

File tree

3 files changed

+2065
-888
lines changed

3 files changed

+2065
-888
lines changed

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ require (
100100
)
101101

102102
replace (
103+
// After bumping these versions, run hack/update_static_schema.sh in case the schema has changed.
103104
k8s.io/api => k8s.io/api v0.29.6
104105
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.29.6
105106
k8s.io/apimachinery => k8s.io/apimachinery v0.29.6

hack/update_static_schema.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
set -euox pipefail
4+
5+
# Get the k8s library version from go.mod, stripping the trailing newline
6+
k8s_lib_version=$(grep "k8s.io/client-go" go.mod | awk '{print $2}' | head -n 1 | tr -d '\n')
7+
8+
# Download the parser file from the k8s library
9+
curl -sL "https://raw.githubusercontent.com/kubernetes/client-go/$k8s_lib_version/applyconfigurations/internal/internal.go" -o pkg/utils/kube/scheme/parser.go
10+
11+
# Add a line to the beginning of the file saying that this is the script that generated it.
12+
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
13+
14+
# Replace "package internal" with "package scheme" in the parser file
15+
sed -i '' 's/package internal/package scheme/' pkg/utils/kube/scheme/parser.go
16+
17+
# Replace "func Parser" with "func StaticParser"
18+
sed -i '' 's/func Parser/func StaticParser/' pkg/utils/kube/scheme/parser.go

0 commit comments

Comments
 (0)