|
| 1 | +/* |
| 2 | +Copyright 2024. |
| 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 v1alpha1 |
| 18 | + |
| 19 | +import ( |
| 20 | + refv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" |
| 21 | + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/k8s/v1alpha1" |
| 22 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 23 | +) |
| 24 | + |
| 25 | +// CloudBuildWorkerPoolSpec defines the desired state of Instance |
| 26 | +type CloudBuildWorkerPoolSpec struct { |
| 27 | + Name string `json:"name,omitempty"` |
| 28 | + DisplayName string `json:"displayName,omitempty"` |
| 29 | + ResourceID *string `json:"resourceID,omitempty"` |
| 30 | + // +required |
| 31 | + ProjectRef *refv1beta1.ProjectRef `json:"projectRef"` |
| 32 | + // +required |
| 33 | + Location string `json:"location"` |
| 34 | + // +required |
| 35 | + PrivatePoolConfig *PrivatePoolV1Config `json:"privatePoolV1Config,omitempty"` |
| 36 | +} |
| 37 | + |
| 38 | +type PrivatePoolV1Config struct { |
| 39 | + // +required |
| 40 | + WorkerConfig *WorkerConfig `json:"workerConfig,omitempty"` |
| 41 | + // +optional |
| 42 | + NetworkConfig *NetworkConfig `json:"networkConfig,omitempty"` |
| 43 | +} |
| 44 | + |
| 45 | +type WorkerConfig struct { |
| 46 | + // +optional |
| 47 | + MachineType string `json:"machineType,omitempty"` |
| 48 | + // +optional |
| 49 | + DiskSizeGb int64 `json:"diskSizeGb,omitempty"` |
| 50 | +} |
| 51 | + |
| 52 | +type NetworkConfig struct { |
| 53 | + // +required |
| 54 | + PeeredNetworkRef refv1beta1.ComputeNetworkRef `json:"peeredNetworkRef,omitempty"` |
| 55 | + // +optional |
| 56 | + EgressOption string `json:"egressOption,omitempty"` |
| 57 | + // +optional |
| 58 | + PeeredNetworkIPRange string `json:"peeredNetworkIPRange,omitempty"` |
| 59 | +} |
| 60 | + |
| 61 | +// CloudBuildWorkerPoolStatus defines the observed state of Instance |
| 62 | +type CloudBuildWorkerPoolStatus struct { |
| 63 | + /* Conditions represent the latest available observations of the |
| 64 | + object's current state. */ |
| 65 | + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` |
| 66 | + |
| 67 | + /* 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. */ |
| 68 | + // +optional |
| 69 | + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` |
| 70 | + |
| 71 | + /* ObservedState is the state of the resource as most recently observed in GCP. */ |
| 72 | + // +optional |
| 73 | + ObservedState *CloudBuildWorkerPoolObservedState `json:"observedState,omitempty"` |
| 74 | +} |
| 75 | + |
| 76 | +type CloudBuildWorkerPoolObservedState struct { |
| 77 | + /* The creation timestamp of the workerpool.*/ |
| 78 | + // +optional |
| 79 | + // +kubebuilder:validation:Format=date-time |
| 80 | + CreateTime *string `json:"createTime,omitempty"` |
| 81 | + |
| 82 | + /* The last update timestamp of the workerpool.*/ |
| 83 | + // +optional |
| 84 | + // +kubebuilder:validation:Format=date-time |
| 85 | + UpdateTime *string `json:"updateTime,omitempty"` |
| 86 | + // +optional |
| 87 | + WorkerConfig *WorkerConfig `json:"workerConfig,omitempty"` |
| 88 | + NetworkConfig *NetworkConfigState `json:"networkConfig,omitempty"` |
| 89 | +} |
| 90 | + |
| 91 | +type NetworkConfigState struct { |
| 92 | + // +optional |
| 93 | + PeeredNetwork string `json:"peeredNetwork,omitempty"` |
| 94 | + // +optional |
| 95 | + EgressOption string `json:"egressOption,omitempty"` |
| 96 | + // +optional |
| 97 | + PeeredNetworkIPRange string `json:"peeredNetworkIPRange,omitempty"` |
| 98 | +} |
| 99 | + |
| 100 | +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/stability-level=beta" |
| 101 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 102 | +// CloudBuildWorkerPool is the Schema for the CloudBuild WorkerPool API |
| 103 | +// +kubebuilder:subresource:status |
| 104 | +type CloudBuildWorkerPool struct { |
| 105 | + metav1.TypeMeta `json:",inline"` |
| 106 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 107 | + |
| 108 | + Spec CloudBuildWorkerPoolSpec `json:"spec,omitempty"` |
| 109 | + Status CloudBuildWorkerPoolStatus `json:"status,omitempty"` |
| 110 | +} |
| 111 | + |
| 112 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 113 | +// CloudBuildWorkerPoolList contains a list of WorkerPool |
| 114 | +type CloudBuildWorkerPoolList struct { |
| 115 | + metav1.TypeMeta `json:",inline"` |
| 116 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 117 | + Items []CloudBuildWorkerPool `json:"items"` |
| 118 | +} |
| 119 | + |
| 120 | +func init() { |
| 121 | + SchemeBuilder.Register(&CloudBuildWorkerPool{}, &CloudBuildWorkerPoolList{}) |
| 122 | +} |
0 commit comments