Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
// ProvisioningSpec defines the desired state of Provisioning
type ProvisioningSpec struct {
        Masters []map[string]Master  `json:"masters,omitempty"`
        Workers []map[string]Worker  `json:"workers,omitempty"`
        HostsFile string `json:"hostfile,omitempty"`
}

// ProvisioningStatus defines the observed state of 
// Provisioning
type ProvisioningStatus struct {
        
}
// 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"`
        MACaddress string `json:"mac-address,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"`
        MACaddress string `json:"mac-address,omitempty"`
}

...

Code Block
languageyml
apiVersion: bpa.akraino.org/v1alpha1
kind: Provisioning
metadata:
  name: provisioning-sample
  labels:
    cluster: cluster-abc
    owner: c1
spec:
  masters:
   - master:
      mac-address: 00:c6:14:04:61:b2
  workers:
    - worker-1:
       mac-address: 00:c6:14:04:61:b2
    - worker-2:
       mac-address: 00:c2:12:03:62:b1
  hostfile: /root/go/src/test-code/hosts.ini


Code Block
languageyml
apiVersion: bpa.akraino.org/v1alpha1
kind: Provisioning
metadata:
  name: provisioning-sample
  labels:
    cluster: cluster-xyz
    owner: c2
spec:
  masters:
   - master-1:
      cpu: 10
      memory: 4Gi
      mac-address: 00:c5:16:05:61:b2
   - master-2:
      cpu: 10
      memory: 4Gi
      mac-address: 00:c2:14:06:61:b5
  workers:
   - worker:
      cpu: 20
      memory: 8Gi
      mac-address: 00:c6:14:04:61:b2
  hostfile: /root/go/src/test-code/hosts.ini


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. 

...