|
| 1 | +/* |
| 2 | +Copyright The Karbour Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1beta1 |
| 18 | + |
| 19 | +import ( |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | +) |
| 22 | + |
| 23 | +type CredentialType string |
| 24 | + |
| 25 | +const ( |
| 26 | + CredentialTypeServiceAccountToken CredentialType = "ServiceAccountToken" |
| 27 | + CredentialTypeX509Certificate CredentialType = "X509Certificate" |
| 28 | +) |
| 29 | + |
| 30 | +// +genclient |
| 31 | +// +genclient:nonNamespaced |
| 32 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 33 | + |
| 34 | +// Cluster is an extension type to access a cluster |
| 35 | +type Cluster struct { |
| 36 | + metav1.TypeMeta `json:",inline"` |
| 37 | + metav1.ObjectMeta `json:"metadata,omitempty"` //nolint:tagliatelle |
| 38 | + |
| 39 | + Spec ClusterSpec `json:"spec"` |
| 40 | + // +optional |
| 41 | + Status ClusterStatus `json:"status,omitempty"` |
| 42 | +} |
| 43 | + |
| 44 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 45 | + |
| 46 | +// ClusterList is a list of Cluster objects. |
| 47 | +type ClusterList struct { |
| 48 | + metav1.TypeMeta `json:",inline"` |
| 49 | + metav1.ListMeta `json:"metadata,omitempty"` //nolint:tagliatelle |
| 50 | + |
| 51 | + Items []Cluster `json:"items"` |
| 52 | +} |
| 53 | + |
| 54 | +type ClusterSpec struct { |
| 55 | + Provider string `json:"provider"` |
| 56 | + Access ClusterAccess `json:"access"` |
| 57 | + // +optional |
| 58 | + Description string `json:"description"` |
| 59 | + DisplayName string `json:"displayName"` |
| 60 | + Finalized *bool `json:"finalized,omitempty"` |
| 61 | +} |
| 62 | + |
| 63 | +type ClusterStatus struct { |
| 64 | + // +optional |
| 65 | + Healthy bool `json:"healthy,omitempty"` |
| 66 | +} |
| 67 | + |
| 68 | +type ClusterAccess struct { |
| 69 | + Endpoint string `json:"endpoint"` |
| 70 | + // +optional |
| 71 | + CABundle []byte `json:"caBundle,omitempty"` |
| 72 | + // +optional |
| 73 | + Insecure *bool `json:"insecure,omitempty"` |
| 74 | + // +optional |
| 75 | + Credential *ClusterAccessCredential `json:"credential,omitempty"` |
| 76 | +} |
| 77 | + |
| 78 | +type ClusterAccessCredential struct { |
| 79 | + Type CredentialType `json:"type"` |
| 80 | + // +optional |
| 81 | + ServiceAccountToken string `json:"serviceAccountToken,omitempty"` |
| 82 | + // +optional |
| 83 | + X509 *X509 `json:"x509,omitempty"` |
| 84 | +} |
| 85 | + |
| 86 | +type X509 struct { |
| 87 | + Certificate []byte `json:"certificate"` |
| 88 | + PrivateKey []byte `json:"privateKey"` |
| 89 | +} |
| 90 | + |
| 91 | +// +k8s:conversion-gen:explicit-from=net/url.Values |
| 92 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 93 | + |
| 94 | +type ClusterProxyOptions struct { |
| 95 | + metav1.TypeMeta `json:",inline"` |
| 96 | + |
| 97 | + // Path is the target api path of the proxy request. |
| 98 | + // e.g. "/healthz", "/api/v1" |
| 99 | + // +optional |
| 100 | + Path string `json:"path,omitempty"` |
| 101 | +} |
0 commit comments