Skip to content

Commit f910fff

Browse files
authored
fix generate.sh (#54)
- fixed a regression in `generate.sh` where it was not transferring the generated sources correctly to the output location - added a special case handling for karpenter crds to generate the api/model maps
1 parent 444c601 commit f910fff

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

gen/generate.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ rm -rf ${APIIMPLDIR}/api_bak
5151
mv ${APIIMPLDIR}/api ${APIIMPLDIR}/api_bak
5252
mkdir ${APIIMPLDIR}/api
5353
mv ${TEMPGENDIR}/src/* ${APIIMPLDIR}/api/
54+
mv ${TEMPGENDIR}/*.jl ${APIIMPLDIR}/api/
5455
rm ${TEMPGENDIR}/LICENSE
5556
rm -r ${TEMPGENDIR}
5657

gen/gentypealiases.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ function kuberapitypes(file::String, aliases_set::KuberTypeAliasesSet)
8282
end
8383

8484
function find_matching_api(sorted_apis::Vector{String}, model_name::String)
85+
if startswith(model_name, "ShKarpenter")
86+
karpenter_apis = map(x->startswith(x, "KarpenterSh") ? replace(x, "KarpenterSh"=>"ShKarpenter") : x, sorted_apis)
87+
api_idx = findfirst(x->startswith(model_name, x), karpenter_apis)
88+
(api_idx !== nothing) && (return api_idx)
89+
end
90+
8591
rbac_apis = map(x->startswith(x, "RbacAuthorization") ? replace(x, "Authorization"=>"") : x, sorted_apis)
8692
flowcontrol_apis = map(x->startswith(x, "FlowcontrolApiserver") ? replace(x, "Apiserver"=>"") : x, sorted_apis)
8793

@@ -95,6 +101,12 @@ function find_matching_api(sorted_apis::Vector{String}, model_name::String)
95101
end
96102

97103
function get_common_name(sorted_apis::Vector{String}, model_name::String)
104+
if startswith(model_name, "ShKarpenter")
105+
karpenter_apis = map(x->startswith(x, "KarpenterSh") ? replace(x, "KarpenterSh"=>"ShKarpenter") : x, sorted_apis)
106+
api_idx = findfirst(x->startswith(model_name, x), karpenter_apis)
107+
(api_idx !== nothing) && (return replace(model_name, (karpenter_apis[api_idx])=>""))
108+
end
109+
98110
rbac_apis = map(x->startswith(x, "RbacAuthorization") ? replace(x, "Authorization"=>"") : x, sorted_apis)
99111
flowcontrol_apis = map(x->startswith(x, "FlowcontrolApiserver") ? replace(x, "Apiserver"=>"") : x, sorted_apis)
100112

0 commit comments

Comments
 (0)