v1alpha1

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

+groupName=syncagent.kcp.io +versionName=v1alpha1 +kubebuilder:object:generate=true

Index

Constants

View Source
const (
	PlaceholderRemoteClusterName   = "$remoteClusterName"
	PlaceholderRemoteNamespace     = "$remoteNamespace"
	PlaceholderRemoteNamespaceHash = "$remoteNamespaceHash"
	PlaceholderRemoteName          = "$remoteName"
	PlaceholderRemoteNameHash      = "$remoteNameHash"
)
View Source
const (
	// AgentNameAnnotation records which Sync Agent has created an APIResourceSchema.
	AgentNameAnnotation = "syncagent.kcp.io/agent-name"

	// SourceGenerationAnnotation is the annotation on APIResourceSchemas that tells us
	// what generation of the CRD it was based on. This can be helpful in debugging,
	// as ARS resources cannot be updated, i.e. changes to CRDs are not reflected in ARS.
	SourceGenerationAnnotation = "syncagent.kcp.io/source-generation"

	// APIGroupLabel contains the API Group an APIResourceSchema is meant for.
	APIGroupLabel = "syncagent.kcp.io/api-group"
)
View Source
const GroupName = "syncagent.kcp.io"

GroupName is the group name use in this package.

View Source
const GroupVersion = "v1alpha1"

Variables

View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme

	// SchemeGroupVersion is group version used to register these objects.
	SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion}
)

Functions

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource.

Types

type PublishedResource

type PublishedResource struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec PublishedResourceSpec `json:"spec"`

	// Status contains reconciliation information for the published resource.
	Status PublishedResourceStatus `json:"status,omitempty"`
}

PublishedResource describes how an API type (usually defined by a CRD) on the service cluster should be exposed in kcp workspaces. Besides controlling how namespaced and cluster-wide resources should be mapped, the GVK can also be transformed to provide a uniform, implementation-independent access to the APIs inside kcp.

func (*PublishedResource) DeepCopy

func (in *PublishedResource) DeepCopy() *PublishedResource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublishedResource.

func (*PublishedResource) DeepCopyInto

func (in *PublishedResource) DeepCopyInto(out *PublishedResource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PublishedResource) DeepCopyObject

func (in *PublishedResource) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type PublishedResourceList

type PublishedResourceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []PublishedResource `json:"items"`
}

PublishedResourceList contains a list of PublishedResources.

func (*PublishedResourceList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublishedResourceList.

func (*PublishedResourceList) DeepCopyInto

func (in *PublishedResourceList) DeepCopyInto(out *PublishedResourceList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PublishedResourceList) DeepCopyObject

func (in *PublishedResourceList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type PublishedResourceSpec

type PublishedResourceSpec struct {
	// Describes the "source" Resource that exists on this, the service cluster,
	// that should be exposed in kcp workspaces. All fields have to be specified.
	Resource SourceResourceDescriptor `json:"resource"`

	// If specified, the filter will be applied to the resources in a workspace
	// and allow restricting which of them will be handled by the Sync Agent.
	Filter *ResourceFilter `json:"filter,omitempty"`

	// Naming can be used to control how the namespace and names for local objects
	// are formed. If not specified, the Sync Agent will use defensive defaults to
	// prevent naming collisions in the service cluster.
	// When configuring this, great care must be taken to not allow for naming
	// collisions to happen; keep in mind that the same name/namespace can exists in
	// many different kcp workspaces.
	Naming *ResourceNaming `json:"naming,omitempty"`

	// EnableWorkspacePaths toggles whether the Sync Agent will not just store the kcp
	// cluster name as a label on each locally synced object, but also the full workspace
	// path. This is optional because it requires additional requests to kcp and
	// should only be used if the workspace path is of interest on the
	// service cluster side.
	EnableWorkspacePaths bool `json:"enableWorkspacePaths,omitempty"`

	// Projection is used to change the GVK of a published resource within kcp.
	// This can be used to hide implementation details and provide a customized API
	// experience to the user.
	// All fields in the projection are optional. If a field is set, it will overwrite
	// that field in the GVK. The namespaced field can be set to turn a cluster-wide
	// resource namespaced or vice-versa.
	Projection *ResourceProjection `json:"projection,omitempty"`

	// Mutation allows to configure "rewrite rules" to modify the objects in both
	// directions during the synchronization.
	Mutation *ResourceMutationSpec `json:"mutation,omitempty"`

	Related []RelatedResourceSpec `json:"related,omitempty"`
}

PublishedResourceSpec describes the desired resource publication from a service cluster to kcp.

func (*PublishedResourceSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublishedResourceSpec.

func (*PublishedResourceSpec) DeepCopyInto

func (in *PublishedResourceSpec) DeepCopyInto(out *PublishedResourceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PublishedResourceStatus

type PublishedResourceStatus struct {
	ResourceSchemaName string `json:"resourceSchemaName,omitempty"`
}

PublishedResourceStatus stores status information about a published resource.

func (*PublishedResourceStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PublishedResourceStatus.

func (*PublishedResourceStatus) DeepCopyInto

func (in *PublishedResourceStatus) DeepCopyInto(out *PublishedResourceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RegexResourceLocator

type RegexResourceLocator struct {
	// Pattern can be left empty to simply replace the entire value with the
	// replacement.
	Pattern     string `json:"pattern,omitempty"`
	Replacement string `json:"replacement,omitempty"`
}

func (*RegexResourceLocator) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegexResourceLocator.

func (*RegexResourceLocator) DeepCopyInto

func (in *RegexResourceLocator) DeepCopyInto(out *RegexResourceLocator)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RelatedResourceReference

type RelatedResourceReference struct {
	Name      ResourceLocator  `json:"name"`
	Namespace *ResourceLocator `json:"namespace,omitempty"`
}

func (*RelatedResourceReference) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RelatedResourceReference.

func (*RelatedResourceReference) DeepCopyInto

func (in *RelatedResourceReference) DeepCopyInto(out *RelatedResourceReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RelatedResourceSpec

type RelatedResourceSpec struct {
	// Identifier is a unique name for this related resource. The name must be unique within one
	// PublishedResource and is the key by which consumers (end users) can identify and consume the
	// related resource. Common names are "connection-details" or "credentials".
	// The identifier must be an alphanumeric string.
	Identifier string `json:"identifier"`

	// "service" or "kcp"
	Origin string `json:"origin"`

	// ConfigMap or Secret
	Kind string `json:"kind"`

	Reference RelatedResourceReference `json:"reference"`

	// Mutation configures optional transformation rules for the related resource.
	// Status mutations are only performed when the related resource originates in kcp.
	Mutation *ResourceMutationSpec `json:"mutation,omitempty"`
}

func (*RelatedResourceSpec) DeepCopy

func (in *RelatedResourceSpec) DeepCopy() *RelatedResourceSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RelatedResourceSpec.

func (*RelatedResourceSpec) DeepCopyInto

func (in *RelatedResourceSpec) DeepCopyInto(out *RelatedResourceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceDeleteMutation

type ResourceDeleteMutation struct {
	Path string `json:"path"`
}

func (*ResourceDeleteMutation) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDeleteMutation.

func (*ResourceDeleteMutation) DeepCopyInto

func (in *ResourceDeleteMutation) DeepCopyInto(out *ResourceDeleteMutation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceFilter

type ResourceFilter struct {
	// When given, the namespace filter will be applied to a resource's namespace.
	Namespace *metav1.LabelSelector `json:"namespace,omitempty"`
	// When given, the resource filter will be applied to a resource itself.
	Resource *metav1.LabelSelector `json:"resource,omitempty"`
}

ResourceFilter can be used to limit what resources should be included in an operation.

func (*ResourceFilter) DeepCopy

func (in *ResourceFilter) DeepCopy() *ResourceFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceFilter.

func (*ResourceFilter) DeepCopyInto

func (in *ResourceFilter) DeepCopyInto(out *ResourceFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceLocator

type ResourceLocator struct {
	Path  string                `json:"path"`
	Regex *RegexResourceLocator `json:"regex,omitempty"`
}

func (*ResourceLocator) DeepCopy

func (in *ResourceLocator) DeepCopy() *ResourceLocator

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceLocator.

func (*ResourceLocator) DeepCopyInto

func (in *ResourceLocator) DeepCopyInto(out *ResourceLocator)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceMutation

type ResourceMutation struct {
	Delete   *ResourceDeleteMutation   `json:"delete,omitempty"`
	Regex    *ResourceRegexMutation    `json:"regex,omitempty"`
	Template *ResourceTemplateMutation `json:"template,omitempty"`
}

func (*ResourceMutation) DeepCopy

func (in *ResourceMutation) DeepCopy() *ResourceMutation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceMutation.

func (*ResourceMutation) DeepCopyInto

func (in *ResourceMutation) DeepCopyInto(out *ResourceMutation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceMutationSpec

type ResourceMutationSpec struct {
	Spec   []ResourceMutation `json:"spec,omitempty"`
	Status []ResourceMutation `json:"status,omitempty"`
}

ResourceMutationSpec allows to configure "rewrite rules" to modify the objects in both directions during the synchronization.

func (*ResourceMutationSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceMutationSpec.

func (*ResourceMutationSpec) DeepCopyInto

func (in *ResourceMutationSpec) DeepCopyInto(out *ResourceMutationSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceNaming

type ResourceNaming struct {
	// The name field allows to control the name the local objects created by the Sync Agent.
	// If left empty, "$remoteNamespaceHash-$remoteNameHash" is assumed. This guarantees unique
	// names as long as the cluster name ($remoteClusterName) is used for the local namespace
	// (the default unless configured otherwise).
	// This is a string with placeholders. The following placeholders can be used:
	//
	//   - $remoteClusterName   -- the kcp workspace's cluster name (e.g. "1084s8ceexsehjm2")
	//   - $remoteNamespace     -- the original namespace used by the consumer inside the kcp
	//                             workspace (if targetNamespace is left empty, it's equivalent
	//                             to setting "$remote_ns")
	//   - $remoteNamespaceHash -- first 20 hex characters of the SHA-1 hash of $remoteNamespace
	//   - $remoteName          -- the original name of the object inside the kcp workspace
	//                             (rarely used to construct local namespace names)
	//   - $remoteNameHash      -- first 20 hex characters of the SHA-1 hash of $remoteName
	//
	Name string `json:"name,omitempty"`

	// For namespaced resources, the this field allows to control where the local objects will
	// be created. If left empty, "$remoteClusterName" is assumed.
	// This is a string with placeholders. The following placeholders can be used:
	//
	//   - $remoteClusterName   -- the kcp workspace's cluster name (e.g. "1084s8ceexsehjm2")
	//   - $remoteNamespace     -- the original namespace used by the consumer inside the kcp
	//                             workspace (if targetNamespace is left empty, it's equivalent
	//                             to setting "$remote_ns")
	//   - $remoteNamespaceHash -- first 20 hex characters of the SHA-1 hash of $remoteNamespace
	//   - $remoteName          -- the original name of the object inside the kcp workspace
	//                             (rarely used to construct local namespace names)
	//   - $remoteNameHash      -- first 20 hex characters of the SHA-1 hash of $remoteName
	//
	Namespace string `json:"namespace,omitempty"`
}

ResourceNaming describes how the names for local objects should be formed.

func (*ResourceNaming) DeepCopy

func (in *ResourceNaming) DeepCopy() *ResourceNaming

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceNaming.

func (*ResourceNaming) DeepCopyInto

func (in *ResourceNaming) DeepCopyInto(out *ResourceNaming)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceProjection

type ResourceProjection struct {
	// The API version, for example "v1beta1".
	Version string `json:"version,omitempty"`
	// Whether or not the resource is namespaced.
	// +kubebuilder:validation:Enum=Cluster;Namespaced
	Scope ResourceScope `json:"scope,omitempty"`
	// The resource Kind, for example "Database". Setting this field will also overwrite
	// the singular name by lowercasing the resource kind. In addition, if this is set,
	// the plural name will also be updated by taking the lowercased kind name and appending
	// an "s". If this would yield an undesirable name, use the plural field to explicitly
	// give the plural name.
	Kind string `json:"kind,omitempty"`
	// When overwriting the Kind, it can be necessary to also override the plural name in
	// case of more complex pluralization rules.
	Plural string `json:"plural,omitempty"`
	// ShortNames can be used to overwrite the original short names for a resource, usually
	// when the Kind is remapped, new short names are also in order. Set this to an empty
	// list to remove all short names.
	// +optional
	ShortNames []string `json:"shortNames"` // not omitempty because we need to distinguish between [] and nil
	// Categories can be used to overwrite the original categories a resource was in. Set
	// this to an empty list to remove all categories.
	// +optional
	Categories []string `json:"categories"` // not omitempty because we need to distinguish between [] and nil
}

ResourceProjection describes how the source GVK should be modified before it's published in kcp.

func (*ResourceProjection) DeepCopy

func (in *ResourceProjection) DeepCopy() *ResourceProjection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceProjection.

func (*ResourceProjection) DeepCopyInto

func (in *ResourceProjection) DeepCopyInto(out *ResourceProjection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceRegexMutation

type ResourceRegexMutation struct {
	Path string `json:"path"`
	// Pattern can be left empty to simply replace the entire value with the
	// replacement.
	Pattern     string `json:"pattern,omitempty"`
	Replacement string `json:"replacement,omitempty"`
}

func (*ResourceRegexMutation) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRegexMutation.

func (*ResourceRegexMutation) DeepCopyInto

func (in *ResourceRegexMutation) DeepCopyInto(out *ResourceRegexMutation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceScope

type ResourceScope string

ResourceScope is an enum defining the different scopes available to a custom resource. This ENUM matches apiextensionsv1.ResourceScope, but was copied here to avoid a costly dependency and since the ENUM will unlikely be extended/changed in future Kubernetes releases.

const (
	ClusterScoped   ResourceScope = "Cluster"
	NamespaceScoped ResourceScope = "Namespaced"
)

type ResourceTemplateMutation

type ResourceTemplateMutation struct {
	Path     string `json:"path"`
	Template string `json:"template"`
}

func (*ResourceTemplateMutation) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceTemplateMutation.

func (*ResourceTemplateMutation) DeepCopyInto

func (in *ResourceTemplateMutation) DeepCopyInto(out *ResourceTemplateMutation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SourceResourceDescriptor

type SourceResourceDescriptor struct {
	// The API group of a resource, for example "storage.initroid.com".
	APIGroup string `json:"apiGroup"`
	// The API version, for example "v1beta1".
	Version string `json:"version"`
	// The resource Kind, for example "Database".
	Kind string `json:"kind"`
}

SourceResourceDescriptor uniquely describes a resource type in the cluster.

func (*SourceResourceDescriptor) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SourceResourceDescriptor.

func (*SourceResourceDescriptor) DeepCopyInto

func (in *SourceResourceDescriptor) DeepCopyInto(out *SourceResourceDescriptor)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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