crdgeneration

package
v1.98.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiDomain         = "cnrm.cloud.google.com"
	ManagedByKCCLabel = "cnrm.cloud.google.com/managed-by-kcc"
	GCPCategory       = "gcp"
)
View Source
const (
	Dcl2CRDLabel = "cnrm.cloud.google.com/dcl2crd"
)
View Source
const (
	TF2CRDLabel = "cnrm.cloud.google.com/tf2crd"
)

Variables

View Source
var (
	UnsupportedReferencedResource = fmt.Errorf("referenced resource is unsupported by KCC")
)

Functions

func FileNameForCRD

func FileNameForCRD(crd *apiextensions.CustomResourceDefinition) (string, error)

FileNameForCRD determines the file name for the given CRD. File names take the form of "$group_$version_$kind.yaml" Example: "pubsub_v1alpha1_pubsubtopic.yaml"

func GenerateResourceIDFieldDescription

func GenerateResourceIDFieldDescription(targetField string, isServerGeneratedResourceID bool) string

func GenerateShortNames

func GenerateShortNames(kind string) []string

func GetCustomResourceDefinition

func GetCustomResourceDefinition(kind, group, version string, openAPIV3Schema *apiextensions.JSONSchemaProps, engineLabel string) *apiextensions.CustomResourceDefinition

func GetResourceReferenceSchemaFromTypeConfig

func GetResourceReferenceSchemaFromTypeConfig(typeConfig corekccv1alpha1.TypeConfig) *apiextensions.JSONSchemaProps

func MarkHierarchicalReferencesOptionalButMutuallyExclusive

func MarkHierarchicalReferencesOptionalButMutuallyExclusive(spec *apiextensions.JSONSchemaProps, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) *apiextensions.JSONSchemaProps

MarkHierarchicalReferencesOptionalButMutuallyExclusive returns a modified copy of the given JSON schema so that keys for hierarchical references are marked optional but mutually exclusive (i.e. at most one may be specified).

func MarkHierarchicalReferencesRequiredButMutuallyExclusive

func MarkHierarchicalReferencesRequiredButMutuallyExclusive(spec *apiextensions.JSONSchemaProps, hierarchicalRefs []corekccv1alpha1.HierarchicalReference) *apiextensions.JSONSchemaProps

MarkHierarchicalReferencesRequiredButMutuallyExclusive returns a modified copy of the given JSON schema so that keys for hierarchical references are marked required but mutually exclusive (i.e. one and only one must be specified).

func MarkReferencedKindsNotSupported

func MarkReferencedKindsNotSupported(refSchema *apiextensions.JSONSchemaProps, kinds []string)

MarkReferencedKindsNotSupported changes the description of the direct reference field 'name' to reflect that some of the referenced resource types are not yet supported in KCC.

Types

type DCL2CRDGenerator

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

func New

func New(metadataLoader dclmetatda.ServiceMetadataLoader, schemaLoader dclschemaloader.DCLSchemaLoader, allSupportedGVKs []schema.GroupVersionKind) *DCL2CRDGenerator

func (*DCL2CRDGenerator) GenerateCRDFromOpenAPISchema

func (a *DCL2CRDGenerator) GenerateCRDFromOpenAPISchema(schema *openapi.Schema, gvk schema.GroupVersionKind) (*apiextensions.CustomResourceDefinition, error)

GenerateCRDFromOpenAPISchema returns a CustomResourceDefinition given the DCL OpenAPI schema

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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