|
| 1 | +/* |
| 2 | +
|
| 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 v1alpha4 |
| 18 | + |
| 19 | +import ( |
| 20 | + v1 "k8s.io/api/core/v1" |
| 21 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | +) |
| 23 | + |
| 24 | +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! |
| 25 | +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. |
| 26 | + |
| 27 | +const ( |
| 28 | + // IBMPowerVSMachineFinalizer allows IBMPowerVSMachineReconciler to clean up resources associated with IBMPowerVSMachine before |
| 29 | + // removing it from the apiserver. |
| 30 | + IBMPowerVSMachineFinalizer = "ibmpowervsmachine.infrastructure.cluster.x-k8s.io" |
| 31 | +) |
| 32 | + |
| 33 | +// IBMPowerVSMachineSpec defines the desired state of IBMPowerVSMachine |
| 34 | +type IBMPowerVSMachineSpec struct { |
| 35 | + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster |
| 36 | + // Important: Run "make" to regenerate code after modifying this file |
| 37 | + |
| 38 | + // ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed |
| 39 | + ServiceInstanceID string `json:"serviceInstanceID"` |
| 40 | + |
| 41 | + // SSHKey is the name of the SSH key pair provided to the vsi for authenticating users |
| 42 | + SSHKey string `json:"sshKey,omitempty"` |
| 43 | + |
| 44 | + // ImageID is the id of OS image which would be install on the instance. |
| 45 | + // Example: c57eef35-ea0b-45d7-b864-4b0d4893425b |
| 46 | + ImageID string `json:"imageID"` |
| 47 | + |
| 48 | + // SysType is the System type used to host the vsi |
| 49 | + SysType string `json:"sysType"` |
| 50 | + |
| 51 | + // ProcType is the processor type, e.g: dedicated, shared, capped |
| 52 | + ProcType string `json:"procType"` |
| 53 | + |
| 54 | + // Processors is Number of processors allocated |
| 55 | + Processors string `json:"processors"` |
| 56 | + |
| 57 | + // Memory is Amount of memory allocated (in GB) |
| 58 | + Memory string `json:"memory"` |
| 59 | + |
| 60 | + // NetworkID is network ID used for the VSI |
| 61 | + NetworkID string `json:"networkID"` |
| 62 | + |
| 63 | + // ProviderID is the unique identifier as specified by the cloud provider. |
| 64 | + // +optional |
| 65 | + ProviderID *string `json:"providerID,omitempty"` |
| 66 | +} |
| 67 | + |
| 68 | +// IBMPowerVSMachineStatus defines the observed state of IBMPowerVSMachine |
| 69 | +type IBMPowerVSMachineStatus struct { |
| 70 | + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster |
| 71 | + // Important: Run "make" to regenerate code after modifying this file |
| 72 | + |
| 73 | + InstanceID string `json:"instanceID,omitempty"` |
| 74 | + |
| 75 | + // Ready is true when the provider resource is ready. |
| 76 | + // +optional |
| 77 | + Ready bool `json:"ready"` |
| 78 | + |
| 79 | + // Addresses contains the vsi associated addresses. |
| 80 | + Addresses []v1.NodeAddress `json:"addresses,omitempty"` |
| 81 | + |
| 82 | + // Health is the health of the vsi |
| 83 | + // +optional |
| 84 | + Health string `json:"health,omitempty"` |
| 85 | + |
| 86 | + // InstanceState is the status of the vsi |
| 87 | + InstanceState string `json:"instanceState"` |
| 88 | + |
| 89 | + // Fault will report if any fault messages for the vsi |
| 90 | + // +optional |
| 91 | + Fault string `json:"fault,omitempty"` |
| 92 | +} |
| 93 | + |
| 94 | +// +kubebuilder:subresource:status |
| 95 | +// +kubebuilder:object:root=true |
| 96 | +// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this IBMPowerVSMachine belongs" |
| 97 | +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for IBM PowerVS instances" |
| 98 | +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.instanceState",description="PowerVS instance state" |
| 99 | +// +kubebuilder:printcolumn:name="Health",type="string",JSONPath=".status.health",description="PowerVS instance health" |
| 100 | + |
| 101 | +// IBMPowerVSMachine is the Schema for the ibmpowervsmachines API |
| 102 | +type IBMPowerVSMachine struct { |
| 103 | + metav1.TypeMeta `json:",inline"` |
| 104 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 105 | + |
| 106 | + Spec IBMPowerVSMachineSpec `json:"spec,omitempty"` |
| 107 | + Status IBMPowerVSMachineStatus `json:"status,omitempty"` |
| 108 | +} |
| 109 | + |
| 110 | +// +kubebuilder:object:root=true |
| 111 | + |
| 112 | +// IBMPowerVSMachineList contains a list of IBMPowerVSMachine |
| 113 | +type IBMPowerVSMachineList struct { |
| 114 | + metav1.TypeMeta `json:",inline"` |
| 115 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 116 | + Items []IBMPowerVSMachine `json:"items"` |
| 117 | +} |
| 118 | + |
| 119 | +func init() { |
| 120 | + SchemeBuilder.Register(&IBMPowerVSMachine{}, &IBMPowerVSMachineList{}) |
| 121 | +} |
0 commit comments