...
Code Block |
---|
// ProvisioningSpec defines the desired state of Provisioning
type ProvisioningSpec struct {
Masters []Master `json:"master,omitempty"`
Workers []Worker `json:"worker,omitempty"`
MACaddress string `json:"mac-address,omitempty"`
}
// ProvisioningStatus defines the observed state of
// Provisioning
type ProvisioningStatus struct {
// Names of provisioning agent pods when a deployment
// is running
PodAgents []string `json"podAgents,omitempty"`
}
// Provisioning is the Schema for the provisionings API
type Provisioning struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ProvisioningSpec `json:"spec,omitempty"`
Status ProvisioningStatus `json:"status,omitempty"`
}
// ProvisioningList contains a list of Provisioning
type ProvisioningList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Provisioning `json:"items"`
}
// master struct contains resource requirements for a master
// node
type Master struct {
CPU int32 `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
}
// worker struct contains resource requirements for a worker node
type Worker struct {
CPU int32 `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
SRIOV bool `json:"sriov,omitempty"`
QAT bool `json:"qat,omitempty"`
}
|
...
Code Block | ||
---|---|---|
| ||
apiVersion: bpa.akraino.org/v1alpha1
kind: Provisioning
metadata:
name: provisioning-sample
spec:
master:
cpu: 10
memory: 4Gi
worker:
cpu: 20
memory: 8Gi
mac-address: 00:c6:14:04:61:b2 |
The YAML file above can be used to create a provisioning custom resource which is an instance of the provisioning CRD describes above. The spec.master field corresponds to the Masters variable in the ProvisioningSpec struct of the *-types.go file, while the spec.worker field corresponds to the Workers variable in the ProvisioningSpec struct of the *-types.go file and the spec.replica field corresponds to the Replicas variable in the same struct.
...