|
| 1 | +// Copyright 2026 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +package v1alpha1 |
| 16 | + |
| 17 | +import ( |
| 18 | + refsv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" |
| 19 | + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1" |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | +) |
| 22 | + |
| 23 | +var AgentRegistryBindingGVK = GroupVersion.WithKind("AgentRegistryBinding") |
| 24 | + |
| 25 | +// AgentRegistryBindingSpec defines the desired state of AgentRegistryBinding |
| 26 | +// +kcc:spec:proto=google.cloud.agentregistry.v1.Binding |
| 27 | +type AgentRegistryBindingSpec struct { |
| 28 | + // The project that this resource belongs to. |
| 29 | + // +required |
| 30 | + ProjectRef *refsv1beta1.ProjectRef `json:"projectRef"` |
| 31 | + |
| 32 | + // The location of this resource. |
| 33 | + // +required |
| 34 | + Location string `json:"location"` |
| 35 | + |
| 36 | + // The AgentRegistryBinding name. If not given, the metadata.name will be used. |
| 37 | + // +optional |
| 38 | + ResourceID *string `json:"resourceID,omitempty"` |
| 39 | + |
| 40 | + // Optional. User-defined display name for the Binding. |
| 41 | + // Can have a maximum length of 63 characters. |
| 42 | + // +optional |
| 43 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.display_name |
| 44 | + DisplayName *string `json:"displayName,omitempty"` |
| 45 | + |
| 46 | + // Optional. User-defined description of a Binding. |
| 47 | + // Can have a maximum length of 2048 characters. |
| 48 | + // +optional |
| 49 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.description |
| 50 | + Description *string `json:"description,omitempty"` |
| 51 | + |
| 52 | + // The binding for AuthProvider. |
| 53 | + // +optional |
| 54 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.auth_provider_binding |
| 55 | + AuthProviderBinding *AgentRegistryBindingAuthProviderBinding `json:"authProviderBinding,omitempty"` |
| 56 | + |
| 57 | + // Required. The target Agent of the Binding. |
| 58 | + // +required |
| 59 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.source |
| 60 | + Source *AgentRegistryBindingSource `json:"source,omitempty"` |
| 61 | + |
| 62 | + // Required. The target Agent Registry Resource of the Binding. |
| 63 | + // +required |
| 64 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.target |
| 65 | + Target *AgentRegistryBindingTarget `json:"target,omitempty"` |
| 66 | +} |
| 67 | + |
| 68 | +// +kcc:proto=google.cloud.agentregistry.v1.Binding.AuthProviderBinding |
| 69 | +type AgentRegistryBindingAuthProviderBinding struct { |
| 70 | + // Required. The resource name of the target AuthProvider. |
| 71 | + // Format: `projects/{project}/locations/{location}/authProviders/{auth_provider}` |
| 72 | + // +kubebuilder:validation:Required |
| 73 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.AuthProviderBinding.auth_provider |
| 74 | + AuthProvider *string `json:"authProvider"` |
| 75 | + |
| 76 | + // Optional. The list of OAuth2 scopes of the AuthProvider. |
| 77 | + // +kubebuilder:validation:Optional |
| 78 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.AuthProviderBinding.scopes |
| 79 | + Scopes []string `json:"scopes,omitempty"` |
| 80 | + |
| 81 | + // Optional. The continue URI of the AuthProvider. |
| 82 | + // The URI is used to reauthenticate the user and finalize the managed OAuth |
| 83 | + // flow. |
| 84 | + // +kubebuilder:validation:Optional |
| 85 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.AuthProviderBinding.continue_uri |
| 86 | + ContinueURI *string `json:"continueURI,omitempty"` |
| 87 | +} |
| 88 | + |
| 89 | +// +kcc:proto=google.cloud.agentregistry.v1.Binding.Source |
| 90 | +type AgentRegistryBindingSource struct { |
| 91 | + // The identifier of the source Agent. |
| 92 | + // Format: `urn:agent:{publisher}:{namespace}:{name}` |
| 93 | + // +kubebuilder:validation:Required |
| 94 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.Source.identifier |
| 95 | + Identifier *string `json:"identifier"` |
| 96 | +} |
| 97 | + |
| 98 | +// +kcc:proto=google.cloud.agentregistry.v1.Binding.Target |
| 99 | +type AgentRegistryBindingTarget struct { |
| 100 | + // The identifier of the target Agent, MCP Server, or Endpoint. |
| 101 | + // Format: |
| 102 | + // * `urn:agent:{publisher}:{namespace}:{name}` |
| 103 | + // * `urn:mcp:{publisher}:{namespace}:{name}` |
| 104 | + // * `urn:endpoint:{publisher}:{namespace}:{name}` |
| 105 | + // +kubebuilder:validation:Required |
| 106 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.Target.identifier |
| 107 | + Identifier *string `json:"identifier"` |
| 108 | +} |
| 109 | + |
| 110 | +// AgentRegistryBindingStatus defines the config connector machine state of AgentRegistryBinding |
| 111 | +type AgentRegistryBindingStatus struct { |
| 112 | + /* Conditions represent the latest available observations of the |
| 113 | + object's current state. */ |
| 114 | + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` |
| 115 | + |
| 116 | + // ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. |
| 117 | + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` |
| 118 | + |
| 119 | + // A unique specifier for the AgentRegistryBinding resource in GCP. |
| 120 | + ExternalRef *string `json:"externalRef,omitempty"` |
| 121 | + |
| 122 | + // ObservedState is the state of the resource as most recently observed in GCP. |
| 123 | + ObservedState *AgentRegistryBindingObservedState `json:"observedState,omitempty"` |
| 124 | +} |
| 125 | + |
| 126 | +// AgentRegistryBindingObservedState is the state of the AgentRegistryBinding resource as most recently observed in GCP. |
| 127 | +// +kcc:observedstate:proto=google.cloud.agentregistry.v1.Binding |
| 128 | +type AgentRegistryBindingObservedState struct { |
| 129 | + // Output only. Timestamp when this binding was created. |
| 130 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.create_time |
| 131 | + CreateTime *string `json:"createTime,omitempty"` |
| 132 | + |
| 133 | + // Output only. Timestamp when this binding was last updated. |
| 134 | + // +kcc:proto:field=google.cloud.agentregistry.v1.Binding.update_time |
| 135 | + UpdateTime *string `json:"updateTime,omitempty"` |
| 136 | +} |
| 137 | + |
| 138 | +// +genclient |
| 139 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 140 | +// +kubebuilder:resource:categories=gcp,shortName=gcpagentregistrybinding;gcpagentregistrybindings |
| 141 | +// +kubebuilder:subresource:status |
| 142 | +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true" |
| 143 | +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/system=true" |
| 144 | +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/stability-level=alpha" |
| 145 | +// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date" |
| 146 | +// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded" |
| 147 | +// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'" |
| 148 | +// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'" |
| 149 | + |
| 150 | +// AgentRegistryBinding is the Schema for the AgentRegistryBinding API |
| 151 | +// +k8s:openapi-gen=true |
| 152 | +type AgentRegistryBinding struct { |
| 153 | + metav1.TypeMeta `json:",inline"` |
| 154 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 155 | + |
| 156 | + // +required |
| 157 | + Spec AgentRegistryBindingSpec `json:"spec,omitempty"` |
| 158 | + Status AgentRegistryBindingStatus `json:"status,omitempty"` |
| 159 | +} |
| 160 | + |
| 161 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 162 | +// AgentRegistryBindingList contains a list of AgentRegistryBinding |
| 163 | +type AgentRegistryBindingList struct { |
| 164 | + metav1.TypeMeta `json:",inline"` |
| 165 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 166 | + Items []AgentRegistryBinding `json:"items"` |
| 167 | +} |
| 168 | + |
| 169 | +func init() { |
| 170 | + SchemeBuilder.Register(&AgentRegistryBinding{}, &AgentRegistryBindingList{}) |
| 171 | +} |
0 commit comments