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
@@ -100,7 +100,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
// finally create canaryCfg in the same namespace as the functions referenced
opts.canary = &fv1.CanaryConfig{
Metadata: metav1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: fnNs,
},
@@ -127,6 +127,6 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
return errors.Wrap(err, "error creating canary config")
}
fmt.Printf("canary config '%v' created\n", opts.canary.Metadata.Name)
fmt.Printf("canary config '%v' created\n", opts.canary.ObjectMeta.Name)
return nil
}
+1 -1
View File
@@ -49,7 +49,7 @@ func (opts *GetSubCommand) run(input cli.Input) error {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n", "NAME", "TRIGGER", "FUNCTION-N", "FUNCTION-N-1", "WEIGHT-INCREMENT", "INTERVAL", "FAILURE-THRESHOLD", "FAILURE-TYPE", "STATUS")
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
canaryCfg.Metadata.Name, canaryCfg.Spec.Trigger, canaryCfg.Spec.NewFunction, canaryCfg.Spec.OldFunction, canaryCfg.Spec.WeightIncrement, canaryCfg.Spec.WeightIncrementDuration,
canaryCfg.ObjectMeta.Name, canaryCfg.Spec.Trigger, canaryCfg.Spec.NewFunction, canaryCfg.Spec.OldFunction, canaryCfg.Spec.WeightIncrement, canaryCfg.Spec.WeightIncrementDuration,
canaryCfg.Spec.FailureThreshold, canaryCfg.Spec.FailureType, canaryCfg.Status.Status)
w.Flush()
+1 -1
View File
@@ -60,7 +60,7 @@ func (opts *ListSubCommand) run(input cli.Input) error {
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n", "NAME", "TRIGGER", "FUNCTION-N", "FUNCTION-N-1", "WEIGHT-INCREMENT", "INTERVAL", "FAILURE-THRESHOLD", "FAILURE-TYPE", "STATUS")
for _, canaryCfg := range canaryCfgs {
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
canaryCfg.Metadata.Name, canaryCfg.Spec.Trigger, canaryCfg.Spec.NewFunction, canaryCfg.Spec.OldFunction, canaryCfg.Spec.WeightIncrement, canaryCfg.Spec.WeightIncrementDuration,
canaryCfg.ObjectMeta.Name, canaryCfg.Spec.Trigger, canaryCfg.Spec.NewFunction, canaryCfg.Spec.OldFunction, canaryCfg.Spec.WeightIncrement, canaryCfg.Spec.WeightIncrementDuration,
canaryCfg.Spec.FailureThreshold, canaryCfg.Spec.FailureType, canaryCfg.Status.Status)
}
+1 -1
View File
@@ -96,6 +96,6 @@ func (opts *UpdateSubCommand) run(input cli.Input) error {
if err != nil {
return errors.Wrap(err, "error updating canary config")
}
fmt.Printf("canary config '%v' updated\n", opts.canary.Metadata.Name)
fmt.Printf("canary config '%v' updated\n", opts.canary.ObjectMeta.Name)
return nil
}