Skip to content

Experimental code generators for Crossplane controllers.

License

Notifications You must be signed in to change notification settings

negz/crossplane-tools

 
 

Repository files navigation

crossplane-tools Godoc

Experimental code generators for Crossplane controllers.

angryjet is the only extant tool within crossplane-tools. It will detect Go structs that appear to be capable of satisfying crossplane-runtime's interfaces (such as resource.Managed) and automatically generate the method set required to satisfy that interface. A struct is considered capable of satisfying crossplane-runtime's interfaces based on the heuristics described in the Crossplane Services Developer Guide, for example a managed resource must:

  • Embed a ResourceStatus struct in their Status struct.
  • Embed a ResourceSpec struct in their Spec struct.
  • Embed a Parameters struct in their Spec struct.

Methods are not written if they are already defined outside of the file that would be generated. Use the //+crossplane:generate:methods=false comment marker to explicitly disable generation of any methods for a type. Use go generate to generate your Crossplane API types by adding a generate marker to the top level of your api/ directory, for example:

// Generate crossplane-runtime methodsets (resource.Claim, etc)
//go:generate go run ../vendor/github.com/crossplane/crossplane-tools/cmd/angryjet/main.go generate-methodsets ./...
$ angryjet generate-methodsets --help
usage: angryjet generate-methodsets [<flags>] [<packages>]

Generate a Crossplane method sets.

Flags:
  --help                     Show context-sensitive help (also try --help-long and --help-man).
  --header-file=HEADER-FILE  The contents of this file will be added to the top of all generated files.
  --filename-managed="zz_generated.managed.go"  
                             The filename of generated managed resource files.
  --filename-claim="zz_generated.claim.go"  
                             The filename of generated resource claim files.
  --filename-portable-class="zz_generated.portableclass.go"  
                             The filename of generated portable class files.
  --filename-portable-class-list="zz_generated.portableclasslist.go"  
                             The filename of generated portable class list files.
  --filename-non-portable-class="zz_generated.nonportableclass.go"  
                             The filename of generated non-portable class files.

Args:
  [<packages>]  Package(s) for which to generate methods, for example github.com/crossplane/crossplane/apis/...

About

Experimental code generators for Crossplane controllers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 95.0%
  • Makefile 5.0%