mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 06:15:45 +00:00
Merge pull request #124371 from soltysh/automated-cherry-pick-of-#123893-#124193-upstream-release-1.30
Automated cherry pick of #123893: kube_codegen: expose applyconfig-openapi-schema flag for #124193: Update applyconfig-gen for pacakges where group and dir
This commit is contained in:
commit
e7178656ad
@ -35,6 +35,7 @@ type applyConfigurationGenerator struct {
|
|||||||
generator.GoGenerator
|
generator.GoGenerator
|
||||||
// outPkgBase is the base package, under which the "internal" and GV-specific subdirs live
|
// outPkgBase is the base package, under which the "internal" and GV-specific subdirs live
|
||||||
outPkgBase string // must be a Go import-path
|
outPkgBase string // must be a Go import-path
|
||||||
|
localPkg string
|
||||||
groupVersion clientgentypes.GroupVersion
|
groupVersion clientgentypes.GroupVersion
|
||||||
applyConfig applyConfig
|
applyConfig applyConfig
|
||||||
imports namer.ImportTracker
|
imports namer.ImportTracker
|
||||||
@ -49,9 +50,8 @@ func (g *applyConfigurationGenerator) Filter(_ *generator.Context, t *types.Type
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *applyConfigurationGenerator) Namers(*generator.Context) namer.NameSystems {
|
func (g *applyConfigurationGenerator) Namers(*generator.Context) namer.NameSystems {
|
||||||
localPkg := path.Join(g.outPkgBase, g.groupVersion.Group.PackageName(), g.groupVersion.Version.PackageName())
|
|
||||||
return namer.NameSystems{
|
return namer.NameSystems{
|
||||||
"raw": namer.NewRawNamer(localPkg, g.imports),
|
"raw": namer.NewRawNamer(g.localPkg, g.imports),
|
||||||
"singularKind": namer.NewPublicNamer(0),
|
"singularKind": namer.NewPublicNamer(0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,7 +336,7 @@ func (b *$.ApplyConfig.ApplyConfiguration|public$) ensure$.MemberType.Elem|publi
|
|||||||
|
|
||||||
var clientgenTypeConstructorNamespaced = `
|
var clientgenTypeConstructorNamespaced = `
|
||||||
// $.ApplyConfig.Type|public$ constructs an declarative configuration of the $.ApplyConfig.Type|public$ type for use with
|
// $.ApplyConfig.Type|public$ constructs an declarative configuration of the $.ApplyConfig.Type|public$ type for use with
|
||||||
// apply.
|
// apply.
|
||||||
func $.ApplyConfig.Type|public$(name, namespace string) *$.ApplyConfig.ApplyConfiguration|public$ {
|
func $.ApplyConfig.Type|public$(name, namespace string) *$.ApplyConfig.ApplyConfiguration|public$ {
|
||||||
b := &$.ApplyConfig.ApplyConfiguration|public${}
|
b := &$.ApplyConfig.ApplyConfiguration|public${}
|
||||||
b.WithName(name)
|
b.WithName(name)
|
||||||
|
@ -185,6 +185,7 @@ func targetForApplyConfigurationsPackage(outputDirBase, outputPkgBase, pkgSubdir
|
|||||||
OutputFilename: strings.ToLower(toGenerate.Type.Name.Name) + ".go",
|
OutputFilename: strings.ToLower(toGenerate.Type.Name.Name) + ".go",
|
||||||
},
|
},
|
||||||
outPkgBase: outputPkgBase,
|
outPkgBase: outputPkgBase,
|
||||||
|
localPkg: outputPkg,
|
||||||
groupVersion: gv,
|
groupVersion: gv,
|
||||||
applyConfig: toGenerate,
|
applyConfig: toGenerate,
|
||||||
imports: generator.NewImportTracker(),
|
imports: generator.NewImportTracker(),
|
||||||
|
@ -443,6 +443,7 @@ function kube::codegen::gen_client() {
|
|||||||
local applyconfig="false"
|
local applyconfig="false"
|
||||||
local applyconfig_subdir="applyconfiguration"
|
local applyconfig_subdir="applyconfiguration"
|
||||||
local applyconfig_external=""
|
local applyconfig_external=""
|
||||||
|
local applyconfig_openapi_schema=""
|
||||||
local watchable="false"
|
local watchable="false"
|
||||||
local listers_subdir="listers"
|
local listers_subdir="listers"
|
||||||
local informers_subdir="informers"
|
local informers_subdir="informers"
|
||||||
@ -488,6 +489,10 @@ function kube::codegen::gen_client() {
|
|||||||
applyconfig_external="$2"
|
applyconfig_external="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
"--applyconfig-openapi-schema")
|
||||||
|
applyconfig_openapi_schema="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
"--with-watch")
|
"--with-watch")
|
||||||
watchable="true"
|
watchable="true"
|
||||||
shift
|
shift
|
||||||
@ -594,6 +599,7 @@ function kube::codegen::gen_client() {
|
|||||||
--output-dir "${out_dir}/${applyconfig_subdir}" \
|
--output-dir "${out_dir}/${applyconfig_subdir}" \
|
||||||
--output-pkg "${applyconfig_pkg}" \
|
--output-pkg "${applyconfig_pkg}" \
|
||||||
--external-applyconfigurations "${applyconfig_external}" \
|
--external-applyconfigurations "${applyconfig_external}" \
|
||||||
|
--openapi-schema "${applyconfig_openapi_schema}" \
|
||||||
"${input_pkgs[@]}"
|
"${input_pkgs[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user