-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugin model; --pattern=addon flag that generates an addon operator
We implement the initial plugin model, starting with an in-process implementation that can support out-of-process later. As plugins do not yet form part of the stable interface for kubebuilder, we only enable them when the KUBEBUILDER_ENABLE_PLUGINS env var is set. We implement an initial plugin for addons: `--pattern=addon` creates a controller & resource that follow the style of https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern This style of declarative addon operators is being investigated in the cluster-addons subject, with code at https://github.com/kubernetes-sigs/addon-operators
- Loading branch information
Showing
23 changed files
with
648 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package model | ||
|
||
import ( | ||
"sigs.k8s.io/kubebuilder/pkg/scaffold/input" | ||
) | ||
|
||
// Universe describes the entire state of file generation | ||
type Universe struct { | ||
Boilerplate string `json:"boilerplate,omitempty"` | ||
|
||
Resource *Resource `json:"resource,omitempty"` | ||
|
||
Files []*File `json:"files,omitempty"` | ||
} | ||
|
||
// Resource describes the resource currently being generated | ||
// TODO: Just use the resource type? | ||
type Resource struct { | ||
// Namespaced is true if the resource is namespaced | ||
Namespaced bool `json:"namespaces,omitempty"` | ||
|
||
// Group is the API Group. Does not contain the domain. | ||
Group string `json:"group,omitempty"` | ||
|
||
// Version is the API version - e.g. v1beta1 | ||
Version string `json:"version,omitempty"` | ||
|
||
// Kind is the API Kind. | ||
Kind string `json:"kind,omitempty"` | ||
|
||
// Plural is the plural lowercase of Kind. | ||
Plural string `json:"plural,omitempty"` | ||
|
||
// Resource is the API Resource. | ||
Resource string `json:"resource,omitempty"` | ||
|
||
// ResourcePackage is the go package of the Resource | ||
GoPackage string `json:"goPackage,omitempty"` | ||
|
||
// GroupDomain is the Group + "." + Domain for the Resource | ||
GroupDomain string `json:"groupDomain,omitempty"` | ||
} | ||
|
||
// File describes a file that will be written | ||
type File struct { | ||
// Path is the file to write | ||
Path string `json:"path,omitempty"` | ||
|
||
// Contents is the generated output | ||
Contents string `json:"contents,omitempty"` | ||
|
||
// TODO: Move input.IfExistsAction into model | ||
// IfExistsAction determines what to do if the file exists | ||
IfExistsAction input.IfExistsAction `json:"ifExistsAction,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.