Use code-generator to generate clientset/informer/lister (#1492)

To reduce maintenance effort and avoid writing duplicate informer code,
use code-generator to generate clientset/informer/lister code.
This commit is contained in:
Ta-Ching Chen
2020-01-16 15:18:38 +08:00
committed by GitHub
parent b96ca0735d
commit 574fb55fcf
169 changed files with 6325 additions and 2349 deletions
+2 -2
View File
@@ -63,7 +63,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
// run write the resource to a spec file or create a fission CRD with remote fission server.
// It also prints warning/error if necessary.
func (opts *CreateSubCommand) run(input cli.Input) error {
m := opts.env.Metadata
m := opts.env.ObjectMeta
envList, err := opts.Client().V1().Environment().List(m.Namespace)
if err != nil {
@@ -145,7 +145,7 @@ func createEnvironmentFromCmd(input cli.Input) (*fv1.Environment, error) {
Kind: fv1.CRD_NAME_ENVIRONMENT,
APIVersion: fv1.CRD_VERSION,
},
Metadata: metav1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: envName,
Namespace: envNamespace,
},
+1 -1
View File
@@ -52,7 +52,7 @@ func (opts *GetSubCommand) do(input cli.Input) error {
fmt.Fprintf(w, "%v\t%v\n", "NAME", "IMAGE")
fmt.Fprintf(w, "%v\t%v\n",
env.Metadata.Name, env.Spec.Runtime.Image)
env.ObjectMeta.Name, env.Spec.Runtime.Image)
w.Flush()
return nil
+1 -1
View File
@@ -46,7 +46,7 @@ func (opts *ListSubCommand) do(input cli.Input) error {
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n", "NAME", "IMAGE", "BUILDER_IMAGE", "POOLSIZE", "MINCPU", "MAXCPU", "MINMEMORY", "MAXMEMORY", "EXTNET", "GRACETIME")
for _, env := range envs {
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
env.Metadata.Name, env.Spec.Runtime.Image, env.Spec.Builder.Image, env.Spec.Poolsize,
env.ObjectMeta.Name, env.Spec.Runtime.Image, env.Spec.Builder.Image, env.Spec.Poolsize,
env.Spec.Resources.Requests.Cpu(), env.Spec.Resources.Limits.Cpu(),
env.Spec.Resources.Requests.Memory(), env.Spec.Resources.Limits.Memory(),
env.Spec.AllowAccessToExternalNetwork, env.Spec.TerminationGracePeriod)
+1 -1
View File
@@ -71,7 +71,7 @@ func (opts *UpdateSubCommand) run(input cli.Input) error {
return errors.Wrap(err, "error updating environment")
}
fmt.Printf("environment '%v' updated\n", opts.env.Metadata.Name)
fmt.Printf("environment '%v' updated\n", opts.env.ObjectMeta.Name)
return nil
}