gen

package
v3.0.0-...-3d101a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Overview

nolint: nakedret

nolint: goconst

nolint: lll

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIVersionComment

func APIVersionComment(gvk schema.GroupVersionKind) string

func PulumiComment

func PulumiComment(kind string) string

PulumiComment adds additional information to the docs generated automatically from the OpenAPI specs. This includes information about Pulumi's await behavior, deprecation information, etc.

func PulumiSchema

func PulumiSchema(swagger map[string]any) pschema.PackageSpec

PulumiSchema will generate a Pulumi schema for the given k8s schema.

Types

type GVK

type GVK struct {
	GroupVersions []GroupVersion
	Kinds         []string
	PatchKinds    []string
}

GVK holds sorted lists of GroupVersions and Kinds.

type GoTemplateResources

type GoTemplateResources struct {
	TemplateResources
}

GoTemplateResources are TemplateResources specific to the Go SDK.

func (GoTemplateResources) Imports

func (tr GoTemplateResources) Imports() []string

Imports returns a sorted list of all resource imports. This is currently used for the YAML SDK overlay.

type GroupConfig

type GroupConfig struct {
	// contains filtered or unexported fields
}

GroupConfig represents a Kubernetes API group (e.g., core, apps, extensions, etc.)

func (GroupConfig) Group

func (gc GroupConfig) Group() string

Group returns the name of the group (e.g., `core` for core, etc.)

func (GroupConfig) Versions

func (gc GroupConfig) Versions() []VersionConfig

Versions returns the set of version for some Kubernetes API group. For example, the `apps` group has `v1beta1`, `v1beta2`, and `v1`.

type GroupVersion

type GroupVersion string

GroupVersion is the GroupVersion for a k8s resource.

func (GroupVersion) GVConstName

func (gv GroupVersion) GVConstName() string

GVConstName converts a GroupVersion to a name suitable for a const variable. This is used by codegen internal to the k8s provider. Example: apps/v1beta1 -> AppsV1B1

type KindConfig

type KindConfig struct {
	// contains filtered or unexported fields
}

KindConfig represents a Kubernetes API kind (e.g., the `Deployment` type in `apps/v1beta1/Deployment`).

func (KindConfig) Aliases

func (kc KindConfig) Aliases() []string

Aliases returns the list of aliases for a Kubernetes API kind.

func (KindConfig) Comment

func (kc KindConfig) Comment() string

Comment returns the comments associated with some Kubernetes API kind.

func (KindConfig) DeprecationComment

func (kc KindConfig) DeprecationComment() string

DeprecationComment returns the deprecation comment for deprecated APIs, otherwise an empty string.

func (KindConfig) IsNested

func (kc KindConfig) IsNested() bool

IsNested returns true if this is a nested kind.

func (KindConfig) Kind

func (kc KindConfig) Kind() string

Kind returns the name of the Kubernetes API kind (e.g., `Deployment` for `apps/v1beta1/Deployment`).

func (KindConfig) OptionalInputProperties

func (kc KindConfig) OptionalInputProperties() []Property

OptionalInputProperties returns the list of properties that are optional input properties on some Kubernetes API kind (i.e., things that we will want to provide, like `thing.metadata`, etc.).

func (KindConfig) Properties

func (kc KindConfig) Properties() []Property

Properties returns the list of properties that exist on some Kubernetes API kind (i.e., things that we will want to `.` into, like `thing.apiVersion`, `thing.kind`, `thing.metadata`, etc.).

func (KindConfig) PulumiComment

func (kc KindConfig) PulumiComment() string

PulumiComment returns the await logic documentation associated with some Kubernetes API kind.

func (KindConfig) RequiredInputProperties

func (kc KindConfig) RequiredInputProperties() []Property

RequiredInputProperties returns the list of properties that are required input properties on some Kubernetes API kind (i.e., things that we will want to provide, like `thing.metadata`, etc.).

type Property

type Property struct {
	// contains filtered or unexported fields
}

Property represents a property we want to expose on a Kubernetes API kind (i.e., things that we will want to `.` into, like `thing.apiVersion`, `thing.kind`, `thing.metadata`, etc.).

func (Property) Comment

func (p Property) Comment() string

Comment returns the comments associated with some property.

func (Property) ConstValue

func (p Property) ConstValue() string

DefaultValue returns the constant value of the property.

func (Property) DefaultValue

func (p Property) DefaultValue() string

DefaultValue returns the default value of the property.

func (Property) Name

func (p Property) Name() string

Name returns the name of the property.

func (Property) SchemaType

func (p Property) SchemaType() string

SchemaType returns the type of the property for the schema.

type TemplateProperty

type TemplateProperty struct {
	ConstValue string // If set, the constant value of the property (e.g., "flowcontrol.apiserver.k8s.io/v1alpha1")
	Name       string // The name of the property (e.g., "FlowSchemaSpec")
	Package    string // The package path containing the property definition (e.g., "outputs.flowcontrol.v1alpha1")
}

TemplateProperty holds information about a resource property that can be used to generate SDK overlays.

func (TemplateProperty) Type

func (tp TemplateProperty) Type() string

Type returns the property type. This could be either a constant value or the type definition.

type TemplateResource

type TemplateResource struct {
	Alias      string             // The optional alias to use for package imports (e.g., "flowcontrolv1alpha1")
	Name       string             // The name of the resource (e.g., "FlowSchema")
	Package    string             // The name of the package containing the resource definition (e.g., "flowcontrol.v1alpha1")
	Properties []TemplateProperty // Properties of the resource
	Token      string             // The schema token for the resource (e.g., "kubernetes:flowcontrol.apiserver.k8s.io/v1alpha1:FlowSchema")
}

TemplateResource holds information about a resource that can be used to generate SDK overlays.

func (TemplateResource) GVK

func (tr TemplateResource) GVK() string

GVK returns the GroupVersionKind string for the k8s resource in the form "group/version/kind". The "core" group is rewritten to "", so resources in that Group look like "v1/Pod" rather than "core/v1/Pod".

func (TemplateResource) IsListKind

func (tr TemplateResource) IsListKind() bool

IsListKind returns true if the resource name has the suffix "List".

type TemplateResources

type TemplateResources struct {
	Resources []TemplateResource
	Packages  []string
}

TemplateResources holds a list of TemplateResource structs than can be filtered for codegen purposes.

func (TemplateResources) ListKinds

func (tr TemplateResources) ListKinds() []TemplateResource

ListKinds returns a sorted list of resources that are a List kind.

func (TemplateResources) NonListKinds

func (tr TemplateResources) NonListKinds() []TemplateResource

ListKinds returns a sorted list of resources that are not a List kind.

type VersionConfig

type VersionConfig struct {
	// contains filtered or unexported fields
}

VersionConfig represents a version of a Kubernetes API group (e.g., the `apps` group has `v1beta1`, `v1beta2`, and `v1`.)

func (VersionConfig) APIVersion

func (vc VersionConfig) APIVersion() string

APIVersion returns the fully-qualified apiVersion (e.g., `storage.k8s.io/v1` for storage, etc.)

func (VersionConfig) DefaultAPIVersion

func (vc VersionConfig) DefaultAPIVersion() string

DefaultAPIVersion returns the default apiVersion (e.g., `v1` rather than `core/v1`).

func (VersionConfig) Kinds

func (vc VersionConfig) Kinds() []KindConfig

Kinds returns the set of kinds in some Kubernetes API group/version combination (e.g., `apps/v1beta1` has the `Deployment` kind, etc.).

func (VersionConfig) Version

func (vc VersionConfig) Version() string

Version returns the name of the version (e.g., `apps/v1beta1` would return `v1beta1`).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL