This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2022 The Kube Bind Authors. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ | |
package v1alpha1 | |
import ( | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
"k8s.io/apimachinery/pkg/runtime" | |
conditionsapi "github.com/kube-bind/kube-bind/pkg/apis/third_party/conditions/apis/conditions/v1alpha1" | |
) | |
const ( | |
// ClusterBindingConditionSecretValid is set when the secret is valid. | |
ClusterBindingConditionSecretValid = "SecretValid" | |
) | |
// ClusterBinding represents a bound consumer class. It lives in a service provider cluster | |
// and is a singleton named "cluster". | |
// | |
// +crd | |
// +genclient | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
// +kubebuilder:resource:scope=Namespaced,categories=kube-bindings | |
// +kubebuilder:subresource:status | |
// +kubebuilder:printcolumn:name="Last Heartbeat",type="date",JSONPath=`.status.lastHeartbeatTime`,priority=0 | |
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status`,priority=0 | |
type ClusterBinding struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ObjectMeta `json:"metadata,omitempty"` | |
// spec represents the data in the newly created ClusterBinding. | |
// +required | |
// +kubebuilder:validation:Required | |
Spec ClusterBindingSpec `json:"spec"` | |
// status contains reconciliation information for the service binding. | |
Status ClusterBindingStatus `json:"status,omitempty"` | |
} | |
func (in *ClusterBinding) GetConditions() conditionsapi.Conditions { | |
return in.Status.Conditions | |
} | |
func (in *ClusterBinding) SetConditions(conditions conditionsapi.Conditions) { | |
in.Status.Conditions = conditions | |
} | |
// Scope is the scope of the ClusterBinding. | |
// | |
// +kubebuilder:validation:Enum=Cluster;Namespaced | |
type Scope string | |
const ( | |
// ClusterScope means that the konnector has permission to watch all namespaces at once. | |
// This is more efficient than watching each namespace individually. | |
// | |
// Only Cluster scoped ClusterBindings can export cluster-scoped resources. But Cluster | |
// scoped ClusterBindings can export namespaced resources as well. | |
// | |
// In a Kubernetes cluster, Cluster scoped ClusterBindings don't allow isolation between tenants. | |
// In a kcp cluster, the platform provides the isolation between workspaces and hence tenants | |
// are isolated if with full cluster-wide access of a konnector. | |
ClusterScope Scope = "Cluster" | |
// NamespacedScope means that the konnector has permission to watch only single namespaces. | |
// This is more resource intensive than Cluster scope. | |
// | |
// Only namespace-scoped resources can be exported in Namespace scope. | |
NamespacedScope Scope = "Namespaced" | |
) | |
// ClusterBindingSpec represents the data in the newly created ClusterBinding. | |
type ClusterBindingSpec struct { | |
// kubeconfigSecretName is the secret ref that contains the kubeconfig of the service cluster. | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="kubeconfigSecretRef is immutable" | |
KubeconfigSecretRef LocalSecretKeyRef `json:"kubeconfigSecretRef"` | |
// providerPrettyName is the pretty name of the service provider cluster. This | |
// can be shared among different ServiceBindings. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:MinLength=1 | |
ProviderPrettyName string `json:"providerPrettyName"` | |
// serviceProviderSpec contains all the data and information about the service which has been bound to the service | |
// binding request. The service providers decide what they need and what to configure based on what then include in | |
// this field, such as service region, type, tiers, etc... | |
ServiceProviderSpec runtime.RawExtension `json:"serviceProviderSpec,omitempty"` | |
} | |
// ClusterBindingPhase stores the phase of a cluster binding. | |
// | |
// +kubebuilder:validation:Enum=Connected;Pending;Timeout | |
type ClusterBindingPhase string | |
const ( | |
// ClusterConnected means the service is connected and has sent a heartbeat recently. | |
ClusterConnected ClusterBindingPhase = "Connected" | |
// ClusterPending is the phase before the konnector has sent a heartbeat the first time. | |
ClusterPending ClusterBindingPhase = "Pending" | |
// ClusterTimeout is the phase when the konnector has not sent a heartbeat for a long time | |
// and the service considers this cluster as unhealthy. | |
ClusterTimeout ClusterBindingPhase = "Timeout" | |
) | |
// ClusterBindingStatus stores status information about a service binding. It is | |
// updated by both the konnector and the service provider. | |
type ClusterBindingStatus struct { | |
// lastHeartbeatTime is the last time the konnector updated the status. | |
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"` | |
// heartbeatInterval is the maximal interval between heartbeats that the | |
// konnector promises to send. The service provider can assume that the | |
// konnector is not unhealthy if it does not receive a heartbeat within | |
// this time. | |
HeartbeatInterval metav1.Duration `json:"heartbeatInterval,omitempty"` | |
// phase represents the phase of the service binding. It is set by the | |
// service provider. | |
// | |
// +kubebuilder:default=Pending | |
Phase ClusterBindingPhase `json:"phase"` | |
// conditions is a list of conditions that apply to the ClusterBinding. It is | |
// updated by the konnector and the service provider. | |
Conditions conditionsapi.Conditions `json:"conditions,omitempty"` | |
} | |
// ClusterBindingList is the objects list that represents the ClusterBinding. | |
// | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
type ClusterBindingList struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ListMeta `json:"metadata"` | |
Items []ClusterBinding `json:"items"` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2022 The Kube Bind Authors. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ | |
package v1alpha1 | |
import ( | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
conditionsapi "github.com/kube-bind/kube-bind/pkg/apis/third_party/conditions/apis/conditions/v1alpha1" | |
) | |
const ( | |
// ServiceBindingConditionSecretValid is set when the secret is valid. | |
ServiceBindingConditionSecretValid conditionsapi.ConditionType = "SecretValid" | |
// ServiceBindingConditionInformersSynced is set when the informers can sync. | |
ServiceBindingConditionInformersSynced conditionsapi.ConditionType = "InformersSynced" | |
// ServiceBindingConditionHeartbeating is set when the ClusterBinding of the service provider | |
// is successfully heartbeated. | |
ServiceBindingConditionHeartbeating conditionsapi.ConditionType = "Heartbeating" | |
// ServiceBindingConditionConnected means the ServiceBinding has been connected to a ServiceExport. | |
ServiceBindingConditionConnected conditionsapi.ConditionType = "Connected" | |
// ServiceBindingConditionResourcesValid is set to true when the ServiceExport's | |
// resources exist and are valid. | |
ServiceBindingConditionResourcesValid conditionsapi.ConditionType = "ResourcesValid" | |
// ServiceBindingConditionSchemaInSync is set to true when the ServiceExport's | |
// schema is applied to the consumer cluster. | |
ServiceBindingConditionSchemaInSync conditionsapi.ConditionType = "SchemaInSync" | |
// DownstreamFinalizer is put on downstream objects to block their deletion until | |
// the upstream object has been deleted. | |
DownstreamFinalizer = "kubebind.io/syncer" | |
) | |
// ServiceBinding binds an API service represented by a ServiceExport | |
// in a service provider cluster into a consumer cluster. This object lives in | |
// the consumer cluster. | |
// | |
// +crd | |
// +genclient | |
// +genclient:nonNamespaced | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
// +kubebuilder:resource:scope=Cluster,categories=kube-bindings,shortName=sb | |
// +kubebuilder:subresource:status | |
// +kubebuilder:printcolumn:name="Provider",type="string",JSONPath=`.status.providerPrettyName`,priority=0 | |
// +kubebuilder:printcolumn:name="Resources",type="string",JSONPath=`.metadata.annotations.kube-bind\.io/resources`,priority=1 | |
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status`,priority=0 | |
type ServiceBinding struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ObjectMeta `json:"metadata,omitempty"` | |
// spec specifies how an API service from a service provider should be bound in the | |
// local consumer cluster. | |
Spec ServiceBindingSpec `json:"spec"` | |
// status contains reconciliation information for a service binding. | |
Status ServiceBindingStatus `json:"status,omitempty"` | |
} | |
func (in *ServiceBinding) GetConditions() conditionsapi.Conditions { | |
return in.Status.Conditions | |
} | |
func (in *ServiceBinding) SetConditions(conditions conditionsapi.Conditions) { | |
in.Status.Conditions = conditions | |
} | |
type ServiceBindingSpec struct { | |
// export is the name of the ServiceExport object in the service provider cluster. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:MinLength=1 | |
Export string `json:"export"` | |
// kubeconfigSecretName is the secret ref that contains the kubeconfig of the service cluster. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="kubeconfigSecretRef is immutable" | |
KubeconfigSecretRef ClusterSecretKeyRef `json:"kubeconfigSecretRef"` | |
} | |
type ServiceBindingStatus struct { | |
// providerPrettyName is the pretty name of the service provider cluster. This | |
// can be shared among different ServiceBindings. | |
ProviderPrettyName string `json:"providerPrettyName,omitempty"` | |
// conditions is a list of conditions that apply to the ServiceBinding. | |
Conditions conditionsapi.Conditions `json:"conditions,omitempty"` | |
} | |
// ServiceBindingList is a list of ServiceBindings. | |
// | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
type ServiceBindingList struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ListMeta `json:"metadata"` | |
Items []ServiceBinding `json:"items"` | |
} | |
type LocalSecretKeyRef struct { | |
// Name of the referent. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:MinLength=1 | |
Name string `json:"name"` | |
// The key of the secret to select from. Must be "kubeconfig". | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:Enum=kubeconfig | |
Key string `json:"key"` | |
} | |
type ClusterSecretKeyRef struct { | |
LocalSecretKeyRef `json:",inline"` | |
// Namespace of the referent. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:MinLength=1 | |
Namespace string `json:"namespace"` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2022 The Kube Bind Authors. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ | |
package v1alpha1 | |
import ( | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
conditionsapi "github.com/kube-bind/kube-bind/pkg/apis/third_party/conditions/apis/conditions/v1alpha1" | |
) | |
const ( | |
// ServiceExportConditionConnected means the ServiceExport has been connected to a ServiceBinding. | |
ServiceExportConditionConnected conditionsapi.ConditionType = "Connected" | |
// ServiceExportConditionServiceBindingReady is set to true when the ServiceExport is ready. | |
ServiceExportConditionServiceBindingReady conditionsapi.ConditionType = "ExportReady" | |
// ServiceExportConditionResourcesValid is set to true when the ServiceExport's | |
// resources exist and are valid. | |
ServiceExportConditionResourcesValid conditionsapi.ConditionType = "ResourcesValid" | |
// ServiceExportConditionSchemaInSync is set to true when the ServiceExport's | |
// schema is applied to the consumer cluster. | |
ServiceExportConditionSchemaInSync conditionsapi.ConditionType = "SchemaInSync" | |
// ServiceExportConditionResourcesInSync is set to true when the ServiceExport's | |
// resources are in sync with the CRDs. | |
ServiceExportConditionResourcesInSync conditionsapi.ConditionType = "ResourcesInSync" | |
) | |
// ServiceExport specifies an API service to exported to a consumer cluster. The | |
// consumer cluster is defined by the ClusterBinding singleton in the same namespace. | |
// | |
// +crd | |
// +genclient | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
// +kubebuilder:resource:scope=Namespaced,categories=kube-bindings | |
// +kubebuilder:subresource:status | |
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status`,priority=0 | |
type ServiceExport struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ObjectMeta `json:"metadata,omitempty"` | |
// spec represents the data in the newly created service binding export. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
Spec ServiceExportSpec `json:"spec"` | |
// status contains reconciliation information for the service binding export. | |
Status ServiceExportStatus `json:"status,omitempty"` | |
} | |
func (in *ServiceExport) GetConditions() conditionsapi.Conditions { | |
return in.Status.Conditions | |
} | |
func (in *ServiceExport) SetConditions(conditions conditionsapi.Conditions) { | |
in.Status.Conditions = conditions | |
} | |
type ServiceExportSpec struct { | |
// resources are the resources to be bound into the consumer cluster. | |
// | |
// +listType=map | |
// +listMapKey=group | |
// +listMapKey=resource | |
Resources []ServiceExportGroupResource `json:"resources,omitempty"` | |
// scope is the scope of the ServiceExport. It can be either Cluster or Namespace. | |
// | |
// Cluster: The konnector has permission to watch all namespaces at once and cluster-scoped resources. | |
// This is more efficient than watching each namespace individually. | |
// Namespaced: The konnector has permission to watch only single namespaces. | |
// This is more resource intensive. And it means cluster-scoped resources cannot be exported. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:XValidation:rule="self != \"Namespaced\"",message="Namespaced scope not yet supported" | |
Scope Scope `json:"scope"` | |
} | |
type ServiceExportStatus struct { | |
// conditions is a list of conditions that apply to the ServiceExport. | |
Conditions conditionsapi.Conditions `json:"conditions,omitempty"` | |
} | |
type ServiceExportGroupResource struct { | |
GroupResource `json:",inline"` | |
} | |
// GroupResource identifies a resource. | |
type GroupResource struct { | |
// group is the name of an API group. | |
// For core groups this is the empty string '""'. | |
// | |
// +kubebuilder:validation:Pattern=`^(|[a-z0-9]([-a-z0-9]*[a-z0-9](\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?)$` | |
// +kubebuilder:default="" | |
Group string `json:"group,omitempty"` | |
// resource is the name of the resource. | |
// Note: it is worth noting that you can not ask for permissions for resource provided by a CRD | |
// not provided by an service binding export. | |
// | |
// +kubebuilder:validation:Pattern=`^[a-z][-a-z0-9]*[a-z0-9]$` | |
// +required | |
// +kubebuilder:validation:Required | |
Resource string `json:"resource"` | |
} | |
// ServiceExportList is the objects list that represents the ServiceExport. | |
// | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
type ServiceExportList struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ListMeta `json:"metadata"` | |
Items []ServiceExport `json:"items"` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2022 The Kube Bind Authors. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ | |
package v1alpha1 | |
import ( | |
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
"k8s.io/apimachinery/pkg/runtime" | |
conditionsapi "github.com/kube-bind/kube-bind/pkg/apis/third_party/conditions/apis/conditions/v1alpha1" | |
) | |
const ( | |
// ServiceExportResourceConditionSyncing means the resource is actively syncing. | |
ServiceExportResourrceConditionSyncing conditionsapi.ConditionType = "Syncing" | |
) | |
// ServiceExportResource specifies the resource to be exported. It is mostly a CRD:: | |
// - the spec is a CRD spec, but without webhooks | |
// - the status reflects that on the consumer cluster | |
// | |
// +crd | |
// +genclient | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
// +kubebuilder:resource:scope=Namespaced,categories=kube-bindings | |
// +kubebuilder:subresource:status | |
// +kubebuilder:printcolumn:name="Established",type="string",JSONPath=`.status.conditions[?(@.type=="Established")].status`,priority=5 | |
type ServiceExportResource struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ObjectMeta `json:"metadata,omitempty"` | |
// spec specifies the resource. | |
// +required | |
// +kubebuilder:validation:Required | |
Spec ServiceExportResourceSpec `json:"spec"` | |
// status contains reconciliation information for the resource. | |
Status ServiceExportResourceStatus `json:"status,omitempty"` | |
} | |
func (in *ServiceExportResource) GetConditions() conditionsapi.Conditions { | |
return in.Status.Conditions | |
} | |
func (in *ServiceExportResource) SetConditions(conditions conditionsapi.Conditions) { | |
in.Status.Conditions = conditions | |
} | |
// ServiceExportResourceSpec defines the desired state of ServiceExportResource. | |
type ServiceExportResourceSpec struct { | |
// group is the API group of the defined custom resource. Empty string means the | |
// core API group. The resources are served under `/apis/<group>/...` or `/api` for the core group. | |
// | |
// +required | |
Group string `json:"group"` | |
// names specify the resource and kind names for the custom resource. | |
// | |
// +required | |
Names apiextensionsv1.CustomResourceDefinitionNames `json:"names"` | |
// scope indicates whether the defined custom resource is cluster- or namespace-scoped. | |
// Allowed values are `Cluster` and `Namespaced`. | |
// | |
// +required | |
// +kubebuilder:validation:Enum=Cluster;Namespaced | |
Scope apiextensionsv1.ResourceScope `json:"scope"` | |
// versions is the API version of the defined custom resource. | |
// | |
// Note: the OpenAPI v3 schemas must be equal for all versions until CEL | |
// version migration is supported. | |
// | |
// +required | |
// +listType=map | |
// +listMapKey=name | |
// +kubebuilder:validation:MinItems=1 | |
Versions []ServiceExportResourceVersion `json:"versions"` | |
} | |
// ServiceExportResourceVersion describes one API version of a resource. | |
type ServiceExportResourceVersion struct { | |
// name is the version name, e.g. “v1”, “v2beta1”, etc. | |
// The custom resources are served under this version at `/apis/<group>/<version>/...` if `served` is true. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:validation:MinLength=1 | |
// +kubebuilder:validation:Pattern=^v[1-9][0-9]*([a-z]+[1-9][0-9]*)?$ | |
Name string `json:"name"` | |
// served is a flag enabling/disabling this version from being served via REST APIs | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
// +kubebuilder:default=true | |
Served bool `json:"served"` | |
// storage indicates this version should be used when persisting custom resources to storage. | |
// There must be exactly one version with storage=true. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
Storage bool `json:"storage"` | |
// deprecated indicates this version of the custom resource API is deprecated. | |
// When set to true, API requests to this version receive a warning header in the server response. | |
// Defaults to false. | |
// | |
// +optional | |
Deprecated bool `json:"deprecated,omitempty"` | |
// deprecationWarning overrides the default warning returned to API clients. | |
// May only be set when `deprecated` is true. | |
// The default warning indicates this version is deprecated and recommends use | |
// of the newest served version of equal or greater stability, if one exists. | |
// | |
// +optional | |
DeprecationWarning *string `json:"deprecationWarning,omitempty"` | |
// schema describes the structural schema used for validation, pruning, and defaulting | |
// of this version of the custom resource. | |
// | |
// +required | |
// +kubebuilder:validation:Required | |
Schema ServiceExportResourceSchema `json:"schema"` | |
// subresources specify what subresources this version of the defined custom resource have. | |
// | |
// +optional | |
Subresources apiextensionsv1.CustomResourceSubresources `json:"subresources,omitempty"` | |
// additionalPrinterColumns specifies additional columns returned in Table output. | |
// See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. | |
// If no columns are specified, a single column displaying the age of the custom resource is used. | |
// | |
// +optional | |
// +listType=map | |
// +listMapKey=name | |
AdditionalPrinterColumns []apiextensionsv1.CustomResourceColumnDefinition `json:"additionalPrinterColumns,omitempty"` | |
} | |
type ServiceExportResourceSchema struct { | |
// openAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning. | |
// | |
// +kubebuilder:pruning:PreserveUnknownFields | |
// +structType=atomic | |
// +required | |
// +kubebuilder:validation:Required | |
OpenAPIV3Schema runtime.RawExtension `json:"openAPIV3Schema"` | |
} | |
// ServiceExportResourceStatus stores status information about a ServiceExportResource. It | |
// reflects the status of the CRD of the consumer cluster. | |
type ServiceExportResourceStatus struct { | |
// acceptedNames are the names that are actually being used to serve discovery. | |
// They may be different than the names in spec. | |
// +optional | |
AcceptedNames apiextensionsv1.CustomResourceDefinitionNames `json:"acceptedNames"` | |
// storedVersions lists all versions of CustomResources that were ever persisted. Tracking these | |
// versions allows a migration path for stored versions in etcd. The field is mutable | |
// so a migration controller can finish a migration to another version (ensuring | |
// no old objects are left in storage), and then remove the rest of the | |
// versions from this list. | |
// Versions may not be removed from `spec.versions` while they exist in this list. | |
// +optional | |
StoredVersions []string `json:"storedVersions"` | |
// conditions is a list of conditions that apply to the ServiceExportResource. It is | |
// updated by the konnector on the consumer cluster. | |
Conditions conditionsapi.Conditions `json:"conditions,omitempty"` | |
} | |
// ServiceExportResourceList is the objects list that represents the ServiceExport. | |
// | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
type ServiceExportResourceList struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ListMeta `json:"metadata"` | |
Items []ServiceExportResource `json:"items"` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2022 The Kube Bind Authors. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
*/ | |
package v1alpha1 | |
import ( | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
) | |
const ( | |
ServiceNamespaceAnnotationKey = "kube-bind.io/service-namespace" | |
) | |
// ServiceNamespace defines how consumer namespaces map to service namespaces. | |
// These objects are created by the konnector, and a service namespace is then | |
// created by the service provider. | |
// | |
// The name of the ServiceNamespace equals the namespace name in the consumer | |
// cluster. | |
// | |
// +crd | |
// +genclient | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
// +kubebuilder:resource:scope=Namespaced,categories=kube-bindings | |
// +kubebuilder:subresource:status | |
// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=`.status.namespace`,priority=0 | |
type ServiceNamespace struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ObjectMeta `json:"metadata,omitempty"` | |
// spec specifies a service namespace. | |
Spec ServiceNamespaceSpec `json:"spec"` | |
// status contains reconciliation information for a service namespace | |
Status ServiceNamespaceStatus `json:"status,omitempty"` | |
} | |
type ServiceNamespaceSpec struct { | |
} | |
type ServiceNamespaceStatus struct { | |
// namespace is the service provider namespace name that will be bound to the | |
// consumer namespace named like this object. | |
Namespace string `json:"namespace,omitempty"` | |
} | |
// ServiceNamespaceList is the list of ServiceNamespaces. | |
// | |
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | |
type ServiceNamespaceList struct { | |
metav1.TypeMeta `json:",inline"` | |
metav1.ListMeta `json:"metadata"` | |
Items []ServiceNamespace `json:"items"` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment