metadata

package
v1.118.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package metadata defines some KCC metadata around GCP services and DCL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalizeServiceName

func CanonicalizeServiceName(service string) string

func IsDCLBasedResourceKind

func IsDCLBasedResourceKind(gvk k8sschema.GroupVersionKind, loader ServiceMetadataLoader) bool

func ToGroupVersionKind

ToGroupVersionKind returns the KRM GroupVersionKind given the DCL ServiceTypeVersion.

func ToServiceTypeVersion

ToServiceTypeVersion returns the DCL ServiceTypeVersion given the KRM GroupVersionKind.

Types

type Resource

type Resource struct {
	// Kind is the Kubernetes kind for the GCP resource
	Kind string
	// DCLVersion is the version of DCL client used for this resource, e.g. "ga", "beta" and "alpha".
	// If omitted, it will default to the DCLVersion specified at the service level.
	DCLVersion string
	// DCLType is the resource type named by DCL, see https://source.corp.google.com/piper///depot/google3/cloud/graphite/mmv2/dcl/resource.go
	// If omitted, it assumes that DCL and KCC use the exact same name (case-sensitive) for this resource.
	// This field should only be specified if we want to change acronyms in the resource name to consistent capitalization to follow k8s naming conventions
	// e.g OAuthIdpConfig -> OAuthIDPConfig.
	DCLType string
	// Releasable indicates if this resource is ready to release via DCL/KCC bridge.
	// For existing tf-based resource kinds, this flag should be false, to only enable loading its OpenAPI schema.
	Releasable bool
	// SupportsHierarchicalReferences indicates if this resource supports
	// hierarchical references (i.e. if the DCL resource supports one of the
	// following top-level configurable fields: project, folder, organization,
	// parent).
	//
	// TODO(b/186159460): Delete this field once all resources support
	// hierarchical references since supporting hierarchical references is the
	// future default behavior that is intended.
	SupportsHierarchicalReferences bool
	// Deprecated. New resources should not set this field. See
	// SupportsHierarchicalReferences instead.
	//
	// SupportsContainerAnnotations indicates if this resource supports
	// resource-level container annotations. This field can only be set if the
	// resource supports the x-dcl-parent-container extension.
	SupportsContainerAnnotations bool
	// ReconciliationIntervalInSeconds specifies the default mean reconciliation interval for this resource.
	// Providing the value in DCL metadata config is optional. If not explicitly configured a global
	// default value of 600 will be used.
	ReconciliationIntervalInSeconds *uint32
}

type ServiceMetadata

type ServiceMetadata struct {
	// Name is the name of the GCP service used by KCC following KRM naming convention, e.g. Spanner, PubSub, KMS
	Name string
	// APIVersion is the k8s API version of all the resource CRDs belong to this Service, e.g. v1beta, v1
	APIVersion string
	// DCLVersion is the version of DCL client used for this service, e.g. "ga", "beta" and "alpha".
	// Each resource of the service can choose to use a different version by setting Resource.DCLVersion.
	DCLVersion string
	// DCLServiceName is the name of the GCP service used by DCL, by convention it's the service host name, e.g cloudkms
	// If omitted, it assumes that DCL and KCC use the exact same name (case-insensitive) for this service
	ServiceNameUsedByDCL string
	// Resources is a list of GCP resources to support.
	Resources []Resource
}

ServiceMetadata defines some KCC metadata around GCP services and DCL.

func (*ServiceMetadata) GetResourceWithKind

func (sm *ServiceMetadata) GetResourceWithKind(kind string) (Resource, bool)

func (*ServiceMetadata) GetResourceWithType

func (sm *ServiceMetadata) GetResourceWithType(t string) (Resource, bool)

type ServiceMetadataLoader

type ServiceMetadataLoader interface {
	GetAllServiceMetadata() []ServiceMetadata
	GetServiceMetadata(service string) (ServiceMetadata, bool)

	// GetResourceWithGVK gets the Resource object that corresponds to the
	// given GroupVersionKind.
	GetResourceWithGVK(gvk k8sschema.GroupVersionKind) (Resource, bool)
}

func New

func NewFromServiceList

func NewFromServiceList(serviceList []ServiceMetadata) ServiceMetadataLoader

Jump to

Keyboard shortcuts

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