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
+4 -4
View File
@@ -110,7 +110,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
}
exists, err := fr.ExistsInSpecs(fv1.Function{
Metadata: metav1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: fnName,
Namespace: fnNamespace,
},
@@ -125,7 +125,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
}
opts.trigger = &fv1.MessageQueueTrigger{
Metadata: metav1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Name: mqtName,
Namespace: fnNamespace,
},
@@ -149,7 +149,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
func (opts *CreateSubCommand) run(input cli.Input) error {
// if we're writing a spec, don't call the API
if input.Bool(flagkey.SpecSave) {
specFile := fmt.Sprintf("mqtrigger-%v.yaml", opts.trigger.Metadata.Name)
specFile := fmt.Sprintf("mqtrigger-%v.yaml", opts.trigger.ObjectMeta.Name)
err := spec.SpecSave(*opts.trigger, specFile)
if err != nil {
return errors.Wrap(err, "error creating message queue trigger spec")
@@ -162,7 +162,7 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
return errors.Wrap(err, "create message queue trigger")
}
fmt.Printf("trigger '%s' created\n", opts.trigger.Metadata.Name)
fmt.Printf("trigger '%s' created\n", opts.trigger.ObjectMeta.Name)
return nil
}
+1 -1
View File
@@ -62,7 +62,7 @@ func (opts *ListSubCommand) run(input cli.Input) error {
"NAME", "FUNCTION_NAME", "MESSAGE_QUEUE_TYPE", "TOPIC", "RESPONSE_TOPIC", "ERROR_TOPIC", "MAX_RETRIES", "PUB_MSG_CONTENT_TYPE")
for _, mqt := range mqts {
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
mqt.Metadata.Name, mqt.Spec.FunctionReference.Name, mqt.Spec.MessageQueueType, mqt.Spec.Topic, mqt.Spec.ResponseTopic, mqt.Spec.ErrorTopic, mqt.Spec.MaxRetries, mqt.Spec.ContentType)
mqt.ObjectMeta.Name, mqt.Spec.FunctionReference.Name, mqt.Spec.MessageQueueType, mqt.Spec.Topic, mqt.Spec.ResponseTopic, mqt.Spec.ErrorTopic, mqt.Spec.MaxRetries, mqt.Spec.ContentType)
}
w.Flush()
+1 -1
View File
@@ -108,6 +108,6 @@ func (opts *UpdateSubCommand) run(input cli.Input) error {
return errors.Wrap(err, "error updating message queue trigger")
}
fmt.Printf("message queue trigger '%v' updated\n", opts.trigger.Metadata.Name)
fmt.Printf("message queue trigger '%v' updated\n", opts.trigger.ObjectMeta.Name)
return nil
}