|
| 1 | +/* |
| 2 | +Copyright 2025 The Kubernetes 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 | + clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" |
| 22 | +) |
| 23 | + |
| 24 | +// GKEConfigSpec defines the desired state of GCP GKE Bootstrap Configuration. |
| 25 | +type GKEConfigSpec struct{} |
| 26 | + |
| 27 | +// +kubebuilder:object:root=true |
| 28 | +// +kubebuilder:resource:path=gkeconfigs,scope=Namespaced,categories=cluster-api,shortName=gkec |
| 29 | +// +kubebuilder:storageversion |
| 30 | +// +kubebuilder:subresource:status |
| 31 | +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Bootstrap configuration is ready" |
| 32 | +// +kubebuilder:printcolumn:name="DataSecretName",type="string",JSONPath=".status.dataSecretName",description="Name of Secret containing bootstrap data" |
| 33 | + |
| 34 | +// GKEConfig is the schema for the GCP GKE Bootstrap Configuration. |
| 35 | +// this is a placeholder used for compliance with the CAPI contract. |
| 36 | +type GKEConfig struct { |
| 37 | + metav1.TypeMeta `json:",inline"` |
| 38 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 39 | + |
| 40 | + Spec GKEConfigSpec `json:"spec,omitempty"` |
| 41 | + Status GKEConfigStatus `json:"status,omitempty"` |
| 42 | +} |
| 43 | + |
| 44 | +// GKEConfigStatus defines the observed state of the GCP GKE Bootstrap Configuration. |
| 45 | +type GKEConfigStatus struct { |
| 46 | + // Ready indicates the BootstrapData secret is ready to be consumed |
| 47 | + Ready bool `json:"ready,omitempty"` |
| 48 | + |
| 49 | + // DataSecretName is the name of the secret that stores the bootstrap data script. |
| 50 | + // +optional |
| 51 | + DataSecretName *string `json:"dataSecretName,omitempty"` |
| 52 | + |
| 53 | + // FailureReason will be set on non-retryable errors |
| 54 | + // +optional |
| 55 | + FailureReason string `json:"failureReason,omitempty"` |
| 56 | + |
| 57 | + // FailureMessage will be set on non-retryable errors |
| 58 | + // +optional |
| 59 | + FailureMessage string `json:"failureMessage,omitempty"` |
| 60 | + |
| 61 | + // ObservedGeneration is the latest generation observed by the controller. |
| 62 | + // +optional |
| 63 | + ObservedGeneration int64 `json:"observedGeneration,omitempty"` |
| 64 | + |
| 65 | + // Conditions defines current service state of the GKEConfig. |
| 66 | + // +optional |
| 67 | + Conditions clusterv1.Conditions `json:"conditions,omitempty"` |
| 68 | +} |
| 69 | + |
| 70 | +// +kubebuilder:object:root=true |
| 71 | + |
| 72 | +// GKEConfigList contains a list of GCP GKE Bootstrap Configuration. |
| 73 | +type GKEConfigList struct { |
| 74 | + metav1.TypeMeta `json:",inline"` |
| 75 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 76 | + Items []GKEConfig `json:"items"` |
| 77 | +} |
| 78 | + |
| 79 | +func init() { |
| 80 | + SchemeBuilder.Register(&GKEConfig{}, &GKEConfigList{}) |
| 81 | +} |
0 commit comments