Documentation ¶
Overview ¶
Create Kubernetes CRD Operators using CDK8s Constructs
Index ¶
- func NewOperator_Override(o Operator, props *OperatorProps)
- func NewServer_Override(s Server, props *ServerProps)
- func Operator_IsConstruct(x interface{}) *bool
- func Operator_Of(c constructs.IConstruct) cdk8s.App
- type CustomResourceProvider
- type ICustomResourceProviderHandler
- type Operator
- type OperatorProps
- type Server
- type ServerProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewOperator_Override ¶
func NewOperator_Override(o Operator, props *OperatorProps)
func NewServer_Override ¶
func NewServer_Override(s Server, props *ServerProps)
func Operator_IsConstruct ¶
func Operator_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func Operator_Of ¶ added in v0.1.259
func Operator_Of(c constructs.IConstruct) cdk8s.App
Types ¶
type CustomResourceProvider ¶
type CustomResourceProvider struct { // API version of the custom resource. // Default: "v1". // ApiVersion *string `field:"required" json:"apiVersion" yaml:"apiVersion"` // The construct handler. Handler ICustomResourceProviderHandler `field:"required" json:"handler" yaml:"handler"` // Kind of this custom resource. Kind *string `field:"required" json:"kind" yaml:"kind"` }
type ICustomResourceProviderHandler ¶
type ICustomResourceProviderHandler interface {
Apply(scope constructs.Construct, id *string, spec interface{}) constructs.Construct
}
The handler for this custom resource provider.
type Operator ¶
type Operator interface { cdk8s.App // Returns all the charts in this app, sorted topologically. Charts() *[]cdk8s.Chart // The tree node. Node() constructs.Node // The output directory into which manifests will be synthesized. Outdir() *string // The file extension to use for rendered YAML files. // Default: .k8s.yaml // OutputFileExtension() *string // Resolvers used by this app. // // This includes both custom resolvers // passed by the `resolvers` property, as well as built-in resolvers. Resolvers() *[]cdk8s.IResolver // How to divide the YAML output into files. // Default: YamlOutputType.FILE_PER_CHART // YamlOutputType() cdk8s.YamlOutputType // Adds a custom resource provider to this operator. AddProvider(provider *CustomResourceProvider) // Reads a Kubernetes manifest in JSON format from STDIN or the file specified as the first positional command-line argument. // // This manifest is expected to // include a single Kubernetes resource. Then, we match `apiVersion` and // `kind` to one of the registered providers and if we do, we invoke // `apply()`, passing it the `spec` of the input manifest and a chart as a // scope. The chart is then synthesized and the output manifest is written to // STDOUT. Synth() // Synthesizes the app into a YAML string. // // Returns: A string with all YAML objects across all charts in this app. SynthYaml() *string // Returns a string representation of this construct. ToString() *string }
A CDK8s app which allows implementing Kubernetes operators using CDK8s constructs.
func NewOperator ¶
func NewOperator(props *OperatorProps) Operator
type OperatorProps ¶
type OperatorProps struct { // A Kubernetes JSON manifest with a single resource that is matched against one of the providers within this operator. // Default: - first position command-line argument or "/dev/stdin". // InputFile *string `field:"optional" json:"inputFile" yaml:"inputFile"` // Where to write the synthesized output. // Default: "/dev/stdout". // OutputFile *string `field:"optional" json:"outputFile" yaml:"outputFile"` }
type Server ¶
type Server interface { // Stop server. Close() // Starts HTTP server. Listen(port *float64) *float64 }
func NewServer ¶
func NewServer(props *ServerProps) Server
type ServerProps ¶
type ServerProps struct { // The command to execute in order to synthesize the CDK app. AppCommand *string `field:"required" json:"appCommand" yaml:"appCommand"` }