Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include client-gen command line arguments in the output files #22928

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/libs/go2idl/client-gen/args/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ type Args struct {
ClientsetOnly bool
// FakeClient determines if client-gen generates the fake clients.
FakeClient bool
// CmdArgs is the command line arguments supplied when the client-gen is called.
CmdArgs string
}
6 changes: 6 additions & 0 deletions cmd/libs/go2idl/client-gen/generators/client_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
package generators

import (
"fmt"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -153,6 +154,11 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
glog.Fatalf("cannot convert arguments.CustomArgs to clientgenargs.Args")
}

if len(customArgs.CmdArgs) != 0 {
boilerplate = append(boilerplate, []byte(fmt.Sprintf("\n// This file is generated by client-gen with arguments: %s\n\n", customArgs.CmdArgs))...)
} else {
boilerplate = append(boilerplate, []byte(fmt.Sprintf("\n// This file is generated by client-gen with the default arguments.\n\n"))...)
}
gvToTypes := map[unversioned.GroupVersion][]*types.Type{}
for gv, inputDir := range customArgs.GroupVersionToInputPath {
p := context.Universe.Package(inputDir)
Expand Down
10 changes: 10 additions & 0 deletions cmd/libs/go2idl/client-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ func parseInputVersions() (paths []string, groupVersions []unversioned.GroupVers
func main() {
arguments := args.Default()
flag.Parse()
var cmdArgs string
flag.VisitAll(func(f *flag.Flag) {
if !f.Changed || f.Name == "verify-only" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the defaults change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the hack/verify-codegen.sh will report the file needs to be regenerated.

return
}
cmdArgs = cmdArgs + fmt.Sprintf("--%s=%s ", f.Name, f.Value)
})

dependencies := []string{
"k8s.io/kubernetes/pkg/fields",
"k8s.io/kubernetes/pkg/labels",
Expand All @@ -97,6 +105,7 @@ func main() {
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/",
false,
false,
cmdArgs,
}
} else {
inputPath, groupVersions, gvToPath, err := parseInputVersions()
Expand All @@ -119,6 +128,7 @@ func main() {
*clientsetPath,
*clientsetOnly,
*fakeClient,
cmdArgs,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with arguments: --test=true

package test_internalclientset

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with arguments: --test=true

// Package unversioned has the automatically generated clients for unversioned resources.
package unversioned
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with arguments: --test=true

package unversioned

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with arguments: --test=true

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/clientset_generated/internalclientset/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package internalclientset

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/core_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

// Package unversioned has the automatically generated clients for unversioned resources.
package unversioned
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/fake/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

// Package fake has the automatically generated clients.
package fake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/fake/fake_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/fake/fake_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package fake

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/limitrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/typed/generated/core/unversioned/podtemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is generated by client-gen with the default arguments.

package unversioned

import (
Expand Down