├── .github ├── CODEOWNERS └── workflows │ └── go.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── apis ├── common │ ├── utils.go │ └── utils_test.go ├── core.oam.dev │ └── v1alpha1 │ │ ├── applicationconfiguration_types.go │ │ ├── applicationconfiguration_types_test.go │ │ ├── common_types.go │ │ ├── common_types_test.go │ │ ├── component_schematic_types.go │ │ ├── component_schematic_types_test.go │ │ ├── condition.go │ │ ├── register.go │ │ ├── scope_types.go │ │ ├── status.go │ │ ├── status_test.go │ │ ├── suite_test.go │ │ ├── trait_types.go │ │ ├── trait_types_test.go │ │ ├── workloadtype_types.go │ │ ├── workloadtype_types_test.go │ │ └── zz_generated.deepcopy.go ├── flags │ └── flags.go └── handlers │ └── status.go ├── code-gen-vendor └── k8s.io │ └── code-generator │ ├── .github │ └── PULL_REQUEST_TEMPLATE.md │ ├── CONTRIBUTING.md │ ├── Godeps │ ├── Godeps.json │ ├── OWNERS │ └── Readme │ ├── LICENSE │ ├── OWNERS │ ├── README.md │ ├── SECURITY_CONTACTS │ ├── _examples │ ├── HyphenGroup │ │ ├── apis │ │ │ └── example │ │ │ │ └── v1 │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── types.go │ │ │ │ ├── zz_generated.deepcopy.go │ │ │ │ └── zz_generated.defaults.go │ │ ├── clientset │ │ │ └── versioned │ │ │ │ ├── clientset.go │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ ├── clientset_generated.go │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ ├── scheme │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ └── typed │ │ │ │ └── example │ │ │ │ └── v1 │ │ │ │ ├── clustertesttype.go │ │ │ │ ├── doc.go │ │ │ │ ├── example_client.go │ │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_clustertesttype.go │ │ │ │ ├── fake_example_client.go │ │ │ │ └── fake_testtype.go │ │ │ │ ├── generated_expansion.go │ │ │ │ └── testtype.go │ │ ├── informers │ │ │ └── externalversions │ │ │ │ ├── example │ │ │ │ ├── interface.go │ │ │ │ └── v1 │ │ │ │ │ ├── clustertesttype.go │ │ │ │ │ ├── interface.go │ │ │ │ │ └── testtype.go │ │ │ │ ├── factory.go │ │ │ │ ├── generic.go │ │ │ │ └── internalinterfaces │ │ │ │ └── factory_interfaces.go │ │ └── listers │ │ │ └── example │ │ │ └── v1 │ │ │ ├── clustertesttype.go │ │ │ ├── expansion_generated.go │ │ │ └── testtype.go │ ├── MixedCase │ │ ├── apis │ │ │ └── example │ │ │ │ └── v1 │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── types.go │ │ │ │ ├── zz_generated.deepcopy.go │ │ │ │ └── zz_generated.defaults.go │ │ ├── clientset │ │ │ └── versioned │ │ │ │ ├── clientset.go │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ ├── clientset_generated.go │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ ├── scheme │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ └── typed │ │ │ │ └── example │ │ │ │ └── v1 │ │ │ │ ├── clustertesttype.go │ │ │ │ ├── doc.go │ │ │ │ ├── example_client.go │ │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_clustertesttype.go │ │ │ │ ├── fake_example_client.go │ │ │ │ └── fake_testtype.go │ │ │ │ ├── generated_expansion.go │ │ │ │ └── testtype.go │ │ ├── informers │ │ │ └── externalversions │ │ │ │ ├── example │ │ │ │ ├── interface.go │ │ │ │ └── v1 │ │ │ │ │ ├── clustertesttype.go │ │ │ │ │ ├── interface.go │ │ │ │ │ └── testtype.go │ │ │ │ ├── factory.go │ │ │ │ ├── generic.go │ │ │ │ └── internalinterfaces │ │ │ │ └── factory_interfaces.go │ │ └── listers │ │ │ └── example │ │ │ └── v1 │ │ │ ├── clustertesttype.go │ │ │ ├── expansion_generated.go │ │ │ └── testtype.go │ ├── apiserver │ │ ├── apis │ │ │ ├── example │ │ │ │ ├── doc.go │ │ │ │ ├── install │ │ │ │ │ └── install.go │ │ │ │ ├── register.go │ │ │ │ ├── types.go │ │ │ │ ├── v1 │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── register.go │ │ │ │ │ ├── types.go │ │ │ │ │ ├── zz_generated.conversion.go │ │ │ │ │ ├── zz_generated.deepcopy.go │ │ │ │ │ └── zz_generated.defaults.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ ├── example2 │ │ │ │ ├── doc.go │ │ │ │ ├── install │ │ │ │ │ └── install.go │ │ │ │ ├── register.go │ │ │ │ ├── types.go │ │ │ │ ├── v1 │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── register.go │ │ │ │ │ ├── types.go │ │ │ │ │ ├── zz_generated.conversion.go │ │ │ │ │ ├── zz_generated.deepcopy.go │ │ │ │ │ └── zz_generated.defaults.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ └── example3.io │ │ │ │ ├── doc.go │ │ │ │ ├── install │ │ │ │ └── install.go │ │ │ │ ├── register.go │ │ │ │ ├── types.go │ │ │ │ ├── v1 │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── types.go │ │ │ │ ├── zz_generated.conversion.go │ │ │ │ ├── zz_generated.deepcopy.go │ │ │ │ └── zz_generated.defaults.go │ │ │ │ └── zz_generated.deepcopy.go │ │ ├── clientset │ │ │ ├── internalversion │ │ │ │ ├── clientset.go │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ │ ├── clientset_generated.go │ │ │ │ │ ├── doc.go │ │ │ │ │ └── register.go │ │ │ │ ├── scheme │ │ │ │ │ ├── doc.go │ │ │ │ │ └── register.go │ │ │ │ └── typed │ │ │ │ │ ├── example │ │ │ │ │ └── internalversion │ │ │ │ │ │ ├── doc.go │ │ │ │ │ │ ├── example_client.go │ │ │ │ │ │ ├── fake │ │ │ │ │ │ ├── doc.go │ │ │ │ │ │ ├── fake_example_client.go │ │ │ │ │ │ └── fake_testtype.go │ │ │ │ │ │ ├── generated_expansion.go │ │ │ │ │ │ └── testtype.go │ │ │ │ │ ├── example2 │ │ │ │ │ └── internalversion │ │ │ │ │ │ ├── doc.go │ │ │ │ │ │ ├── example2_client.go │ │ │ │ │ │ ├── fake │ │ │ │ │ │ ├── doc.go │ │ │ │ │ │ ├── fake_example2_client.go │ │ │ │ │ │ └── fake_testtype.go │ │ │ │ │ │ ├── generated_expansion.go │ │ │ │ │ │ └── testtype.go │ │ │ │ │ └── example3.io │ │ │ │ │ └── internalversion │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── example3.io_client.go │ │ │ │ │ ├── fake │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── fake_example3.io_client.go │ │ │ │ │ └── fake_testtype.go │ │ │ │ │ ├── generated_expansion.go │ │ │ │ │ └── testtype.go │ │ │ └── versioned │ │ │ │ ├── clientset.go │ │ │ │ ├── doc.go │ │ │ │ ├── fake │ │ │ │ ├── clientset_generated.go │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ ├── scheme │ │ │ │ ├── doc.go │ │ │ │ └── register.go │ │ │ │ └── typed │ │ │ │ ├── example │ │ │ │ └── v1 │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── example_client.go │ │ │ │ │ ├── fake │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── fake_example_client.go │ │ │ │ │ └── fake_testtype.go │ │ │ │ │ ├── generated_expansion.go │ │ │ │ │ └── testtype.go │ │ │ │ ├── example2 │ │ │ │ └── v1 │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── example2_client.go │ │ │ │ │ ├── fake │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── fake_example2_client.go │ │ │ │ │ └── fake_testtype.go │ │ │ │ │ ├── generated_expansion.go │ │ │ │ │ └── testtype.go │ │ │ │ └── example3.io │ │ │ │ └── v1 │ │ │ │ ├── doc.go │ │ │ │ ├── example3.io_client.go │ │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_example3.io_client.go │ │ │ │ └── fake_testtype.go │ │ │ │ ├── generated_expansion.go │ │ │ │ └── testtype.go │ │ ├── informers │ │ │ ├── externalversions │ │ │ │ ├── example │ │ │ │ │ ├── interface.go │ │ │ │ │ └── v1 │ │ │ │ │ │ ├── interface.go │ │ │ │ │ │ └── testtype.go │ │ │ │ ├── example2 │ │ │ │ │ ├── interface.go │ │ │ │ │ └── v1 │ │ │ │ │ │ ├── interface.go │ │ │ │ │ │ └── testtype.go │ │ │ │ ├── example3.io │ │ │ │ │ ├── interface.go │ │ │ │ │ └── v1 │ │ │ │ │ │ ├── interface.go │ │ │ │ │ │ └── testtype.go │ │ │ │ ├── factory.go │ │ │ │ ├── generic.go │ │ │ │ └── internalinterfaces │ │ │ │ │ └── factory_interfaces.go │ │ │ └── internalversion │ │ │ │ ├── example │ │ │ │ ├── interface.go │ │ │ │ └── internalversion │ │ │ │ │ ├── interface.go │ │ │ │ │ └── testtype.go │ │ │ │ ├── example2 │ │ │ │ ├── interface.go │ │ │ │ └── internalversion │ │ │ │ │ ├── interface.go │ │ │ │ │ └── testtype.go │ │ │ │ ├── example3.io │ │ │ │ ├── interface.go │ │ │ │ └── internalversion │ │ │ │ │ ├── interface.go │ │ │ │ │ └── testtype.go │ │ │ │ ├── factory.go │ │ │ │ ├── generic.go │ │ │ │ └── internalinterfaces │ │ │ │ └── factory_interfaces.go │ │ ├── listers │ │ │ ├── example │ │ │ │ ├── internalversion │ │ │ │ │ ├── expansion_generated.go │ │ │ │ │ └── testtype.go │ │ │ │ └── v1 │ │ │ │ │ ├── expansion_generated.go │ │ │ │ │ └── testtype.go │ │ │ ├── example2 │ │ │ │ ├── internalversion │ │ │ │ │ ├── expansion_generated.go │ │ │ │ │ └── testtype.go │ │ │ │ └── v1 │ │ │ │ │ ├── expansion_generated.go │ │ │ │ │ └── testtype.go │ │ │ └── example3.io │ │ │ │ ├── internalversion │ │ │ │ ├── expansion_generated.go │ │ │ │ └── testtype.go │ │ │ │ └── v1 │ │ │ │ ├── expansion_generated.go │ │ │ │ └── testtype.go │ │ └── openapi │ │ │ └── zz_generated.openapi.go │ └── crd │ │ ├── apis │ │ ├── example │ │ │ └── v1 │ │ │ │ ├── doc.go │ │ │ │ ├── register.go │ │ │ │ ├── types.go │ │ │ │ ├── zz_generated.deepcopy.go │ │ │ │ └── zz_generated.defaults.go │ │ └── example2 │ │ │ └── v1 │ │ │ ├── doc.go │ │ │ ├── register.go │ │ │ ├── types.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ └── zz_generated.defaults.go │ │ ├── clientset │ │ └── versioned │ │ │ ├── clientset.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── clientset_generated.go │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ ├── scheme │ │ │ ├── doc.go │ │ │ └── register.go │ │ │ └── typed │ │ │ ├── example │ │ │ └── v1 │ │ │ │ ├── clustertesttype.go │ │ │ │ ├── doc.go │ │ │ │ ├── example_client.go │ │ │ │ ├── fake │ │ │ │ ├── doc.go │ │ │ │ ├── fake_clustertesttype.go │ │ │ │ ├── fake_example_client.go │ │ │ │ └── fake_testtype.go │ │ │ │ ├── generated_expansion.go │ │ │ │ └── testtype.go │ │ │ └── example2 │ │ │ └── v1 │ │ │ ├── doc.go │ │ │ ├── example2_client.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_example2_client.go │ │ │ └── fake_testtype.go │ │ │ ├── generated_expansion.go │ │ │ └── testtype.go │ │ ├── informers │ │ └── externalversions │ │ │ ├── example │ │ │ ├── interface.go │ │ │ └── v1 │ │ │ │ ├── clustertesttype.go │ │ │ │ ├── interface.go │ │ │ │ └── testtype.go │ │ │ ├── example2 │ │ │ ├── interface.go │ │ │ └── v1 │ │ │ │ ├── interface.go │ │ │ │ └── testtype.go │ │ │ ├── factory.go │ │ │ ├── generic.go │ │ │ └── internalinterfaces │ │ │ └── factory_interfaces.go │ │ └── listers │ │ ├── example │ │ └── v1 │ │ │ ├── clustertesttype.go │ │ │ ├── expansion_generated.go │ │ │ └── testtype.go │ │ └── example2 │ │ └── v1 │ │ ├── expansion_generated.go │ │ └── testtype.go │ ├── cmd │ ├── client-gen │ │ ├── OWNERS │ │ ├── README.md │ │ ├── args │ │ │ ├── args.go │ │ │ ├── gvpackages.go │ │ │ ├── gvpackages_test.go │ │ │ └── gvtype.go │ │ ├── generators │ │ │ ├── client_generator.go │ │ │ ├── fake │ │ │ │ ├── fake_client_generator.go │ │ │ │ ├── generator_fake_for_clientset.go │ │ │ │ ├── generator_fake_for_group.go │ │ │ │ └── generator_fake_for_type.go │ │ │ ├── generator_for_clientset.go │ │ │ ├── generator_for_expansion.go │ │ │ ├── generator_for_group.go │ │ │ ├── generator_for_type.go │ │ │ ├── scheme │ │ │ │ └── generator_for_scheme.go │ │ │ └── util │ │ │ │ ├── tags.go │ │ │ │ └── tags_test.go │ │ ├── main.go │ │ ├── path │ │ │ └── path.go │ │ └── types │ │ │ ├── helpers.go │ │ │ ├── helpers_test.go │ │ │ └── types.go │ ├── conversion-gen │ │ ├── args │ │ │ └── args.go │ │ ├── generators │ │ │ └── conversion.go │ │ └── main.go │ ├── deepcopy-gen │ │ ├── args │ │ │ └── args.go │ │ └── main.go │ ├── defaulter-gen │ │ ├── args │ │ │ └── args.go │ │ └── main.go │ ├── go-to-protobuf │ │ ├── .gitignore │ │ ├── OWNERS │ │ ├── main.go │ │ ├── protobuf │ │ │ ├── cmd.go │ │ │ ├── generator.go │ │ │ ├── import_tracker.go │ │ │ ├── namer.go │ │ │ ├── namer_test.go │ │ │ ├── package.go │ │ │ ├── parser.go │ │ │ └── tags.go │ │ └── protoc-gen-gogo │ │ │ └── main.go │ ├── import-boss │ │ ├── .gitignore │ │ └── main.go │ ├── informer-gen │ │ ├── args │ │ │ └── args.go │ │ ├── generators │ │ │ ├── factory.go │ │ │ ├── factoryinterface.go │ │ │ ├── generic.go │ │ │ ├── groupinterface.go │ │ │ ├── informer.go │ │ │ ├── packages.go │ │ │ ├── types.go │ │ │ └── versioninterface.go │ │ └── main.go │ ├── lister-gen │ │ ├── .import-restrictions │ │ ├── args │ │ │ └── args.go │ │ ├── generators │ │ │ ├── expansion.go │ │ │ └── lister.go │ │ └── main.go │ ├── openapi-gen │ │ └── main.go │ ├── register-gen │ │ ├── args │ │ │ └── args.go │ │ ├── generators │ │ │ ├── packages.go │ │ │ └── register_external.go │ │ └── main.go │ └── set-gen │ │ ├── .gitignore │ │ └── main.go │ ├── code-of-conduct.md │ ├── generate-groups.sh │ ├── generate-internal-groups.sh │ ├── go.mod │ ├── go.sum │ ├── hack │ ├── boilerplate.go.txt │ ├── update-codegen.sh │ └── verify-codegen.sh │ ├── pkg │ ├── namer │ │ └── tag-override.go │ └── util │ │ ├── build.go │ │ └── plural_exceptions.go │ ├── third_party │ └── forked │ │ └── golang │ │ └── reflect │ │ └── type.go │ └── tools.go ├── config ├── crd │ └── bases │ │ ├── core.oam.dev_applicationconfigurations.yaml │ │ ├── core.oam.dev_applicationscopes.yaml │ │ ├── core.oam.dev_componentschematics.yaml │ │ ├── core.oam.dev_traits.yaml │ │ └── core.oam.dev_workloadtypes.yaml └── webhook │ └── manifests.yaml ├── doc ├── concepts.md └── img │ └── handler-diagram.png ├── examples ├── app.yaml ├── componentschematics.yaml └── traits.yaml ├── go.mod ├── go.sum ├── hack ├── boilerplate.go.txt └── update-client-gen.sh ├── oambuilder ├── .gitignore ├── Makefile ├── README.md ├── api │ └── v1alpha1 │ │ ├── applicationconfiguration_types.go │ │ ├── applicationconfiguration_types_test.go │ │ ├── common_types.go │ │ ├── common_types_test.go │ │ ├── component_schematic_types.go │ │ ├── component_schematic_types_test.go │ │ ├── condition.go │ │ ├── groupversion_info.go │ │ ├── ii_test.go │ │ ├── interfacetype.go │ │ ├── scope_types.go │ │ ├── status.go │ │ ├── suite_test.go │ │ ├── trait_types.go │ │ ├── trait_types_test.go │ │ ├── workloadtype_types.go │ │ ├── workloadtype_types_test.go │ │ └── zz_generated.deepcopy.go ├── cmd │ ├── context.go │ ├── exchange │ │ └── cmd.go │ ├── trait │ │ └── cmd.go │ └── workload │ │ └── cmd.go ├── go.mod ├── go.sum ├── main.go └── pkg │ ├── generator │ ├── generator.go │ └── kubebuilder │ │ ├── builder.go │ │ ├── crgen │ │ ├── cmd.go │ │ ├── gen.go │ │ └── parser.go │ │ ├── plugin.go │ │ └── template.go │ ├── runtime │ ├── exchanger.go │ ├── scheme.go │ └── types.go │ ├── templates │ ├── controller.go │ └── makefile.go │ ├── types │ ├── errors.go │ ├── project │ │ └── oam.go │ ├── trait │ │ └── specs.go │ ├── types.go │ ├── variables.go │ └── workload │ │ └── specs.go │ └── util │ └── files.go └── pkg ├── client ├── clientset │ └── versioned │ │ ├── clientset.go │ │ ├── doc.go │ │ ├── fake │ │ ├── clientset_generated.go │ │ ├── doc.go │ │ └── register.go │ │ ├── scheme │ │ ├── doc.go │ │ └── register.go │ │ └── typed │ │ └── core.oam.dev │ │ └── v1alpha1 │ │ ├── applicationconfiguration.go │ │ ├── applicationscope.go │ │ ├── componentschematic.go │ │ ├── core.oam.dev_client.go │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_applicationconfiguration.go │ │ ├── fake_applicationscope.go │ │ ├── fake_componentschematic.go │ │ ├── fake_core.oam.dev_client.go │ │ └── fake_trait.go │ │ ├── generated_expansion.go │ │ └── trait.go ├── informers │ └── externalversions │ │ ├── core.oam.dev │ │ ├── interface.go │ │ └── v1alpha1 │ │ │ ├── applicationconfiguration.go │ │ │ ├── applicationscope.go │ │ │ ├── componentschematic.go │ │ │ ├── interface.go │ │ │ └── trait.go │ │ ├── factory.go │ │ ├── generic.go │ │ └── internalinterfaces │ │ └── factory_interfaces.go └── listers │ └── core.oam.dev │ └── v1alpha1 │ ├── applicationconfiguration.go │ ├── applicationscope.go │ ├── componentschematic.go │ ├── expansion_generated.go │ └── trait.go ├── config └── config.go ├── examples ├── extendworkload │ ├── README.md │ ├── app-new-crd.yaml │ ├── app.yaml │ ├── component.yaml │ ├── main.go │ ├── new-crd.yaml │ └── workloadtype.yaml └── framework │ └── main.go ├── finalizer └── finalizer.go ├── oam ├── context.go ├── controller.go ├── sdk.go └── types.go └── util ├── specequal.go └── specequal_test.go /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @Diddaa @wonderflow @hongchaodeng 2 | /oambuilder/ @athlum @zkcrescent @hongchaodeng 3 | -------------------------------------------------------------------------------- /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | name: Go 2 | 3 | # This workflow will run on master branch and on any pull requests targeting master 4 | on: 5 | push: 6 | branches: 7 | - master 8 | tags: [] 9 | pull_request: 10 | 11 | jobs: 12 | test: 13 | name: TestBuild 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Set up Go 17 | uses: actions/setup-go@v1 18 | with: 19 | go-version: 1.12 20 | 21 | - name: Check out code 22 | uses: actions/checkout@v1 23 | 24 | - name: Run Unit tests. 25 | run: make test 26 | 27 | - name: Build 28 | run: make examples -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | bin/ 8 | 9 | # Test binary, build with `go test -c` 10 | *.test 11 | 12 | # Output of the go coverage tool, specifically when used with LiteIDE 13 | *.out 14 | 15 | # Kubernetes Generated files - skip generated files, except for vendored files 16 | 17 | !vendor/**/zz_generated.* 18 | 19 | # editor and IDE paraphernalia 20 | .idea 21 | *.swp 22 | *.swo 23 | *~ 24 | 25 | vendor/ 26 | .ssh/ 27 | -------------------------------------------------------------------------------- /apis/common/utils.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "encoding/json" 5 | "strings" 6 | 7 | "github.com/oam-dev/oam-go-sdk/apis/core.oam.dev/v1alpha1" 8 | "k8s.io/apimachinery/pkg/runtime" 9 | ) 10 | 11 | func matchPattern(value string) (match bool, key string) { 12 | value = strings.TrimSpace(value) 13 | if strings.HasPrefix(value, "[fromParam(") && strings.HasSuffix(value, ")]") { 14 | key = strings.TrimSuffix(strings.TrimPrefix(value, "[fromParam("), ")]") 15 | return true, key 16 | } 17 | return false, "" 18 | } 19 | 20 | func getParamValue(params []v1alpha1.ParameterValue, key string) string { 21 | for _, v := range params { 22 | if v.Name == key { 23 | return v.Value 24 | } 25 | } 26 | return "" 27 | } 28 | 29 | func ExtractFromMap(params []v1alpha1.ParameterValue, values map[string]interface{}) map[string]interface{} { 30 | for k, v := range values { 31 | switch subVal := v.(type) { 32 | case string: 33 | match, key := matchPattern(subVal) 34 | if match { 35 | values[k] = getParamValue(params, key) 36 | } 37 | case map[string]interface{}: 38 | values[k] = ExtractFromMap(params, subVal) 39 | } 40 | } 41 | return values 42 | } 43 | 44 | // ExtractParams will extract param from Pattern "${parameter_key}" 45 | func ExtractParams(params []v1alpha1.ParameterValue, raw runtime.RawExtension) (map[string]interface{}, error) { 46 | values := make(map[string]interface{}) 47 | if err := json.Unmarshal(raw.Raw, &values); err != nil { 48 | return nil, err 49 | } 50 | return ExtractFromMap(params, values), nil 51 | } 52 | -------------------------------------------------------------------------------- /apis/core.oam.dev/v1alpha1/common_types.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | /// A value that is substituted into a parameter. 9 | type ParameterValue struct { 10 | Name string `json:"name,omitempty"` 11 | Value string `json:"value,omitempty"` 12 | From *ParameterFrom `json:"from,omitempty"` 13 | } 14 | 15 | type ParameterFrom struct { 16 | Component string `json:"component,omitempty"` 17 | FieldPath string `json:"fieldPath,omitempty"` 18 | } 19 | 20 | /** 21 | Translate []ParameterValue to struct, the struct always should be empty struct pointer. 22 | e.g: Translate(&RollOutParameter{}, p) 23 | */ 24 | func Translate(v interface{}, p []ParameterValue) error { 25 | props := make(map[string]string) 26 | for _, v := range p { 27 | props[v.Name] = v.Value 28 | } 29 | propsJsonBytes, _ := json.Marshal(props) 30 | // init from json bytes. 31 | return json.Unmarshal(propsJsonBytes, v) 32 | } 33 | 34 | /** 35 | Translate struct to []ParameterValue. 36 | */ 37 | func TranslateReverse(v interface{}) []ParameterValue { 38 | propsJsonBytes, _ := json.Marshal(v) 39 | kvs := make(map[string]string) 40 | if err := json.Unmarshal(propsJsonBytes, &kvs); err != nil { 41 | fmt.Println("reverse translate error", err) 42 | } 43 | 44 | var pvs []ParameterValue 45 | 46 | for k, v := range kvs { 47 | pvs = append(pvs, ParameterValue{Name: k, Value: v}) 48 | } 49 | return pvs 50 | } 51 | -------------------------------------------------------------------------------- /apis/core.oam.dev/v1alpha1/common_types_test.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | -------------------------------------------------------------------------------- /apis/core.oam.dev/v1alpha1/scope_types.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 4 | 5 | type ApplicationScopeSpec struct { 6 | Type string `json:"type"` 7 | AllowComponentOverlap bool `json:"allowComponentOverlap"` 8 | Parameters []Parameter `json:"parameters"` 9 | } 10 | 11 | type ApplicationScopeStatus struct { 12 | } 13 | 14 | // +genclient 15 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 16 | type ApplicationScope struct { 17 | metav1.TypeMeta `json:",inline"` 18 | metav1.ObjectMeta `json:"metadata,omitempty"` 19 | 20 | Spec ApplicationScopeSpec `json:"spec,omitempty"` 21 | // +optional 22 | Status ApplicationScopeStatus `json:"status,omitempty"` 23 | } 24 | 25 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 26 | type ApplicationScopeList struct { 27 | metav1.TypeMeta `json:",inline"` 28 | metav1.ListMeta `json:"metadata,omitempty"` 29 | Items []ApplicationScope `json:"items"` 30 | } 31 | 32 | func init() { 33 | SchemeBuilder.Register(&ApplicationScope{}, &ApplicationScopeList{}) 34 | } 35 | -------------------------------------------------------------------------------- /apis/core.oam.dev/v1alpha1/status_test.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/oam-dev/oam-go-sdk/apis/flags" 7 | 8 | v1 "k8s.io/api/batch/v1" 9 | "k8s.io/api/batch/v1beta1" 10 | 11 | "github.com/oam-dev/oam-go-sdk/apis/handlers" 12 | 13 | "github.com/stretchr/testify/assert" 14 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 15 | ) 16 | 17 | func TestNoModules(t *testing.T) { 18 | as := new(ApplicationConfigurationStatus) 19 | as.Update([]metav1.Object{}, nil) 20 | assert.Equal(t, flags.StatusProgressing, string(as.Phase)) 21 | } 22 | 23 | func crdStatus(r metav1.Object) string { 24 | rsrc, ok := r.(*v1.Job) 25 | if !ok { 26 | return flags.StatusUnknown 27 | } 28 | if rsrc.Status.Failed == 0 && rsrc.Status.Succeeded > 0 { 29 | return flags.StatusReady 30 | } 31 | return flags.StatusProgressing 32 | } 33 | 34 | func TestRegisterStatusHandler(t *testing.T) { 35 | jb := new(v1.Job) 36 | jb.Status.Failed = 0 37 | jb.Status.Succeeded = 1 38 | handlers.RegisterStatusHandler(jb.GetObjectKind().GroupVersionKind(), crdStatus) 39 | as := new(ApplicationConfigurationStatus) 40 | as.Update([]metav1.Object{jb, new(v1beta1.CronJob)}, nil) 41 | assert.Equal(t, flags.StatusReady, as.Modules[0].Status) 42 | assert.Equal(t, flags.StatusUnknown, as.Modules[1].Status) 43 | assert.Equal(t, flags.StatusProgressing, string(as.Phase)) 44 | } 45 | -------------------------------------------------------------------------------- /apis/flags/flags.go: -------------------------------------------------------------------------------- 1 | package flags 2 | 3 | // ComponentConfiguration status 4 | const ( 5 | StatusReady = "Ready" 6 | StatusProgressing = "Progressing" 7 | StatusFailed = "Failed" 8 | StatusUnknown = "Unknown" 9 | ) 10 | -------------------------------------------------------------------------------- /apis/handlers/status.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | 3 | import ( 4 | "fmt" 5 | "sync" 6 | 7 | "github.com/oam-dev/oam-go-sdk/apis/flags" 8 | 9 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 10 | "k8s.io/apimachinery/pkg/runtime" 11 | "k8s.io/apimachinery/pkg/runtime/schema" 12 | ) 13 | 14 | type StatusHander func(rsrc metav1.Object) string 15 | 16 | var statusHandlers = make(map[string]StatusHander) 17 | var statusHandlerLock sync.Mutex 18 | 19 | func FormatGVK(gvk schema.GroupVersionKind) string { 20 | return fmt.Sprintf("%s/%s.%s", gvk.Group, gvk.Version, gvk.Kind) 21 | } 22 | 23 | func RegisterStatusHandler(gvk schema.GroupVersionKind, handler StatusHander) { 24 | statusHandlerLock.Lock() 25 | defer statusHandlerLock.Unlock() 26 | statusHandlers[FormatGVK(gvk)] = handler 27 | } 28 | 29 | func TryStatusHandler(r metav1.Object) string { 30 | if ro, ok := r.(runtime.Object); ok { 31 | statusHandlerLock.Lock() 32 | handler, ok := statusHandlers[FormatGVK(ro.GetObjectKind().GroupVersionKind())] 33 | statusHandlerLock.Unlock() 34 | if ok { 35 | return handler(r) 36 | } 37 | } 38 | return flags.StatusUnknown 39 | } 40 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Sorry, we do not accept changes directly against this repository. Please see 2 | CONTRIBUTING.md for information on where and how to contribute instead. 3 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing guidelines 2 | 3 | Do not open pull requests directly against this repository, they will be ignored. Instead, please open pull requests against [kubernetes/kubernetes](https://git.k8s.io/kubernetes/). Please follow the same [contributing guide](https://git.k8s.io/kubernetes/CONTRIBUTING.md) you would follow for any other pull request made to kubernetes/kubernetes. 4 | 5 | This repository is published from [kubernetes/kubernetes/staging/src/k8s.io/code-generator](https://git.k8s.io/kubernetes/staging/src/k8s.io/code-generator) by the [kubernetes publishing-bot](https://git.k8s.io/publishing-bot). 6 | 7 | Please see [Staging Directory and Publishing](https://git.k8s.io/community/contributors/devel/sig-architecture/staging.md) for more information 8 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/Godeps/OWNERS: -------------------------------------------------------------------------------- 1 | # See the OWNERS docs at https://go.k8s.io/owners 2 | 3 | approvers: 4 | - dep-approvers 5 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/Godeps/Readme: -------------------------------------------------------------------------------- 1 | This directory tree is generated automatically by godep. 2 | 3 | Please do not edit. 4 | 5 | See https://github.com/tools/godep for more information. 6 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/OWNERS: -------------------------------------------------------------------------------- 1 | # See the OWNERS docs at https://go.k8s.io/owners 2 | 3 | approvers: 4 | - lavalamp 5 | - wojtek-t 6 | - sttts 7 | reviewers: 8 | - lavalamp 9 | - wojtek-t 10 | - sttts 11 | labels: 12 | - sig/api-machinery 13 | - area/code-generation 14 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/README.md: -------------------------------------------------------------------------------- 1 | # code-generator 2 | 3 | Golang code-generators used to implement [Kubernetes-style API types](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md). 4 | 5 | ## Purpose 6 | 7 | These code-generators can be used 8 | - in the context of [CustomResourceDefinition](https://kubernetes.io/docs/tasks/access-kubernetes-api/extend-api-custom-resource-definitions/) to build native, versioned clients, 9 | informers and other helpers 10 | - in the context of [User-provider API Servers](https://github.com/kubernetes/apiserver) to build conversions between internal and versioned types, defaulters, protobuf codecs, 11 | internal and versioned clients and informers. 12 | 13 | ## Resources 14 | - The example [sample controller](https://github.com/kubernetes/sample-controller) shows a code example of a controller that uses the clients, listers and informers generated by this library. 15 | - The article [Kubernetes Deep Dive: Code Generation for CustomResources](https://blog.openshift.com/kubernetes-deep-dive-code-generation-customresources/) gives a step by step instruction on how to use this library. 16 | 17 | ## Compatibility 18 | 19 | HEAD of this repo will match HEAD of k8s.io/apiserver, k8s.io/apimachinery, and k8s.io/client-go. 20 | 21 | ## Where does it come from? 22 | 23 | `code-generator` is synced from https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/code-generator. 24 | Code changes are made in that location, merged into `k8s.io/kubernetes` and later synced here. 25 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/SECURITY_CONTACTS: -------------------------------------------------------------------------------- 1 | # Defined below are the security contacts for this repo. 2 | # 3 | # They are the contact point for the Product Security Committee to reach out 4 | # to for triaging and handling of incoming issues. 5 | # 6 | # The below names agree to abide by the 7 | # [Embargo Policy](https://git.k8s.io/security/private-distributors-list.md#embargo-policy) 8 | # and will be removed and replaced if they violate that agreement. 9 | # 10 | # DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE 11 | # INSTRUCTIONS AT https://kubernetes.io/security/ 12 | 13 | cjcullen 14 | joelsmith 15 | liggitt 16 | philips 17 | tallclair 18 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/apis/example/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:deepcopy-gen=package 18 | // +k8s:defaulter-gen=TypeMeta 19 | // +groupName=example-group.hyphens.code-generator.k8s.io 20 | // +groupGoName=ExampleGroup 21 | package v1 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/apis/example/v1/zz_generated.defaults.go: -------------------------------------------------------------------------------- 1 | // +build !ignore_autogenerated 2 | 3 | /* 4 | Copyright The Kubernetes Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by defaulter-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | runtime "k8s.io/apimachinery/pkg/runtime" 25 | ) 26 | 27 | // RegisterDefaults adds defaulters functions to the given scheme. 28 | // Public to allow building arbitrary schemes. 29 | // All generated defaulters are covering - they call all nested defaulters. 30 | func RegisterDefaults(scheme *runtime.Scheme) error { 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package versioned 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned/typed/example/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned/typed/example/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned/typed/example/v1/fake/fake_example_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1 "k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned/typed/example/v1" 25 | ) 26 | 27 | type FakeExampleGroupV1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeExampleGroupV1) ClusterTestTypes() v1.ClusterTestTypeInterface { 32 | return &FakeClusterTestTypes{c} 33 | } 34 | 35 | func (c *FakeExampleGroupV1) TestTypes(namespace string) v1.TestTypeInterface { 36 | return &FakeTestTypes{c, namespace} 37 | } 38 | 39 | // RESTClient returns a RESTClient that is used to communicate 40 | // with API server by this client implementation. 41 | func (c *FakeExampleGroupV1) RESTClient() rest.Interface { 42 | var ret *rest.RESTClient 43 | return ret 44 | } 45 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned/typed/example/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type ClusterTestTypeExpansion interface{} 22 | 23 | type TestTypeExpansion interface{} 24 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalinterfaces 20 | 21 | import ( 22 | time "time" 23 | 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | cache "k8s.io/client-go/tools/cache" 27 | versioned "k8s.io/code-generator/_examples/HyphenGroup/clientset/versioned" 28 | ) 29 | 30 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 31 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 32 | 33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 34 | type SharedInformerFactory interface { 35 | Start(stopCh <-chan struct{}) 36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 37 | } 38 | 39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 40 | type TweakListOptionsFunc func(*v1.ListOptions) 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/HyphenGroup/listers/example/v1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | // ClusterTestTypeListerExpansion allows custom methods to be added to 22 | // ClusterTestTypeLister. 23 | type ClusterTestTypeListerExpansion interface{} 24 | 25 | // TestTypeListerExpansion allows custom methods to be added to 26 | // TestTypeLister. 27 | type TestTypeListerExpansion interface{} 28 | 29 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 30 | // TestTypeNamespaceLister. 31 | type TestTypeNamespaceListerExpansion interface{} 32 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/apis/example/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:deepcopy-gen=package 18 | // +k8s:defaulter-gen=TypeMeta 19 | // +groupName=example.crd.code-generator.k8s.io 20 | package v1 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/apis/example/v1/zz_generated.defaults.go: -------------------------------------------------------------------------------- 1 | // +build !ignore_autogenerated 2 | 3 | /* 4 | Copyright The Kubernetes Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by defaulter-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | runtime "k8s.io/apimachinery/pkg/runtime" 25 | ) 26 | 27 | // RegisterDefaults adds defaulters functions to the given scheme. 28 | // Public to allow building arbitrary schemes. 29 | // All generated defaulters are covering - they call all nested defaulters. 30 | func RegisterDefaults(scheme *runtime.Scheme) error { 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package versioned 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/clientset/versioned/typed/example/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/clientset/versioned/typed/example/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/clientset/versioned/typed/example/v1/fake/fake_example_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1 "k8s.io/code-generator/_examples/MixedCase/clientset/versioned/typed/example/v1" 25 | ) 26 | 27 | type FakeExampleV1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeExampleV1) ClusterTestTypes() v1.ClusterTestTypeInterface { 32 | return &FakeClusterTestTypes{c} 33 | } 34 | 35 | func (c *FakeExampleV1) TestTypes(namespace string) v1.TestTypeInterface { 36 | return &FakeTestTypes{c, namespace} 37 | } 38 | 39 | // RESTClient returns a RESTClient that is used to communicate 40 | // with API server by this client implementation. 41 | func (c *FakeExampleV1) RESTClient() rest.Interface { 42 | var ret *rest.RESTClient 43 | return ret 44 | } 45 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/clientset/versioned/typed/example/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type ClusterTestTypeExpansion interface{} 22 | 23 | type TestTypeExpansion interface{} 24 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/informers/externalversions/example/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package example 20 | 21 | import ( 22 | v1 "k8s.io/code-generator/_examples/MixedCase/informers/externalversions/example/v1" 23 | internalinterfaces "k8s.io/code-generator/_examples/MixedCase/informers/externalversions/internalinterfaces" 24 | ) 25 | 26 | // Interface provides access to each of this group's versions. 27 | type Interface interface { 28 | // V1 provides access to shared informers for resources in V1. 29 | V1() v1.Interface 30 | } 31 | 32 | type group struct { 33 | factory internalinterfaces.SharedInformerFactory 34 | namespace string 35 | tweakListOptions internalinterfaces.TweakListOptionsFunc 36 | } 37 | 38 | // New returns a new Interface. 39 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 40 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 41 | } 42 | 43 | // V1 returns a new v1.Interface. 44 | func (g *group) V1() v1.Interface { 45 | return v1.New(g.factory, g.namespace, g.tweakListOptions) 46 | } 47 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalinterfaces 20 | 21 | import ( 22 | time "time" 23 | 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | cache "k8s.io/client-go/tools/cache" 27 | versioned "k8s.io/code-generator/_examples/MixedCase/clientset/versioned" 28 | ) 29 | 30 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 31 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 32 | 33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 34 | type SharedInformerFactory interface { 35 | Start(stopCh <-chan struct{}) 36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 37 | } 38 | 39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 40 | type TweakListOptionsFunc func(*v1.ListOptions) 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/MixedCase/listers/example/v1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | // ClusterTestTypeListerExpansion allows custom methods to be added to 22 | // ClusterTestTypeLister. 23 | type ClusterTestTypeListerExpansion interface{} 24 | 25 | // TestTypeListerExpansion allows custom methods to be added to 26 | // TestTypeLister. 27 | type TestTypeListerExpansion interface{} 28 | 29 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 30 | // TestTypeNamespaceLister. 31 | type TestTypeNamespaceListerExpansion interface{} 32 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:deepcopy-gen=package 18 | // +groupName=example.apiserver.code-generator.k8s.io 19 | 20 | package example // import "k8s.io/code-generator/_examples/apiserver/apis/example" 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example/install/install.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package install installs the experimental API group, making it available as 18 | // an option to all of the API encoding/decoding machinery. 19 | package install 20 | 21 | import ( 22 | "k8s.io/apimachinery/pkg/runtime" 23 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 24 | "k8s.io/code-generator/_examples/apiserver/apis/example" 25 | "k8s.io/code-generator/_examples/apiserver/apis/example/v1" 26 | ) 27 | 28 | // Install registers the API group and adds types to a scheme 29 | func Install(scheme *runtime.Scheme) { 30 | utilruntime.Must(example.AddToScheme(scheme)) 31 | utilruntime.Must(v1.AddToScheme(scheme)) 32 | utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion)) 33 | } 34 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package example 18 | 19 | import ( 20 | "k8s.io/apimachinery/pkg/runtime" 21 | "k8s.io/apimachinery/pkg/runtime/schema" 22 | ) 23 | 24 | var SchemeGroupVersion = schema.GroupVersion{Group: "example.api.code-generator.k8s.io", Version: runtime.APIVersionInternal} 25 | 26 | var ( 27 | SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) 28 | AddToScheme = SchemeBuilder.AddToScheme 29 | ) 30 | 31 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 32 | func Resource(resource string) schema.GroupResource { 33 | return SchemeGroupVersion.WithResource(resource).GroupResource() 34 | } 35 | 36 | // Adds the list of known types to the given scheme. 37 | func addKnownTypes(scheme *runtime.Scheme) error { 38 | scheme.AddKnownTypes(SchemeGroupVersion, 39 | &TestType{}, 40 | &TestTypeList{}, 41 | ) 42 | 43 | scheme.AddKnownTypes(SchemeGroupVersion) 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package example 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | // +genclient 22 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 23 | 24 | // TestType is a top-level type. A client is created for it. 25 | type TestType struct { 26 | metav1.TypeMeta 27 | metav1.ObjectMeta 28 | Status TestTypeStatus 29 | } 30 | 31 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 32 | 33 | // TestTypeList is a top-level list type. The client methods for lists are automatically created. 34 | // You are not supposed to create a separated client for this one. 35 | type TestTypeList struct { 36 | metav1.TypeMeta 37 | metav1.ListMeta 38 | 39 | Items []TestType 40 | } 41 | 42 | type TestTypeStatus struct { 43 | Blah string 44 | } 45 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:openapi-gen=true 18 | // +k8s:deepcopy-gen=package 19 | // +k8s:defaulter-gen=TypeMeta 20 | // +k8s:conversion-gen=k8s.io/code-generator/_examples/apiserver/apis/example 21 | // +groupName=example.apiserver.code-generator.k8s.io 22 | 23 | package v1 24 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example/v1/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | // +genclient 22 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 23 | 24 | // TestType is a top-level type. A client is created for it. 25 | type TestType struct { 26 | metav1.TypeMeta `json:",inline"` 27 | // +optional 28 | metav1.ObjectMeta `json:"metadata,omitempty"` 29 | // +optional 30 | Status TestTypeStatus `json:"status,omitempty"` 31 | } 32 | 33 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 34 | 35 | // TestTypeList is a top-level list type. The client methods for lists are automatically created. 36 | // You are not supposed to create a separated client for this one. 37 | type TestTypeList struct { 38 | metav1.TypeMeta `json:",inline"` 39 | // +optional 40 | metav1.ListMeta `json:"metadata,omitempty"` 41 | 42 | Items []TestType `json:"items"` 43 | } 44 | 45 | type TestTypeStatus struct { 46 | Blah string 47 | } 48 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example/v1/zz_generated.defaults.go: -------------------------------------------------------------------------------- 1 | // +build !ignore_autogenerated 2 | 3 | /* 4 | Copyright The Kubernetes Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by defaulter-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | runtime "k8s.io/apimachinery/pkg/runtime" 25 | ) 26 | 27 | // RegisterDefaults adds defaulters functions to the given scheme. 28 | // Public to allow building arbitrary schemes. 29 | // All generated defaulters are covering - they call all nested defaulters. 30 | func RegisterDefaults(scheme *runtime.Scheme) error { 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example2/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:deepcopy-gen=package 18 | // +groupName=example.test.apiserver.code-generator.k8s.io 19 | // +groupGoName=SecondExample 20 | 21 | package example2 // import "k8s.io/code-generator/_examples/apiserver/apis/example2" 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example2/install/install.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package install installs the experimental API group, making it available as 18 | // an option to all of the API encoding/decoding machinery. 19 | package install 20 | 21 | import ( 22 | "k8s.io/apimachinery/pkg/runtime" 23 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 24 | "k8s.io/code-generator/_examples/apiserver/apis/example2" 25 | "k8s.io/code-generator/_examples/apiserver/apis/example2/v1" 26 | ) 27 | 28 | // Install registers the API group and adds types to a scheme 29 | func Install(scheme *runtime.Scheme) { 30 | utilruntime.Must(example2.AddToScheme(scheme)) 31 | utilruntime.Must(v1.AddToScheme(scheme)) 32 | utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion)) 33 | } 34 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example2/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package example2 18 | 19 | import ( 20 | "k8s.io/apimachinery/pkg/runtime" 21 | "k8s.io/apimachinery/pkg/runtime/schema" 22 | ) 23 | 24 | var SchemeGroupVersion = schema.GroupVersion{Group: "example.test.apiserver.code-generator.k8s.io", Version: runtime.APIVersionInternal} 25 | 26 | var ( 27 | SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) 28 | AddToScheme = SchemeBuilder.AddToScheme 29 | ) 30 | 31 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 32 | func Resource(resource string) schema.GroupResource { 33 | return SchemeGroupVersion.WithResource(resource).GroupResource() 34 | } 35 | 36 | // Adds the list of known types to the given scheme. 37 | func addKnownTypes(scheme *runtime.Scheme) error { 38 | scheme.AddKnownTypes(SchemeGroupVersion, 39 | &TestType{}, 40 | &TestTypeList{}, 41 | ) 42 | 43 | scheme.AddKnownTypes(SchemeGroupVersion) 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example2/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package example2 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | // +genclient 22 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 23 | // +genclient:nonNamespaced 24 | // TestType is a top-level type. A client is created for it. 25 | type TestType struct { 26 | metav1.TypeMeta 27 | metav1.ObjectMeta 28 | Status TestTypeStatus 29 | } 30 | 31 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 32 | 33 | // TestTypeList is a top-level list type. The client methods for lists are automatically created. 34 | // You are not supposed to create a separated client for this one. 35 | type TestTypeList struct { 36 | metav1.TypeMeta 37 | metav1.ListMeta 38 | 39 | Items []TestType 40 | } 41 | 42 | type TestTypeStatus struct { 43 | Blah string 44 | } 45 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example2/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:openapi-gen=true 18 | // +k8s:deepcopy-gen=package 19 | // +k8s:defaulter-gen=TypeMeta 20 | // +groupName=example.test.apiserver.code-generator.k8s.io 21 | // +k8s:conversion-gen=k8s.io/code-generator/_examples/apiserver/apis/example2 22 | // +groupGoName=SecondExample 23 | 24 | package v1 25 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example2/v1/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | // +genclient 22 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 23 | 24 | // TestType is a top-level type. A client is created for it. 25 | type TestType struct { 26 | metav1.TypeMeta `json:",inline"` 27 | // +optional 28 | metav1.ObjectMeta `json:"metadata,omitempty"` 29 | // +optional 30 | Status TestTypeStatus `json:"status,omitempty"` 31 | } 32 | 33 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 34 | 35 | // TestTypeList is a top-level list type. The client methods for lists are automatically created. 36 | // You are not supposed to create a separated client for this one. 37 | type TestTypeList struct { 38 | metav1.TypeMeta `json:",inline"` 39 | // +optional 40 | metav1.ListMeta `json:"metadata,omitempty"` 41 | 42 | Items []TestType `json:"items"` 43 | } 44 | 45 | type TestTypeStatus struct { 46 | Blah string 47 | } 48 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example2/v1/zz_generated.defaults.go: -------------------------------------------------------------------------------- 1 | // +build !ignore_autogenerated 2 | 3 | /* 4 | Copyright The Kubernetes Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by defaulter-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | runtime "k8s.io/apimachinery/pkg/runtime" 25 | ) 26 | 27 | // RegisterDefaults adds defaulters functions to the given scheme. 28 | // Public to allow building arbitrary schemes. 29 | // All generated defaulters are covering - they call all nested defaulters. 30 | func RegisterDefaults(scheme *runtime.Scheme) error { 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example3.io/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:deepcopy-gen=package 18 | // +groupName=example.dots.apiserver.code-generator.k8s.io 19 | // +groupGoName=ThirdExample 20 | 21 | package example3 // import "k8s.io/code-generator/_examples/apiserver/apis/example3.io" 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example3.io/install/install.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package install installs the experimental API group, making it available as 18 | // an option to all of the API encoding/decoding machinery. 19 | package install 20 | 21 | import ( 22 | "k8s.io/apimachinery/pkg/runtime" 23 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 24 | example3 "k8s.io/code-generator/_examples/apiserver/apis/example3.io" 25 | "k8s.io/code-generator/_examples/apiserver/apis/example3.io/v1" 26 | ) 27 | 28 | // Install registers the API group and adds types to a scheme 29 | func Install(scheme *runtime.Scheme) { 30 | utilruntime.Must(example3.AddToScheme(scheme)) 31 | utilruntime.Must(v1.AddToScheme(scheme)) 32 | utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion)) 33 | } 34 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example3.io/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package example3 18 | 19 | import ( 20 | "k8s.io/apimachinery/pkg/runtime" 21 | "k8s.io/apimachinery/pkg/runtime/schema" 22 | ) 23 | 24 | var SchemeGroupVersion = schema.GroupVersion{Group: "example.dots.apiserver.code-generator.k8s.io", Version: runtime.APIVersionInternal} 25 | 26 | var ( 27 | SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) 28 | AddToScheme = SchemeBuilder.AddToScheme 29 | ) 30 | 31 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 32 | func Resource(resource string) schema.GroupResource { 33 | return SchemeGroupVersion.WithResource(resource).GroupResource() 34 | } 35 | 36 | // Adds the list of known types to the given scheme. 37 | func addKnownTypes(scheme *runtime.Scheme) error { 38 | scheme.AddKnownTypes(SchemeGroupVersion, 39 | &TestType{}, 40 | &TestTypeList{}, 41 | ) 42 | 43 | scheme.AddKnownTypes(SchemeGroupVersion) 44 | return nil 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example3.io/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package example3 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | // +genclient 22 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 23 | 24 | // TestType is a top-level type. A client is created for it. 25 | type TestType struct { 26 | metav1.TypeMeta 27 | metav1.ObjectMeta 28 | Status TestTypeStatus 29 | } 30 | 31 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 32 | 33 | // TestTypeList is a top-level list type. The client methods for lists are automatically created. 34 | // You are not supposed to create a separated client for this one. 35 | type TestTypeList struct { 36 | metav1.TypeMeta 37 | metav1.ListMeta 38 | 39 | Items []TestType 40 | } 41 | 42 | type TestTypeStatus struct { 43 | Blah string 44 | } 45 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example3.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:openapi-gen=true 18 | // +k8s:deepcopy-gen=package 19 | // +k8s:defaulter-gen=TypeMeta 20 | // +groupName=example.dots.apiserver.code-generator.k8s.io 21 | // +k8s:conversion-gen=k8s.io/code-generator/_examples/apiserver/apis/example3.io 22 | // +groupGoName=ThirdExample 23 | 24 | package v1 25 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example3.io/v1/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | // +genclient 22 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 23 | 24 | // TestType is a top-level type. A client is created for it. 25 | type TestType struct { 26 | metav1.TypeMeta `json:",inline"` 27 | // +optional 28 | metav1.ObjectMeta `json:"metadata,omitempty"` 29 | // +optional 30 | Status TestTypeStatus `json:"status,omitempty"` 31 | } 32 | 33 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 34 | 35 | // TestTypeList is a top-level list type. The client methods for lists are automatically created. 36 | // You are not supposed to create a separated client for this one. 37 | type TestTypeList struct { 38 | metav1.TypeMeta `json:",inline"` 39 | // +optional 40 | metav1.ListMeta `json:"metadata,omitempty"` 41 | 42 | Items []TestType `json:"items"` 43 | } 44 | 45 | type TestTypeStatus struct { 46 | Blah string 47 | } 48 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/apis/example3.io/v1/zz_generated.defaults.go: -------------------------------------------------------------------------------- 1 | // +build !ignore_autogenerated 2 | 3 | /* 4 | Copyright The Kubernetes Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by defaulter-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | runtime "k8s.io/apimachinery/pkg/runtime" 25 | ) 26 | 27 | // RegisterDefaults adds defaulters functions to the given scheme. 28 | // Public to allow building arbitrary schemes. 29 | // All generated defaulters are covering - they call all nested defaulters. 30 | func RegisterDefaults(scheme *runtime.Scheme) error { 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package internalversion 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/scheme/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package scheme 20 | 21 | import ( 22 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 | runtime "k8s.io/apimachinery/pkg/runtime" 24 | schema "k8s.io/apimachinery/pkg/runtime/schema" 25 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 26 | example "k8s.io/code-generator/_examples/apiserver/apis/example/install" 27 | secondexample "k8s.io/code-generator/_examples/apiserver/apis/example2/install" 28 | thirdexample "k8s.io/code-generator/_examples/apiserver/apis/example3.io/install" 29 | ) 30 | 31 | var Scheme = runtime.NewScheme() 32 | var Codecs = serializer.NewCodecFactory(Scheme) 33 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 34 | 35 | func init() { 36 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 37 | Install(Scheme) 38 | } 39 | 40 | // Install registers the API group and adds types to a scheme 41 | func Install(scheme *runtime.Scheme) { 42 | example.Install(scheme) 43 | secondexample.Install(scheme) 44 | thirdexample.Install(scheme) 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example/internalversion/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package internalversion 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example/internalversion/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example/internalversion/fake/fake_example_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | internalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example/internalversion" 25 | ) 26 | 27 | type FakeExample struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeExample) TestTypes(namespace string) internalversion.TestTypeInterface { 32 | return &FakeTestTypes{c, namespace} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeExample) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example/internalversion/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package internalversion 20 | 21 | type TestTypeExpansion interface{} 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example2/internalversion/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package internalversion 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example2/internalversion/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example2/internalversion/fake/fake_example2_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | internalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example2/internalversion" 25 | ) 26 | 27 | type FakeSecondExample struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeSecondExample) TestTypes() internalversion.TestTypeInterface { 32 | return &FakeTestTypes{c} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeSecondExample) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example2/internalversion/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package internalversion 20 | 21 | type TestTypeExpansion interface{} 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example3.io/internalversion/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package internalversion 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example3.io/internalversion/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example3.io/internalversion/fake/fake_example3.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | internalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example3.io/internalversion" 25 | ) 26 | 27 | type FakeThirdExample struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeThirdExample) TestTypes(namespace string) internalversion.TestTypeInterface { 32 | return &FakeTestTypes{c, namespace} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeThirdExample) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/internalversion/typed/example3.io/internalversion/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package internalversion 20 | 21 | type TestTypeExpansion interface{} 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package versioned 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example/v1/fake/fake_example_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1 "k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example/v1" 25 | ) 26 | 27 | type FakeExampleV1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeExampleV1) TestTypes(namespace string) v1.TestTypeInterface { 32 | return &FakeTestTypes{c, namespace} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeExampleV1) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type TestTypeExpansion interface{} 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example2/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example2/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example2/v1/fake/fake_example2_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1 "k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example2/v1" 25 | ) 26 | 27 | type FakeSecondExampleV1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeSecondExampleV1) TestTypes(namespace string) v1.TestTypeInterface { 32 | return &FakeTestTypes{c, namespace} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeSecondExampleV1) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example2/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type TestTypeExpansion interface{} 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example3.io/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example3.io/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example3.io/v1/fake/fake_example3.io_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1 "k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example3.io/v1" 25 | ) 26 | 27 | type FakeThirdExampleV1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeThirdExampleV1) TestTypes(namespace string) v1.TestTypeInterface { 32 | return &FakeTestTypes{c, namespace} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeThirdExampleV1) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/clientset/versioned/typed/example3.io/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type TestTypeExpansion interface{} 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/informers/externalversions/example/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package example 20 | 21 | import ( 22 | v1 "k8s.io/code-generator/_examples/apiserver/informers/externalversions/example/v1" 23 | internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/externalversions/internalinterfaces" 24 | ) 25 | 26 | // Interface provides access to each of this group's versions. 27 | type Interface interface { 28 | // V1 provides access to shared informers for resources in V1. 29 | V1() v1.Interface 30 | } 31 | 32 | type group struct { 33 | factory internalinterfaces.SharedInformerFactory 34 | namespace string 35 | tweakListOptions internalinterfaces.TweakListOptionsFunc 36 | } 37 | 38 | // New returns a new Interface. 39 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 40 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 41 | } 42 | 43 | // V1 returns a new v1.Interface. 44 | func (g *group) V1() v1.Interface { 45 | return v1.New(g.factory, g.namespace, g.tweakListOptions) 46 | } 47 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/informers/externalversions/example/v1/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/externalversions/internalinterfaces" 23 | ) 24 | 25 | // Interface provides access to all the informers in this group version. 26 | type Interface interface { 27 | // TestTypes returns a TestTypeInformer. 28 | TestTypes() TestTypeInformer 29 | } 30 | 31 | type version struct { 32 | factory internalinterfaces.SharedInformerFactory 33 | namespace string 34 | tweakListOptions internalinterfaces.TweakListOptionsFunc 35 | } 36 | 37 | // New returns a new Interface. 38 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 39 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 40 | } 41 | 42 | // TestTypes returns a TestTypeInformer. 43 | func (v *version) TestTypes() TestTypeInformer { 44 | return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/informers/externalversions/example2/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package example2 20 | 21 | import ( 22 | v1 "k8s.io/code-generator/_examples/apiserver/informers/externalversions/example2/v1" 23 | internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/externalversions/internalinterfaces" 24 | ) 25 | 26 | // Interface provides access to each of this group's versions. 27 | type Interface interface { 28 | // V1 provides access to shared informers for resources in V1. 29 | V1() v1.Interface 30 | } 31 | 32 | type group struct { 33 | factory internalinterfaces.SharedInformerFactory 34 | namespace string 35 | tweakListOptions internalinterfaces.TweakListOptionsFunc 36 | } 37 | 38 | // New returns a new Interface. 39 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 40 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 41 | } 42 | 43 | // V1 returns a new v1.Interface. 44 | func (g *group) V1() v1.Interface { 45 | return v1.New(g.factory, g.namespace, g.tweakListOptions) 46 | } 47 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/informers/externalversions/example2/v1/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/externalversions/internalinterfaces" 23 | ) 24 | 25 | // Interface provides access to all the informers in this group version. 26 | type Interface interface { 27 | // TestTypes returns a TestTypeInformer. 28 | TestTypes() TestTypeInformer 29 | } 30 | 31 | type version struct { 32 | factory internalinterfaces.SharedInformerFactory 33 | namespace string 34 | tweakListOptions internalinterfaces.TweakListOptionsFunc 35 | } 36 | 37 | // New returns a new Interface. 38 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 39 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 40 | } 41 | 42 | // TestTypes returns a TestTypeInformer. 43 | func (v *version) TestTypes() TestTypeInformer { 44 | return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/informers/externalversions/example3.io/v1/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/externalversions/internalinterfaces" 23 | ) 24 | 25 | // Interface provides access to all the informers in this group version. 26 | type Interface interface { 27 | // TestTypes returns a TestTypeInformer. 28 | TestTypes() TestTypeInformer 29 | } 30 | 31 | type version struct { 32 | factory internalinterfaces.SharedInformerFactory 33 | namespace string 34 | tweakListOptions internalinterfaces.TweakListOptionsFunc 35 | } 36 | 37 | // New returns a new Interface. 38 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 39 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 40 | } 41 | 42 | // TestTypes returns a TestTypeInformer. 43 | func (v *version) TestTypes() TestTypeInformer { 44 | return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalinterfaces 20 | 21 | import ( 22 | time "time" 23 | 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | cache "k8s.io/client-go/tools/cache" 27 | versioned "k8s.io/code-generator/_examples/apiserver/clientset/versioned" 28 | ) 29 | 30 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 31 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 32 | 33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 34 | type SharedInformerFactory interface { 35 | Start(stopCh <-chan struct{}) 36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 37 | } 38 | 39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 40 | type TweakListOptionsFunc func(*v1.ListOptions) 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/informers/internalversion/example2/internalversion/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalversion 20 | 21 | import ( 22 | internalinterfaces "k8s.io/code-generator/_examples/apiserver/informers/internalversion/internalinterfaces" 23 | ) 24 | 25 | // Interface provides access to all the informers in this group version. 26 | type Interface interface { 27 | // TestTypes returns a TestTypeInformer. 28 | TestTypes() TestTypeInformer 29 | } 30 | 31 | type version struct { 32 | factory internalinterfaces.SharedInformerFactory 33 | namespace string 34 | tweakListOptions internalinterfaces.TweakListOptionsFunc 35 | } 36 | 37 | // New returns a new Interface. 38 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 39 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 40 | } 41 | 42 | // TestTypes returns a TestTypeInformer. 43 | func (v *version) TestTypes() TestTypeInformer { 44 | return &testTypeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/informers/internalversion/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalinterfaces 20 | 21 | import ( 22 | time "time" 23 | 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | cache "k8s.io/client-go/tools/cache" 27 | internalversion "k8s.io/code-generator/_examples/apiserver/clientset/internalversion" 28 | ) 29 | 30 | // NewInformerFunc takes internalversion.Interface and time.Duration to return a SharedIndexInformer. 31 | type NewInformerFunc func(internalversion.Interface, time.Duration) cache.SharedIndexInformer 32 | 33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 34 | type SharedInformerFactory interface { 35 | Start(stopCh <-chan struct{}) 36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 37 | } 38 | 39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 40 | type TweakListOptionsFunc func(*v1.ListOptions) 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/listers/example/internalversion/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package internalversion 20 | 21 | // TestTypeListerExpansion allows custom methods to be added to 22 | // TestTypeLister. 23 | type TestTypeListerExpansion interface{} 24 | 25 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 26 | // TestTypeNamespaceLister. 27 | type TestTypeNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/listers/example/v1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | // TestTypeListerExpansion allows custom methods to be added to 22 | // TestTypeLister. 23 | type TestTypeListerExpansion interface{} 24 | 25 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 26 | // TestTypeNamespaceLister. 27 | type TestTypeNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/listers/example2/internalversion/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package internalversion 20 | 21 | // TestTypeListerExpansion allows custom methods to be added to 22 | // TestTypeLister. 23 | type TestTypeListerExpansion interface{} 24 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/listers/example2/v1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | // TestTypeListerExpansion allows custom methods to be added to 22 | // TestTypeLister. 23 | type TestTypeListerExpansion interface{} 24 | 25 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 26 | // TestTypeNamespaceLister. 27 | type TestTypeNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/listers/example3.io/internalversion/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package internalversion 20 | 21 | // TestTypeListerExpansion allows custom methods to be added to 22 | // TestTypeLister. 23 | type TestTypeListerExpansion interface{} 24 | 25 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 26 | // TestTypeNamespaceLister. 27 | type TestTypeNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/apiserver/listers/example3.io/v1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | // TestTypeListerExpansion allows custom methods to be added to 22 | // TestTypeLister. 23 | type TestTypeListerExpansion interface{} 24 | 25 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 26 | // TestTypeNamespaceLister. 27 | type TestTypeNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/apis/example/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:deepcopy-gen=package 18 | // +k8s:defaulter-gen=TypeMeta 19 | // +groupName=example.crd.code-generator.k8s.io 20 | 21 | package v1 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/apis/example/v1/zz_generated.defaults.go: -------------------------------------------------------------------------------- 1 | // +build !ignore_autogenerated 2 | 3 | /* 4 | Copyright The Kubernetes Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by defaulter-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | runtime "k8s.io/apimachinery/pkg/runtime" 25 | ) 26 | 27 | // RegisterDefaults adds defaulters functions to the given scheme. 28 | // Public to allow building arbitrary schemes. 29 | // All generated defaulters are covering - they call all nested defaulters. 30 | func RegisterDefaults(scheme *runtime.Scheme) error { 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/apis/example2/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // +k8s:deepcopy-gen=package 18 | // +k8s:defaulter-gen=TypeMeta 19 | // +groupName=example.test.crd.code-generator.k8s.io 20 | // +groupGoName=SecondExample 21 | 22 | package v1 23 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/apis/example2/v1/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1 18 | 19 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 20 | 21 | // +genclient 22 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 23 | 24 | // TestType is a top-level type. A client is created for it. 25 | type TestType struct { 26 | metav1.TypeMeta `json:",inline"` 27 | // +optional 28 | metav1.ObjectMeta `json:"metadata,omitempty"` 29 | // +optional 30 | Status TestTypeStatus `json:"status,omitempty"` 31 | } 32 | 33 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 34 | 35 | // TestTypeList is a top-level list type. The client methods for lists are automatically created. 36 | // You are not supposed to create a separated client for this one. 37 | type TestTypeList struct { 38 | metav1.TypeMeta `json:",inline"` 39 | // +optional 40 | metav1.ListMeta `json:"metadata,omitempty"` 41 | 42 | Items []TestType `json:"items"` 43 | } 44 | 45 | type TestTypeStatus struct { 46 | Blah string 47 | } 48 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/apis/example2/v1/zz_generated.defaults.go: -------------------------------------------------------------------------------- 1 | // +build !ignore_autogenerated 2 | 3 | /* 4 | Copyright The Kubernetes Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // Code generated by defaulter-gen. DO NOT EDIT. 20 | 21 | package v1 22 | 23 | import ( 24 | runtime "k8s.io/apimachinery/pkg/runtime" 25 | ) 26 | 27 | // RegisterDefaults adds defaulters functions to the given scheme. 28 | // Public to allow building arbitrary schemes. 29 | // All generated defaulters are covering - they call all nested defaulters. 30 | func RegisterDefaults(scheme *runtime.Scheme) error { 31 | return nil 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated clientset. 20 | package versioned 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated fake clientset. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package contains the scheme of the automatically generated clientset. 20 | package scheme 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example/v1/fake/fake_example_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1 "k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example/v1" 25 | ) 26 | 27 | type FakeExampleV1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeExampleV1) ClusterTestTypes() v1.ClusterTestTypeInterface { 32 | return &FakeClusterTestTypes{c} 33 | } 34 | 35 | func (c *FakeExampleV1) TestTypes(namespace string) v1.TestTypeInterface { 36 | return &FakeTestTypes{c, namespace} 37 | } 38 | 39 | // RESTClient returns a RESTClient that is used to communicate 40 | // with API server by this client implementation. 41 | func (c *FakeExampleV1) RESTClient() rest.Interface { 42 | var ret *rest.RESTClient 43 | return ret 44 | } 45 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type ClusterTestTypeExpansion interface{} 22 | 23 | type TestTypeExpansion interface{} 24 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example2/v1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // This package has the automatically generated typed clients. 20 | package v1 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example2/v1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | // Package fake has the automatically generated clients. 20 | package fake 21 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example2/v1/fake/fake_example2_client.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package fake 20 | 21 | import ( 22 | rest "k8s.io/client-go/rest" 23 | testing "k8s.io/client-go/testing" 24 | v1 "k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example2/v1" 25 | ) 26 | 27 | type FakeSecondExampleV1 struct { 28 | *testing.Fake 29 | } 30 | 31 | func (c *FakeSecondExampleV1) TestTypes(namespace string) v1.TestTypeInterface { 32 | return &FakeTestTypes{c, namespace} 33 | } 34 | 35 | // RESTClient returns a RESTClient that is used to communicate 36 | // with API server by this client implementation. 37 | func (c *FakeSecondExampleV1) RESTClient() rest.Interface { 38 | var ret *rest.RESTClient 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/clientset/versioned/typed/example2/v1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by client-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | type TestTypeExpansion interface{} 22 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/informers/externalversions/example/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package example 20 | 21 | import ( 22 | v1 "k8s.io/code-generator/_examples/crd/informers/externalversions/example/v1" 23 | internalinterfaces "k8s.io/code-generator/_examples/crd/informers/externalversions/internalinterfaces" 24 | ) 25 | 26 | // Interface provides access to each of this group's versions. 27 | type Interface interface { 28 | // V1 provides access to shared informers for resources in V1. 29 | V1() v1.Interface 30 | } 31 | 32 | type group struct { 33 | factory internalinterfaces.SharedInformerFactory 34 | namespace string 35 | tweakListOptions internalinterfaces.TweakListOptionsFunc 36 | } 37 | 38 | // New returns a new Interface. 39 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 40 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 41 | } 42 | 43 | // V1 returns a new v1.Interface. 44 | func (g *group) V1() v1.Interface { 45 | return v1.New(g.factory, g.namespace, g.tweakListOptions) 46 | } 47 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/informers/externalversions/example2/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package example2 20 | 21 | import ( 22 | v1 "k8s.io/code-generator/_examples/crd/informers/externalversions/example2/v1" 23 | internalinterfaces "k8s.io/code-generator/_examples/crd/informers/externalversions/internalinterfaces" 24 | ) 25 | 26 | // Interface provides access to each of this group's versions. 27 | type Interface interface { 28 | // V1 provides access to shared informers for resources in V1. 29 | V1() v1.Interface 30 | } 31 | 32 | type group struct { 33 | factory internalinterfaces.SharedInformerFactory 34 | namespace string 35 | tweakListOptions internalinterfaces.TweakListOptionsFunc 36 | } 37 | 38 | // New returns a new Interface. 39 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 40 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 41 | } 42 | 43 | // V1 returns a new v1.Interface. 44 | func (g *group) V1() v1.Interface { 45 | return v1.New(g.factory, g.namespace, g.tweakListOptions) 46 | } 47 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/informers/externalversions/example2/v1/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | import ( 22 | internalinterfaces "k8s.io/code-generator/_examples/crd/informers/externalversions/internalinterfaces" 23 | ) 24 | 25 | // Interface provides access to all the informers in this group version. 26 | type Interface interface { 27 | // TestTypes returns a TestTypeInformer. 28 | TestTypes() TestTypeInformer 29 | } 30 | 31 | type version struct { 32 | factory internalinterfaces.SharedInformerFactory 33 | namespace string 34 | tweakListOptions internalinterfaces.TweakListOptionsFunc 35 | } 36 | 37 | // New returns a new Interface. 38 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 39 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 40 | } 41 | 42 | // TestTypes returns a TestTypeInformer. 43 | func (v *version) TestTypes() TestTypeInformer { 44 | return &testTypeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 45 | } 46 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by informer-gen. DO NOT EDIT. 18 | 19 | package internalinterfaces 20 | 21 | import ( 22 | time "time" 23 | 24 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | runtime "k8s.io/apimachinery/pkg/runtime" 26 | cache "k8s.io/client-go/tools/cache" 27 | versioned "k8s.io/code-generator/_examples/crd/clientset/versioned" 28 | ) 29 | 30 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 31 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 32 | 33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 34 | type SharedInformerFactory interface { 35 | Start(stopCh <-chan struct{}) 36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 37 | } 38 | 39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 40 | type TweakListOptionsFunc func(*v1.ListOptions) 41 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/listers/example/v1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | // ClusterTestTypeListerExpansion allows custom methods to be added to 22 | // ClusterTestTypeLister. 23 | type ClusterTestTypeListerExpansion interface{} 24 | 25 | // TestTypeListerExpansion allows custom methods to be added to 26 | // TestTypeLister. 27 | type TestTypeListerExpansion interface{} 28 | 29 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 30 | // TestTypeNamespaceLister. 31 | type TestTypeNamespaceListerExpansion interface{} 32 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/_examples/crd/listers/example2/v1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by lister-gen. DO NOT EDIT. 18 | 19 | package v1 20 | 21 | // TestTypeListerExpansion allows custom methods to be added to 22 | // TestTypeLister. 23 | type TestTypeListerExpansion interface{} 24 | 25 | // TestTypeNamespaceListerExpansion allows custom methods to be added to 26 | // TestTypeNamespaceLister. 27 | type TestTypeNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/client-gen/OWNERS: -------------------------------------------------------------------------------- 1 | # See the OWNERS docs at https://go.k8s.io/owners 2 | 3 | approvers: 4 | - lavalamp 5 | - wojtek-t 6 | - caesarxuchao 7 | reviewers: 8 | - lavalamp 9 | - wojtek-t 10 | - caesarxuchao 11 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/client-gen/README.md: -------------------------------------------------------------------------------- 1 | See [generating-clientset.md](https://git.k8s.io/community/contributors/devel/sig-api-machinery/generating-clientset.md) 2 | 3 | 4 | [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/staging/src/k8s.io/code-generator/client-gen/README.md?pixel)]() 5 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/client-gen/generators/generator_for_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package generators 18 | 19 | import ( 20 | "io" 21 | "os" 22 | "path/filepath" 23 | "strings" 24 | 25 | "k8s.io/gengo/generator" 26 | "k8s.io/gengo/types" 27 | ) 28 | 29 | // genExpansion produces a file for a group client, e.g. ExtensionsClient for the extension group. 30 | type genExpansion struct { 31 | generator.DefaultGen 32 | groupPackagePath string 33 | // types in a group 34 | types []*types.Type 35 | } 36 | 37 | // We only want to call GenerateType() once per group. 38 | func (g *genExpansion) Filter(c *generator.Context, t *types.Type) bool { 39 | return len(g.types) == 0 || t == g.types[0] 40 | } 41 | 42 | func (g *genExpansion) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { 43 | sw := generator.NewSnippetWriter(w, c, "$", "$") 44 | for _, t := range g.types { 45 | if _, err := os.Stat(filepath.Join(g.groupPackagePath, strings.ToLower(t.Name.Name+"_expansion.go"))); os.IsNotExist(err) { 46 | sw.Do(expansionInterfaceTemplate, t) 47 | } 48 | } 49 | return sw.Error() 50 | } 51 | 52 | var expansionInterfaceTemplate = ` 53 | type $.|public$Expansion interface {} 54 | ` 55 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/client-gen/path/path.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package path 18 | 19 | import "strings" 20 | 21 | // Vendorless removes the longest match of "*/vendor/" from the front of p. 22 | // It is useful if a package locates in vendor/, e.g., 23 | // k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1, because gengo 24 | // indexes the package with its import path, e.g., 25 | // k8s.io/apimachinery/pkg/apis/meta/v1, 26 | func Vendorless(p string) string { 27 | if pos := strings.LastIndex(p, "/vendor/"); pos != -1 { 28 | return p[pos+len("/vendor/"):] 29 | } 30 | return p 31 | } 32 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/client-gen/types/helpers_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package types 18 | 19 | import ( 20 | "reflect" 21 | "sort" 22 | "testing" 23 | ) 24 | 25 | func TestVersionSort(t *testing.T) { 26 | unsortedVersions := []string{"v4beta1", "v2beta1", "v2alpha1", "v3", "v1"} 27 | expected := []string{"v2alpha1", "v2beta1", "v4beta1", "v1", "v3"} 28 | sort.Sort(sortableSliceOfVersions(unsortedVersions)) 29 | if !reflect.DeepEqual(unsortedVersions, expected) { 30 | t.Errorf("expected %#v\ngot %#v", expected, unsortedVersions) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/go-to-protobuf/.gitignore: -------------------------------------------------------------------------------- 1 | go-to-protobuf 2 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/go-to-protobuf/OWNERS: -------------------------------------------------------------------------------- 1 | # See the OWNERS docs at https://go.k8s.io/owners 2 | 3 | approvers: 4 | - smarterclayton 5 | reviewers: 6 | - smarterclayton 7 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/go-to-protobuf/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // go-to-protobuf generates a Protobuf IDL from a Go struct, respecting any 18 | // existing IDL tags on the Go struct. 19 | package main 20 | 21 | import ( 22 | goflag "flag" 23 | 24 | flag "github.com/spf13/pflag" 25 | "k8s.io/code-generator/cmd/go-to-protobuf/protobuf" 26 | ) 27 | 28 | var g = protobuf.New() 29 | 30 | func init() { 31 | g.BindFlags(flag.CommandLine) 32 | goflag.Set("logtostderr", "true") 33 | flag.CommandLine.AddGoFlagSet(goflag.CommandLine) 34 | } 35 | 36 | func main() { 37 | flag.Parse() 38 | protobuf.Run(g) 39 | } 40 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/import_tracker.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package protobuf 18 | 19 | import ( 20 | "k8s.io/gengo/namer" 21 | "k8s.io/gengo/types" 22 | ) 23 | 24 | type ImportTracker struct { 25 | namer.DefaultImportTracker 26 | } 27 | 28 | func NewImportTracker(local types.Name, typesToAdd ...*types.Type) *ImportTracker { 29 | tracker := namer.NewDefaultImportTracker(local) 30 | tracker.IsInvalidType = func(t *types.Type) bool { return t.Kind != types.Protobuf } 31 | tracker.LocalName = func(name types.Name) string { return name.Package } 32 | tracker.PrintImport = func(path, name string) string { return path } 33 | 34 | tracker.AddTypes(typesToAdd...) 35 | return &ImportTracker{ 36 | DefaultImportTracker: tracker, 37 | } 38 | } 39 | 40 | // AddNullable ensures that support for the nullable Gogo-protobuf extension is added. 41 | func (tracker *ImportTracker) AddNullable() { 42 | tracker.AddType(&types.Type{ 43 | Kind: types.Protobuf, 44 | Name: types.Name{ 45 | Name: "nullable", 46 | Package: "gogoproto", 47 | Path: "github.com/gogo/protobuf/gogoproto/gogo.proto", 48 | }, 49 | }) 50 | } 51 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/namer_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package protobuf 18 | 19 | import "testing" 20 | 21 | func TestProtoSafePackage(t *testing.T) { 22 | tests := []struct { 23 | pkg string 24 | expected string 25 | }{ 26 | { 27 | pkg: "foo", 28 | expected: "foo", 29 | }, 30 | { 31 | pkg: "foo/bar", 32 | expected: "foo.bar", 33 | }, 34 | { 35 | pkg: "foo/bar/baz", 36 | expected: "foo.bar.baz", 37 | }, 38 | { 39 | pkg: "foo/bar-baz/x/y-z/q", 40 | expected: "foo.bar_baz.x.y_z.q", 41 | }, 42 | } 43 | 44 | for _, test := range tests { 45 | actual := protoSafePackage(test.pkg) 46 | if e, a := test.expected, actual; e != a { 47 | t.Errorf("%s: expected %s, got %s", test.pkg, e, a) 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/tags.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package protobuf 18 | 19 | import ( 20 | "k8s.io/gengo/types" 21 | "k8s.io/klog" 22 | ) 23 | 24 | // extractBoolTagOrDie gets the comment-tags for the key and asserts that, if 25 | // it exists, the value is boolean. If the tag did not exist, it returns 26 | // false. 27 | func extractBoolTagOrDie(key string, lines []string) bool { 28 | val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines) 29 | if err != nil { 30 | klog.Fatal(err) 31 | } 32 | return val 33 | } 34 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package main defines the protoc-gen-gogo binary we use to generate our proto go files, 18 | // as well as takes dependencies on the correct gogo/protobuf packages for godeps. 19 | package main 20 | 21 | import ( 22 | "github.com/gogo/protobuf/vanity/command" 23 | 24 | // dependencies that are required for our packages 25 | _ "github.com/gogo/protobuf/gogoproto" 26 | _ "github.com/gogo/protobuf/proto" 27 | _ "github.com/gogo/protobuf/sortkeys" 28 | ) 29 | 30 | func main() { 31 | command.Write(command.Generate(command.Read())) 32 | } 33 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/import-boss/.gitignore: -------------------------------------------------------------------------------- 1 | import-boss 2 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/lister-gen/.import-restrictions: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/register-gen/args/args.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package args 18 | 19 | import ( 20 | "fmt" 21 | 22 | "k8s.io/gengo/args" 23 | ) 24 | 25 | // NewDefaults returns default arguments for the generator. 26 | func NewDefaults() *args.GeneratorArgs { 27 | genericArgs := args.Default().WithoutDefaultFlagParsing() 28 | genericArgs.OutputFileBaseName = "zz_generated.register" 29 | return genericArgs 30 | } 31 | 32 | // Validate checks the given arguments. 33 | func Validate(genericArgs *args.GeneratorArgs) error { 34 | if len(genericArgs.OutputFileBaseName) == 0 { 35 | return fmt.Errorf("output file base name cannot be empty") 36 | } 37 | 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/register-gen/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "flag" 21 | "path/filepath" 22 | 23 | "github.com/spf13/pflag" 24 | "k8s.io/klog" 25 | 26 | generatorargs "k8s.io/code-generator/cmd/register-gen/args" 27 | "k8s.io/code-generator/cmd/register-gen/generators" 28 | "k8s.io/code-generator/pkg/util" 29 | "k8s.io/gengo/args" 30 | ) 31 | 32 | func main() { 33 | klog.InitFlags(nil) 34 | genericArgs := generatorargs.NewDefaults() 35 | genericArgs.GoHeaderFilePath = filepath.Join(args.DefaultSourceTree(), util.BoilerplatePath()) 36 | genericArgs.AddFlags(pflag.CommandLine) 37 | flag.Set("logtostderr", "true") 38 | pflag.CommandLine.AddGoFlagSet(flag.CommandLine) 39 | 40 | pflag.Parse() 41 | if err := generatorargs.Validate(genericArgs); err != nil { 42 | klog.Fatalf("Error: %v", err) 43 | } 44 | 45 | if err := genericArgs.Execute( 46 | generators.NameSystems(), 47 | generators.DefaultNameSystem(), 48 | generators.Packages, 49 | ); err != nil { 50 | klog.Fatalf("Error: %v", err) 51 | } 52 | klog.V(2).Info("Completed successfully.") 53 | } 54 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/set-gen/.gitignore: -------------------------------------------------------------------------------- 1 | set-gen 2 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/cmd/set-gen/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // set-gen is an example usage of gengo. 18 | // 19 | // Structs in the input directories with the below line in their comments will 20 | // have sets generated for them. 21 | // // +genset 22 | // 23 | // Any builtin type referenced anywhere in the input directories will have a 24 | // set generated for it. 25 | package main 26 | 27 | import ( 28 | "os" 29 | "path/filepath" 30 | 31 | "k8s.io/code-generator/pkg/util" 32 | "k8s.io/gengo/args" 33 | "k8s.io/gengo/examples/set-gen/generators" 34 | 35 | "k8s.io/klog" 36 | ) 37 | 38 | func main() { 39 | klog.InitFlags(nil) 40 | arguments := args.Default() 41 | 42 | // Override defaults. 43 | arguments.GoHeaderFilePath = filepath.Join(args.DefaultSourceTree(), util.BoilerplatePath()) 44 | arguments.InputDirs = []string{"k8s.io/kubernetes/pkg/util/sets/types"} 45 | arguments.OutputPackagePath = "k8s.io/apimachinery/pkg/util/sets" 46 | 47 | if err := arguments.Execute( 48 | generators.NameSystems(), 49 | generators.DefaultNameSystem(), 50 | generators.Packages, 51 | ); err != nil { 52 | klog.Errorf("Error: %v", err) 53 | os.Exit(1) 54 | } 55 | klog.V(2).Info("Completed successfully.") 56 | } 57 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/code-of-conduct.md: -------------------------------------------------------------------------------- 1 | # Kubernetes Community Code of Conduct 2 | 3 | Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) 4 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/go.mod: -------------------------------------------------------------------------------- 1 | // This is a generated file. Do not edit directly. 2 | 3 | module k8s.io/code-generator 4 | 5 | go 1.13 6 | 7 | require ( 8 | github.com/emicklei/go-restful v2.9.5+incompatible // indirect 9 | github.com/go-openapi/jsonreference v0.19.3 // indirect 10 | github.com/go-openapi/spec v0.19.3 // indirect 11 | github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d 12 | github.com/json-iterator/go v1.1.8 // indirect 13 | github.com/mailru/easyjson v0.7.0 // indirect 14 | github.com/modern-go/reflect2 v1.0.1 // indirect 15 | github.com/spf13/pflag v1.0.5 16 | github.com/stretchr/testify v1.4.0 // indirect 17 | golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 // indirect 18 | golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72 // indirect 19 | gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485 20 | gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e // indirect 21 | gopkg.in/yaml.v2 v2.2.4 // indirect 22 | k8s.io/gengo v0.0.0-20190822140433-26a664648505 23 | k8s.io/klog v1.0.0 24 | k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a 25 | ) 26 | 27 | replace ( 28 | golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13 29 | golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13 30 | ) 31 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/hack/verify-codegen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2017 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | 21 | SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 22 | 23 | DIFFROOT="${SCRIPT_ROOT}/_examples" 24 | TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/_examples" 25 | _tmp="${SCRIPT_ROOT}/_tmp" 26 | 27 | cleanup() { 28 | rm -rf "${_tmp}" 29 | } 30 | trap "cleanup" EXIT SIGINT 31 | 32 | cleanup 33 | 34 | mkdir -p "${TMP_DIFFROOT}" 35 | cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" 36 | 37 | "${SCRIPT_ROOT}/hack/update-codegen.sh" 38 | echo "diffing ${DIFFROOT} against freshly generated codegen" 39 | ret=0 40 | diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? 41 | cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}" 42 | if [[ $ret -eq 0 ]] 43 | then 44 | echo "${DIFFROOT} up to date." 45 | else 46 | echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh" 47 | exit 1 48 | fi 49 | 50 | # smoke test 51 | echo "Smoke testing _example by compiling..." 52 | go build "./${SCRIPT_ROOT}/_examples/crd/..." 53 | go build "./${SCRIPT_ROOT}/_examples/apiserver/..." 54 | go build "./${SCRIPT_ROOT}/_examples/MixedCase/..." 55 | go build "./${SCRIPT_ROOT}/_examples/HyphenGroup/..." 56 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/pkg/util/plural_exceptions.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package util 18 | 19 | import ( 20 | "fmt" 21 | "strings" 22 | ) 23 | 24 | // PluralExceptionListToMapOrDie converts the list in "Type:PluralType" to map[string]string. 25 | // This is used for pluralizer. 26 | // If the format is wrong, this function will panic. 27 | func PluralExceptionListToMapOrDie(pluralExceptions []string) map[string]string { 28 | pluralExceptionMap := make(map[string]string, len(pluralExceptions)) 29 | for i := range pluralExceptions { 30 | parts := strings.Split(pluralExceptions[i], ":") 31 | if len(parts) != 2 { 32 | panic(fmt.Sprintf("invalid plural exception definition: %s", pluralExceptions[i])) 33 | } 34 | pluralExceptionMap[parts[0]] = parts[1] 35 | } 36 | return pluralExceptionMap 37 | } 38 | -------------------------------------------------------------------------------- /code-gen-vendor/k8s.io/code-generator/tools.go: -------------------------------------------------------------------------------- 1 | // +build tools 2 | 3 | /* 4 | Copyright 2019 The Kubernetes Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // This package contains code generation utilities 20 | // This package imports things required by build scripts, to force `go mod` to see them as dependencies 21 | package tools 22 | 23 | import ( 24 | _ "k8s.io/code-generator/cmd/client-gen" 25 | _ "k8s.io/code-generator/cmd/conversion-gen" 26 | _ "k8s.io/code-generator/cmd/deepcopy-gen" 27 | _ "k8s.io/code-generator/cmd/defaulter-gen" 28 | _ "k8s.io/code-generator/cmd/go-to-protobuf" 29 | _ "k8s.io/code-generator/cmd/import-boss" 30 | _ "k8s.io/code-generator/cmd/informer-gen" 31 | _ "k8s.io/code-generator/cmd/lister-gen" 32 | _ "k8s.io/code-generator/cmd/openapi-gen" 33 | _ "k8s.io/code-generator/cmd/register-gen" 34 | _ "k8s.io/code-generator/cmd/set-gen" 35 | ) 36 | -------------------------------------------------------------------------------- /config/webhook/manifests.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oam-dev/oam-go-sdk/d46a6aee5e38c1bfe05f1dbd9fe2361b65af6413/config/webhook/manifests.yaml -------------------------------------------------------------------------------- /doc/concepts.md: -------------------------------------------------------------------------------- 1 | # Concepts 2 | 3 | ## Handler 4 | Handler triggered by components, traits, scopes modify event. 5 | 6 | User can implement Handler and make business logic done in handler and add action to action context, add values to action context. 7 | 8 | ## Action 9 | 10 | Action is "resource" create action. 11 | 12 | ``` 13 | type Action struct { 14 | // plugin do action, e.g: k8s, helm, ... 15 | Provider PType 16 | // action command, e.g: Create, Update 17 | Command CmdType 18 | // action content, for k8s plugin, this is k8s object, for helm plugin, this is helm chart address. 19 | Plan interface{} 20 | } 21 | ``` 22 | 23 | For action Action{Provider: "k8s", Command: "create", Plan: &Deployment{...}}, oam-runtime will create Deployment for you to k8s platform. 24 | 25 | 26 | ## ActionContext 27 | 28 | ActionContext used for store actions and context values. 29 | 30 | For actions need to be processed early, use ctx.AddPre; 31 | 32 | For actions need to be processed late, use ctx.AddPost; 33 | 34 | For normal actions, just use ctx.Add. 35 | 36 | OAM framework will do preActions -> actions -> postActions for you. 37 | -------------------------------------------------------------------------------- /doc/img/handler-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oam-dev/oam-go-sdk/d46a6aee5e38c1bfe05f1dbd9fe2361b65af6413/doc/img/handler-diagram.png -------------------------------------------------------------------------------- /examples/app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: core.oam.dev/v1alpha1 2 | kind: ApplicationConfiguration 3 | metadata: 4 | name: edas-app 5 | spec: 6 | components: 7 | - componentName: stateless-component 8 | instanceName: demo 9 | traits: 10 | - name: manual-scaler 11 | properties: 12 | replicaCount: 2 13 | - name: servicebinding 14 | properties: 15 | servicebindings: 16 | - source: 17 | objectRef: 18 | apiVersion: v1 19 | kind: Secret 20 | name: my-secret 21 | -------------------------------------------------------------------------------- /examples/componentschematics.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: core.oam.dev/v1alpha1 2 | kind: ComponentSchematic 3 | metadata: 4 | name: stateless-component 5 | spec: 6 | workloadType: core.oam.dev/v1alpha1.Server 7 | containers: 8 | - name: server 9 | image: nginx:latest 10 | resources: 11 | cpu: 12 | required: 100m 13 | memory: 14 | required: 128Mi 15 | ports: 16 | - name: http 17 | containerPort: 80 18 | protocol: TCP 19 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/oam-dev/oam-go-sdk 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/go-logr/logr v0.1.0 7 | github.com/onsi/ginkgo v1.10.1 8 | github.com/onsi/gomega v1.7.0 9 | github.com/stretchr/testify v1.4.0 10 | golang.org/x/net v0.0.0-20191004110552-13f9640d40b9 11 | k8s.io/api v0.17.0 12 | k8s.io/apimachinery v0.17.0 13 | k8s.io/client-go v0.17.0 14 | sigs.k8s.io/controller-runtime v0.4.0 15 | sigs.k8s.io/controller-tools v0.2.5 // indirect 16 | ) 17 | -------------------------------------------------------------------------------- /hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ -------------------------------------------------------------------------------- /hack/update-client-gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. 8 | echo ${SCRIPT_ROOT} 9 | CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./code-gen-vendor/k8s.io/code-generator 2>/dev/null || echo ../../../k8s.io/code-generator)} 10 | 11 | # generate the code with: 12 | # --output-base because this script should also be able to run inside the vendor dir of 13 | # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir 14 | # instead of the $GOPATH directly. For normal projects this can be dropped. 15 | ${CODEGEN_PKG}/generate-groups.sh "client,informer,lister" \ 16 | github.com/oam-dev/oam-go-sdk/pkg/client github.com/oam-dev/oam-go-sdk/apis \ 17 | core.oam.dev:v1alpha1 \ 18 | --output-base "$(dirname ${BASH_SOURCE})/../../../.." \ 19 | --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt -------------------------------------------------------------------------------- /oambuilder/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | -------------------------------------------------------------------------------- /oambuilder/Makefile: -------------------------------------------------------------------------------- 1 | 2 | GO111MODULE := on 3 | 4 | all: clean build 5 | 6 | clean: 7 | rm -rf ./bin 8 | 9 | build: 10 | CGO_ENABLED=0 \ 11 | GO111MODULE=$(GO111MODULE) \ 12 | go build -i -v -o ./bin/oambuilder main.go 13 | 14 | -------------------------------------------------------------------------------- /oambuilder/README.md: -------------------------------------------------------------------------------- 1 | # OAM Builder 2 | 3 | OAM Builder generates OAM types and controller code scaffold based on k8s operator generator. It generates OAM (Workload, Trait,Scope) Operators automatically and lets developers focus on buisness logic. 4 | 5 | Prerequisites: 6 | 7 | * [Kubebuilder](https://github.com/kubernetes-sigs/kubebuilder) 8 | 9 | ## Usage 10 | 11 | Install: 12 | 13 | ``` 14 | make 15 | export PATH=$PWD/bin:$PATH 16 | ``` 17 | 18 | Initialize domain: 19 | 20 | ``` 21 | kubebuilder init --domain test 22 | ``` 23 | 24 | Create Workload: 25 | 26 | ``` 27 | oambuilder workload --group demo --version v1 --kind DemoWorkload 28 | ``` 29 | 30 | Create Trait: 31 | 32 | ``` 33 | oambuilder trait --group demo --version v1 --kind DemoTrait 34 | ``` 35 | 36 | Create Exchange: 37 | 38 | ``` 39 | oambuilder exchange --group demo --version v1 --kind DemoExchange 40 | ``` 41 | 42 | -------------------------------------------------------------------------------- /oambuilder/api/v1alpha1/common_types.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | ) 7 | 8 | /// A value that is substituted into a parameter. 9 | type ParameterValue struct { 10 | Name string `json:"name"` 11 | Value string `json:"value"` 12 | } 13 | 14 | /** 15 | Translate []ParameterValue to struct, the struct always should be empty struct pointer. 16 | e.g: Translate(&RollOutParameter{}, p) 17 | */ 18 | func Translate(v interface{}, p []ParameterValue) error { 19 | props := make(map[string]string) 20 | for _, v := range p { 21 | props[v.Name] = v.Value 22 | } 23 | propsJsonBytes, _ := json.Marshal(props) 24 | // init from json bytes. 25 | return json.Unmarshal(propsJsonBytes, v) 26 | } 27 | 28 | /** 29 | Translate struct to []ParameterValue. 30 | */ 31 | func TranslateReverse(v interface{}) []ParameterValue { 32 | propsJsonBytes, _ := json.Marshal(v) 33 | kvs := make(map[string]string) 34 | if err := json.Unmarshal(propsJsonBytes, &kvs); err != nil { 35 | fmt.Println("reverse translate error", err) 36 | } 37 | 38 | var pvs []ParameterValue 39 | 40 | for k, v := range kvs { 41 | pvs = append(pvs, ParameterValue{Name: k, Value: v}) 42 | } 43 | return pvs 44 | } 45 | -------------------------------------------------------------------------------- /oambuilder/api/v1alpha1/common_types_test.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | -------------------------------------------------------------------------------- /oambuilder/api/v1alpha1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | 16 | // Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group 17 | // +kubebuilder:object:generate=true 18 | // +groupName=core.oam.dev 19 | package v1alpha1 20 | 21 | import ( 22 | "k8s.io/apimachinery/pkg/runtime/schema" 23 | "sigs.k8s.io/controller-runtime/pkg/scheme" 24 | ) 25 | 26 | const ( 27 | Group = "core.oam.dev" 28 | Version = "v1alpha1" 29 | Separator = "/" 30 | ) 31 | 32 | var ( 33 | // GroupVersion is group version used to register these objects 34 | GroupVersion = schema.GroupVersion{Group: Group, Version: Version} 35 | 36 | // schemeBuilder is used to add go types to the GroupVersionKind scheme 37 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 38 | 39 | // AddToScheme adds the types in this group-version to the given scheme. 40 | AddToScheme = SchemeBuilder.AddToScheme 41 | ) 42 | -------------------------------------------------------------------------------- /oambuilder/api/v1alpha1/ii_test.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "encoding/json" 5 | "log" 6 | "testing" 7 | ) 8 | 9 | var a = ` 10 | { 11 | "name": "xxx", 12 | "name1": ["1", "2"] 13 | } 14 | 15 | ` 16 | 17 | func TestInter(t *testing.T) { 18 | var aa = map[string]InterfaceStruct{} 19 | json.Unmarshal([]byte(a), &aa) 20 | bts, _ := json.Marshal(&aa) 21 | log.Print(string(bts)) 22 | 23 | } 24 | -------------------------------------------------------------------------------- /oambuilder/api/v1alpha1/interfacetype.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | type InterfaceParam struct { 4 | Name string `json:"name"` 5 | Val *InterfaceStruct `json:"value"` 6 | } 7 | 8 | type InterfaceStruct struct { 9 | val []byte `json:"-"` 10 | } 11 | 12 | func (inter *InterfaceStruct) Real() []byte { 13 | return inter.val 14 | } 15 | 16 | // UnmarshalJSON implements the json.Unmarshaller interface. 17 | func (inter *InterfaceStruct) UnmarshalJSON(value []byte) error { 18 | inter.val = value 19 | return nil 20 | } 21 | 22 | // MarshalJSON implements the json.Marshaller interface. 23 | func (inter *InterfaceStruct) MarshalJSON() ([]byte, error) { 24 | return inter.val, nil 25 | } 26 | 27 | func (InterfaceStruct) OpenAPISchemaType() []string { 28 | return []string{"string", "array", "object", "int"} 29 | } 30 | func (InterfaceStruct) OpenAPISchemaFormat() []string { 31 | return []string{"interface-struct"} 32 | } 33 | -------------------------------------------------------------------------------- /oambuilder/api/v1alpha1/scope_types.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 4 | 5 | type ApplicationScopeSpec struct { 6 | Type string `json:"type"` 7 | AllowComponentOverlap bool `json:"allowComponentOverlap"` 8 | Parameters []Parameter `json:"parameters"` 9 | } 10 | 11 | type ApplicationScopeStatus struct { 12 | } 13 | 14 | // +genclient 15 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 16 | type ApplicationScope struct { 17 | metav1.TypeMeta `json:",inline"` 18 | metav1.ObjectMeta `json:"metadata,omitempty"` 19 | 20 | Spec ApplicationScopeSpec `json:"spec,omitempty"` 21 | Status ApplicationScopeStatus `json:"status,omitempty"` 22 | } 23 | 24 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 25 | type ApplicationScopeList struct { 26 | metav1.TypeMeta `json:",inline"` 27 | metav1.ListMeta `json:"metadata,omitempty"` 28 | Items []ApplicationScope `json:"items"` 29 | } 30 | 31 | func init() { 32 | SchemeBuilder.Register(&ApplicationScope{}, &ApplicationScopeList{}) 33 | } 34 | -------------------------------------------------------------------------------- /oambuilder/cmd/context.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "os" 5 | "path/filepath" 6 | 7 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/generator" 8 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/types" 9 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/types/project" 10 | ) 11 | 12 | type Context struct { 13 | Wd string 14 | } 15 | 16 | func Getwd() (*Context, error) { 17 | wd, err := os.Getwd() 18 | if err != nil { 19 | return nil, err 20 | } 21 | return &Context{ 22 | Wd: wd, 23 | }, nil 24 | } 25 | 26 | func (ctx *Context) GetGenerator() (generator.Generator, error) { 27 | g, err := generator.Engine().Generator(ctx.Wd) 28 | return g, err 29 | } 30 | 31 | func (ctx *Context) UpdateProject(g generator.Generator, ty types.ResourceType) error { 32 | pp, err := g.PartialProject() 33 | if err != nil { 34 | return err 35 | } 36 | return project.UpdateProject(filepath.Join(ctx.Wd, project.PROJECT), pp, ty) 37 | } 38 | -------------------------------------------------------------------------------- /oambuilder/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/oam-dev/oam-go-sdk/oambuilder 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/go-logr/logr v0.1.0 7 | github.com/gobuffalo/flect v0.2.0 8 | github.com/juju/errors v0.0.0-20190930114154-d42613fe1ab9 9 | github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 // indirect 10 | github.com/juju/testing v0.0.0-20191001232224-ce9dec17d28b // indirect 11 | github.com/onsi/ginkgo v1.10.3 12 | github.com/onsi/gomega v1.7.1 13 | github.com/spf13/cobra v0.0.5 14 | github.com/spf13/pflag v1.0.5 15 | golang.org/x/net v0.0.0-20191204025024-5ee1b9f4859a 16 | golang.org/x/tools v0.0.0-20190920225731-5eefd052ad72 17 | gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect 18 | k8s.io/api v0.17.0 19 | k8s.io/apiextensions-apiserver v0.17.0 20 | k8s.io/apimachinery v0.17.0 21 | k8s.io/client-go v0.17.0 22 | sigs.k8s.io/controller-runtime v0.4.0 23 | sigs.k8s.io/controller-tools v0.2.5 24 | sigs.k8s.io/kubebuilder v1.0.9-0.20191119230719-0824a139f59e 25 | sigs.k8s.io/yaml v1.1.0 26 | ) 27 | -------------------------------------------------------------------------------- /oambuilder/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/spf13/cobra" 7 | "github.com/oam-dev/oam-go-sdk/oambuilder/cmd/exchange" 8 | "github.com/oam-dev/oam-go-sdk/oambuilder/cmd/trait" 9 | "github.com/oam-dev/oam-go-sdk/oambuilder/cmd/workload" 10 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/generator/kubebuilder/crgen" 11 | ctrl "sigs.k8s.io/controller-runtime" 12 | "sigs.k8s.io/controller-runtime/pkg/log/zap" 13 | ) 14 | 15 | var ( 16 | logger = ctrl.Log.WithName("oambuilder.main") 17 | ) 18 | 19 | var builder = &cobra.Command{ 20 | Use: "oambuilder", 21 | Short: "code generator for oam style operator", 22 | Long: "code generator for oam style operator", 23 | } 24 | 25 | func init() { 26 | builder.AddCommand(workload.Workload) 27 | builder.AddCommand(trait.Trait) 28 | builder.AddCommand(exchange.Exchange) 29 | builder.AddCommand(crgen.CRGen) 30 | } 31 | 32 | func main() { 33 | ctrl.SetLogger(zap.New(func(o *zap.Options) { 34 | o.Development = true 35 | })) 36 | if err := builder.Execute(); err != nil { 37 | logger.Error(err, "cmd execute error") 38 | os.Exit(1) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /oambuilder/pkg/generator/generator.go: -------------------------------------------------------------------------------- 1 | package generator 2 | 3 | import ( 4 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/generator/kubebuilder" 5 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/types" 6 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/types/project" 7 | ) 8 | 9 | type Generator interface { 10 | Detect(path string) (bool, error) 11 | Execute(args []string) error 12 | AttachTemplate(tmpl string, ty types.TemplateType) error 13 | PartialProject() (*project.PartialProject, error) 14 | } 15 | 16 | type generatorEngine struct { 17 | handlers []Generator 18 | } 19 | 20 | var engine = &generatorEngine{ 21 | handlers: []Generator{ 22 | kubebuilder.Builder(), 23 | }, 24 | } 25 | 26 | func Engine() *generatorEngine { 27 | return engine 28 | } 29 | 30 | func (e *generatorEngine) Generator(path string) (g Generator, err error) { 31 | var ok bool 32 | for _, h := range e.handlers { 33 | if ok, err = h.Detect(path); ok && err == nil { 34 | g = h 35 | break 36 | } 37 | } 38 | if g == nil { 39 | err = types.Error_FailedToFindGenerator 40 | } 41 | return g, err 42 | } 43 | -------------------------------------------------------------------------------- /oambuilder/pkg/generator/kubebuilder/crgen/cmd.go: -------------------------------------------------------------------------------- 1 | package crgen 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/spf13/cobra" 7 | ctrl "sigs.k8s.io/controller-runtime" 8 | ) 9 | 10 | var ( 11 | logger = ctrl.Log.WithName("oambuilder.crgen") 12 | gen = &Generator{} 13 | ) 14 | 15 | func init() { 16 | CRGen.Flags().StringVarP(&gen.OAM, "oam", "a", "./OAM", "Work dir of an OAM Styled Operator Project.") 17 | CRGen.Flags().StringVarP(&gen.Path, "path", "p", "./...", "Work dir of an OAM Styled Operator Project.") 18 | CRGen.Flags().StringVarP(&gen.Output, "output", "o", "", "The output dir stores the cr yamls.") 19 | CRGen.ParseFlags(os.Args) 20 | } 21 | 22 | var CRGen = &cobra.Command{ 23 | Use: "crgen", 24 | Short: "Handler for generate CR yaml for oam.workloadtype or oam.trait for kubebuilder", 25 | Long: "Handler for generate CR yaml for oam.workloadtype or oam.trait for kubebuilder", 26 | Run: func(cmd *cobra.Command, args []string) { 27 | if err := gen.Run(); err != nil { 28 | logger.Error(err, "gen.Run") 29 | os.Exit(1) 30 | } 31 | }, 32 | } 33 | -------------------------------------------------------------------------------- /oambuilder/pkg/generator/kubebuilder/plugin.go: -------------------------------------------------------------------------------- 1 | package kubebuilder 2 | 3 | import ( 4 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/types" 5 | "sigs.k8s.io/kubebuilder/pkg/model" 6 | ) 7 | 8 | type Plugin struct { 9 | tmpls map[types.TemplateType]*tmpl 10 | } 11 | 12 | func (p *Plugin) Pipe(u *model.Universe) error { 13 | for _, t := range p.tmpls { 14 | if err := t.Pipe(u); err != nil { 15 | return err 16 | } 17 | } 18 | return nil 19 | } 20 | 21 | func (p *Plugin) Attach(ty types.TemplateType, t *tmpl) { 22 | p.tmpls[ty] = t 23 | } 24 | -------------------------------------------------------------------------------- /oambuilder/pkg/runtime/scheme.go: -------------------------------------------------------------------------------- 1 | package runtime 2 | 3 | import ( 4 | "k8s.io/apimachinery/pkg/runtime" 5 | "sigs.k8s.io/controller-runtime/pkg/scheme" 6 | ) 7 | 8 | var ( 9 | builders []*scheme.Builder 10 | ) 11 | 12 | func AddToScheme(scheme *runtime.Scheme) *runtime.Scheme { 13 | for _, b := range builders { 14 | b.AddToScheme(scheme) 15 | } 16 | return scheme 17 | } 18 | 19 | func Register(builder *scheme.Builder) { 20 | builders = append(builders, builder) 21 | } 22 | -------------------------------------------------------------------------------- /oambuilder/pkg/runtime/types.go: -------------------------------------------------------------------------------- 1 | package runtime 2 | 3 | import ( 4 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/types/trait" 5 | "github.com/oam-dev/oam-go-sdk/oambuilder/pkg/types/workload" 6 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 7 | "k8s.io/apimachinery/pkg/runtime" 8 | "sigs.k8s.io/controller-runtime/pkg/client" 9 | ) 10 | 11 | type dynamicWorkload struct { 12 | metav1.TypeMeta `json:",inline"` 13 | metav1.ObjectMeta `json:"metadata"` 14 | Spec dynamicWorkloadSpec `json:"spec"` 15 | } 16 | 17 | type dynamicWorkloadSpec struct { 18 | Settings map[string]interface{} `json:"settings,omitempty"` 19 | Traits []workload.Trait `json:"traits,omitempty"` 20 | } 21 | 22 | type dynamicTrait struct { 23 | metav1.TypeMeta `json:",inline"` 24 | metav1.ObjectMeta `json:"metadata"` 25 | Spec dynamicTraitSpec `json:"spec"` 26 | } 27 | 28 | type dynamicTraitSpec struct { 29 | Settings map[string]interface{} `json:"settings,omitempty"` 30 | Workload trait.WorkloadReference `json:"workload"` 31 | } 32 | 33 | type dynamicTraitList struct { 34 | metav1.TypeMeta `json:",inline"` 35 | metav1.ObjectMeta `json:"metadata"` 36 | Items []dynamicTrait `json:"items"` 37 | } 38 | 39 | // TraitExchanger for trait 40 | type TraitExchanger interface { 41 | Resources(cli client.Client, self runtime.Object, exchangeListResource runtime.Object) error 42 | Create(cli client.Client, self runtime.Object, exchangeResource runtime.Object) error 43 | Delete(cli client.Client, self runtime.Object, exchangeResource runtime.Object) error 44 | } 45 | 46 | // WorkloadExchanger for workload 47 | type WorkloadExchanger interface { 48 | Resources(cli client.Client, self runtime.Object, exchangeListResource runtime.Object) error 49 | AllExchangerReady(cli client.Client, self runtime.Object) (bool, error) 50 | } 51 | -------------------------------------------------------------------------------- /oambuilder/pkg/types/errors.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | type Error string 4 | 5 | func (e Error) Error() string { 6 | return string(e) 7 | } 8 | 9 | const ( 10 | Error_PartialWrite = Error("Failed to write all data to file.") 11 | ) 12 | 13 | // generator 14 | const ( 15 | Error_NeedExecuteFirst = Error("You should run generator.Execute first") 16 | Error_FailedToFindGenerator = Error("Can not detect an generator handler.") 17 | ) 18 | 19 | // generator.kubebuilder 20 | const ( 21 | Error_OnlySupportScaffoldV2 = Error("We support scaffold v2 for kubebuilder only.") 22 | ) 23 | 24 | // project 25 | const ( 26 | Error_VDRMismatch = Error("Generated Version/Domain/Repo set is not match with OAM") 27 | ) 28 | 29 | // generator.kubebuilder.crgen 30 | const ( 31 | Error_NeedOAM = Error("path for file 'OAM' is required.") 32 | Error_NeedPath = Error("path is required.") 33 | Error_NeedOutput = Error("output is required.") 34 | Error_InvalidParameterType = Error("invalid parameter type(boolean, string, number, null)") 35 | ) 36 | -------------------------------------------------------------------------------- /oambuilder/pkg/types/trait/specs.go: -------------------------------------------------------------------------------- 1 | package trait 2 | 3 | import ( 4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | type WorkloadReference struct { 8 | metav1.OwnerReference `json:",inline"` 9 | Namespace string `json:"namespace"` 10 | } 11 | 12 | func (in *WorkloadReference) DeepCopyInto(out *WorkloadReference) { 13 | *out = *in 14 | if in.Controller != nil { 15 | in, out := &in.Controller, &out.Controller 16 | *out = new(bool) 17 | **out = **in 18 | } 19 | if in.BlockOwnerDeletion != nil { 20 | in, out := &in.BlockOwnerDeletion, &out.BlockOwnerDeletion 21 | *out = new(bool) 22 | **out = **in 23 | } 24 | return 25 | } 26 | 27 | func (in *WorkloadReference) DeepCopy() *WorkloadReference { 28 | if in == nil { 29 | return nil 30 | } 31 | out := new(WorkloadReference) 32 | in.DeepCopyInto(out) 33 | return out 34 | } 35 | -------------------------------------------------------------------------------- /oambuilder/pkg/types/types.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import "k8s.io/apimachinery/pkg/runtime" 4 | 5 | type GroupVersionKind struct { 6 | Group string 7 | Version string 8 | Kind string 9 | } 10 | 11 | func (gvk GroupVersionKind) IsSame(ggvk GroupVersionKind) bool { 12 | return gvk.Group == ggvk.Group && gvk.Version == ggvk.Version && gvk.Kind == ggvk.Kind 13 | } 14 | 15 | type TemplateType string 16 | 17 | func (t TemplateType) String() string { 18 | return string(t) 19 | } 20 | 21 | const ( 22 | TemplateType_Type = "type" 23 | TemplateType_GVInfo = "groupversion_info" 24 | TemplateType_Controller = "controller" 25 | TemplateType_Main = "main" 26 | TemplateType_Makefile = "makefile" 27 | ) 28 | 29 | type ResourceType string 30 | 31 | const ( 32 | ResourceType_Workload = "workload" 33 | ResourceType_Trait = "trait" 34 | ResourceType_Exchange = "exchange" 35 | ) 36 | 37 | type ExchangeGetter interface { 38 | runtime.Object 39 | GetExchange() []runtime.Object 40 | } 41 | -------------------------------------------------------------------------------- /oambuilder/pkg/types/variables.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | const ( 4 | LABEL_OAM_UUID = "OAM_UUID" 5 | LABEL_OAM_GENERATION = "OAM_GENERATION" 6 | LABEL_OAM_WORKLOAD = "OAM_WORKLOAD" 7 | ) 8 | 9 | type WorkloadUIDGetter interface { 10 | WorkloadUID() string 11 | } 12 | -------------------------------------------------------------------------------- /oambuilder/pkg/types/workload/specs.go: -------------------------------------------------------------------------------- 1 | package workload 2 | 3 | type Trait struct { 4 | Name string `json:"name"` 5 | Init bool `json:"init,omitempty"` 6 | } 7 | 8 | func (in *Trait) DeepCopyInto(out *Trait) { 9 | *out = *in 10 | return 11 | } 12 | 13 | func (in *Trait) DeepCopy() *Trait { 14 | if in == nil { 15 | return nil 16 | } 17 | out := new(Trait) 18 | in.DeepCopyInto(out) 19 | return out 20 | } 21 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | // Code generated by client-gen. DO NOT EDIT. 16 | 17 | // This package has the automatically generated clientset. 18 | package versioned 19 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | // Code generated by client-gen. DO NOT EDIT. 16 | 17 | // This package has the automatically generated fake clientset. 18 | package fake 19 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | // Code generated by client-gen. DO NOT EDIT. 16 | 17 | // This package contains the scheme of the automatically generated clientset. 18 | package scheme 19 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/core.oam.dev/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | // Code generated by client-gen. DO NOT EDIT. 16 | 17 | // This package has the automatically generated typed clients. 18 | package v1alpha1 19 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/core.oam.dev/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | // Code generated by client-gen. DO NOT EDIT. 16 | 17 | // Package fake has the automatically generated clients. 18 | package fake 19 | -------------------------------------------------------------------------------- /pkg/client/clientset/versioned/typed/core.oam.dev/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | // Code generated by client-gen. DO NOT EDIT. 16 | 17 | package v1alpha1 18 | 19 | type ApplicationConfigurationExpansion interface{} 20 | 21 | type ApplicationScopeExpansion interface{} 22 | 23 | type ComponentSchematicExpansion interface{} 24 | 25 | type TraitExpansion interface{} 26 | -------------------------------------------------------------------------------- /pkg/client/informers/externalversions/core.oam.dev/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | // Code generated by informer-gen. DO NOT EDIT. 16 | 17 | package core 18 | 19 | import ( 20 | v1alpha1 "github.com/oam-dev/oam-go-sdk/pkg/client/informers/externalversions/core.oam.dev/v1alpha1" 21 | internalinterfaces "github.com/oam-dev/oam-go-sdk/pkg/client/informers/externalversions/internalinterfaces" 22 | ) 23 | 24 | // Interface provides access to each of this group's versions. 25 | type Interface interface { 26 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 27 | V1alpha1() v1alpha1.Interface 28 | } 29 | 30 | type group struct { 31 | factory internalinterfaces.SharedInformerFactory 32 | namespace string 33 | tweakListOptions internalinterfaces.TweakListOptionsFunc 34 | } 35 | 36 | // New returns a new Interface. 37 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 38 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 39 | } 40 | 41 | // V1alpha1 returns a new v1alpha1.Interface. 42 | func (g *group) V1alpha1() v1alpha1.Interface { 43 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 44 | } 45 | -------------------------------------------------------------------------------- /pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | // Code generated by informer-gen. DO NOT EDIT. 16 | 17 | package internalinterfaces 18 | 19 | import ( 20 | time "time" 21 | 22 | versioned "github.com/oam-dev/oam-go-sdk/pkg/client/clientset/versioned" 23 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 24 | runtime "k8s.io/apimachinery/pkg/runtime" 25 | cache "k8s.io/client-go/tools/cache" 26 | ) 27 | 28 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 29 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 30 | 31 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 32 | type SharedInformerFactory interface { 33 | Start(stopCh <-chan struct{}) 34 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 35 | } 36 | 37 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 38 | type TweakListOptionsFunc func(*v1.ListOptions) 39 | -------------------------------------------------------------------------------- /pkg/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | // OpCode 4 | const ( 5 | CreateOrUpdateOpCode = 0 6 | DeleteOpCode = 1 7 | ) 8 | -------------------------------------------------------------------------------- /pkg/examples/extendworkload/README.md: -------------------------------------------------------------------------------- 1 | # Component Example 2 | 3 | ## Install 4 | 5 | 1. install all crd files by `make install` 6 | 2. `go run pkg/examples/extendworkload/main.go` 7 | 8 | ## Apply 9 | 10 | 11 | When we install `component.yaml`, we will get such output: 12 | 13 | ```shell script 14 | 2019-12-23T16:12:31.720+0800 INFO setup hello oam from pre hook: comp 15 | settings: {"Description":"xxx","Protocol":"Example","Type":"Performance"} 16 | Description: xxx 17 | Protocol: Example 18 | Type: Performance 19 | ``` 20 | 21 | Raw json data is stored in `component.Spec.WorkloadSettings.Raw`. In fact you could get the real type. 22 | 23 | You could see our workloadType in `pkg/examples/extendworkload/workloadtype.yaml`, our schema is: 24 | 25 | ``` 26 | { 27 | "$schema":"http://json-schema.org/draft-07/schema#", 28 | "type":"object", 29 | "description":"", 30 | "required":[ 31 | "Protocol" 32 | ], 33 | "properties":{ 34 | "Protocol":{ 35 | "type":"string", 36 | "description":"" 37 | }, 38 | "Type":{ 39 | "type":"string", 40 | "description":"" 41 | }, 42 | "Description":{ 43 | "type":"string", 44 | "description":"" 45 | } 46 | } 47 | } 48 | ``` 49 | 50 | So we could use `map[string]interface{}` to parse our output, so we could get more concrete data struct. 51 | 52 | 53 | ## New CRD 54 | 55 | ### install new CRD 56 | 57 | ```shell script 58 | kubectl apply -f pkg/examples/extendworkload/new-crd.yaml 59 | ``` 60 | 61 | ### Run demo with new CRD 62 | 63 | ```shell script 64 | go run main.go --new-crd=true 65 | ``` 66 | 67 | ## Apply app in new crd 68 | 69 | ```shell script 70 | kubectl apply -f pkg/examples/extendworkload/app-new-crd.yaml 71 | ``` -------------------------------------------------------------------------------- /pkg/examples/extendworkload/app-new-crd.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: ros.alibaba.com/v1alpha1 2 | kind: ApplicationConfiguration 3 | metadata: 4 | name: example-app 5 | spec: 6 | components: 7 | - componentName: example-workload 8 | instanceName: demo 9 | parameterValues: 10 | - name: Type 11 | value: demo -------------------------------------------------------------------------------- /pkg/examples/extendworkload/app.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: core.oam.dev/v1alpha1 2 | kind: ApplicationConfiguration 3 | metadata: 4 | name: example-app 5 | spec: 6 | components: 7 | - componentName: example-workload 8 | instanceName: demo 9 | parameterValues: 10 | - name: Type 11 | value: demo -------------------------------------------------------------------------------- /pkg/examples/extendworkload/component.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: core.oam.dev/v1alpha1 2 | kind: ComponentSchematic 3 | metadata: 4 | name: example-workload 5 | annotations: 6 | version: v1.0.0 7 | description: > 8 | component schematic that describes extended workload. 9 | spec: 10 | workloadType: example.com/v1alpha1.ExtentionWorkload 11 | workloadSettings: 12 | Protocol: Example 13 | Type: "[fromParam(Type)]" 14 | -------------------------------------------------------------------------------- /pkg/examples/extendworkload/workloadtype.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: oam.dev/v1alpha1 2 | kind: WorkloadType 3 | metadata: 4 | name: extended-workload 5 | spec: 6 | group: example.com 7 | version: v1alpha1 8 | names: 9 | kind: ExtentionWorkload 10 | workloadSettings: | 11 | { 12 | "$schema":"http://json-schema.org/draft-07/schema#", 13 | "type":"object", 14 | "description":"", 15 | "required":[ 16 | "Protocol" 17 | ], 18 | "properties":{ 19 | "Protocol":{ 20 | "type":"string", 21 | "description":"" 22 | }, 23 | "Type":{ 24 | "type":"string", 25 | "description":"" 26 | }, 27 | "Description":{ 28 | "type":"string", 29 | "description":"" 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /pkg/finalizer/finalizer.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2018 The Kubernetes Authors 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | package finalizer 15 | 16 | import ( 17 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 18 | ) 19 | 20 | // Add adds the finalizer string 21 | func Add(o metav1.Object, new string) { 22 | exists := false 23 | existing := o.GetFinalizers() 24 | for _, f := range existing { 25 | if f == new { 26 | exists = true 27 | break 28 | } 29 | } 30 | if !exists { 31 | existing = append(existing, new) 32 | o.SetFinalizers(existing) 33 | } 34 | } 35 | 36 | // Remove removes the finalizer string 37 | func Remove(o metav1.Object, new string) { 38 | foundat := -1 39 | existing := o.GetFinalizers() 40 | for i, f := range existing { 41 | if f == new { 42 | foundat = i 43 | break 44 | } 45 | } 46 | if foundat != -1 { 47 | existing[foundat] = existing[len(existing)-1] 48 | o.SetFinalizers(existing[:len(existing)-1]) 49 | } 50 | } 51 | 52 | // Check exists 53 | func Contains(o metav1.Object, new string) bool { 54 | exists := false 55 | existing := o.GetFinalizers() 56 | for _, f := range existing { 57 | if f == new { 58 | exists = true 59 | break 60 | } 61 | } 62 | return exists 63 | } 64 | -------------------------------------------------------------------------------- /pkg/oam/context.go: -------------------------------------------------------------------------------- 1 | package oam 2 | 3 | type ActionContext struct { 4 | PreActions []Action 5 | Actions []Action 6 | PostActions []Action 7 | Values map[string]interface{} 8 | } 9 | 10 | // add actions executed before actions added through Add method 11 | func (o *ActionContext) AddPre(a ...Action) { 12 | o.PreActions = append(o.PreActions, a...) 13 | } 14 | 15 | // add actions executed before actions added through AddPost method 16 | func (o *ActionContext) Add(a ...Action) { 17 | o.Actions = append(o.Actions, a...) 18 | } 19 | 20 | func (o *ActionContext) AddPost(a ...Action) { 21 | o.PostActions = append(o.PostActions, a...) 22 | } 23 | 24 | func (o *ActionContext) AddValue(k string, v interface{}) { 25 | if o.Values == nil { 26 | o.Values = map[string]interface{}{} 27 | } 28 | o.Values[k] = v 29 | } 30 | 31 | func (o *ActionContext) GetValue(k string) interface{} { 32 | if o.Values == nil { 33 | return nil 34 | } 35 | return o.Values[k] 36 | } 37 | 38 | // clear and gather all actions according to action order. 39 | func (o *ActionContext) Gather() []Action { 40 | var actions []Action 41 | actions = append(actions, o.PreActions...) 42 | o.PreActions = nil 43 | actions = append(actions, o.Actions...) 44 | o.Actions = nil 45 | actions = append(actions, o.PostActions...) 46 | o.PostActions = nil 47 | return actions 48 | } 49 | -------------------------------------------------------------------------------- /pkg/util/specequal_test.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "github.com/stretchr/testify/require" 5 | v1 "k8s.io/api/apps/v1" 6 | corev1 "k8s.io/api/core/v1" 7 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 8 | "testing" 9 | ) 10 | 11 | func TestSpecEqual(t *testing.T) { 12 | spec := v1.DeploymentSpec{ 13 | Template: corev1.PodTemplateSpec{ 14 | Spec: corev1.PodSpec{ 15 | Containers: []corev1.Container{{ 16 | Name: "test", 17 | Image: "test/test", 18 | }}, 19 | }, 20 | }, 21 | } 22 | deployment := &v1.Deployment{ 23 | ObjectMeta: metav1.ObjectMeta{ 24 | Name: "test", 25 | }, 26 | } 27 | eq := SpecEqual(deployment, spec, true) 28 | require.False(t, eq) 29 | eq = SpecEqual(deployment, spec, true) 30 | spec.Template.Spec.Containers[0].Name = "new-test" 31 | eq = SpecEqual(deployment, spec, true) 32 | require.False(t, eq) 33 | eq = SpecEqual(deployment, spec, true) 34 | require.True(t, eq) 35 | } 36 | --------------------------------------------------------------------------------