Versions Compared

Key

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

Goals

This wiki describes the specifications for designing the Binary Provisioning Agent required for the Integrated Cloud Native Akraino project. 

...

Code Block
// ProvisioningSpec defines the desired state of Provisioning
// +k8s:openapi-gen=true
type ProvisioningSpec struct {
	// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
	// Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
	Masters []map[string]Master  `json:"masters,omitempty"`
	Workers []map[string]Worker  `json:"workers,omitempty"`
	KUDPlugins []string `json:"KUDPlugins,omitempty"`
}

// ProvisioningStatus defines the observed state of Provisioning
// +k8s:openapi-gen=true
type ProvisioningStatus struct {
	// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
	// Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Provisioning is the Schema for the provisionings API
// +k8s:openapi-gen=true
// +kubebuilder:subresource:status
type Provisioning struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ProvisioningSpec   `json:"spec,omitempty"`
	Status ProvisioningStatus `json:"status,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// 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 {
	MACaddress string `json:"mac-address,omitempty"`
	CPU int32  `json:"cpu,omitempty"`
	Memory string  `json:"memory,omitempty"`
}

// worker struct contains resource requirements for a worker node
type Worker struct {
	MACaddress string `json:"mac-address,omitempty"`
	CPU int32 `json:"cpu,omitempty"`
	Memory string  `json:"memory,omitempty"`
	SRIOV bool  `json:"sriov,omitempty"`
	QAT  bool      `json:"qat,omitempty"`
}

func init() {
	SchemeBuilder.Register(&Provisioning{}, &ProvisioningList{})
}


The variables in the ProvisioningSpec struct are used to create the data structures in the yaml spec for the custom resource. Three variables are added to the
ProvisioningSpecstruct;

  1. Masters: This variable will contain an array of Master objects. The master struct as defined in the *-types.go file above contains CPU and memory information, this information would be used by the BPA operator to determine which compute nodes to assign the role of Master to when it gets the baremetal list from the API server.
  2. Workers: This variable will contain an array of Worker objects. Similar to the case of the Masters variables, the Worker struct will contain resource requirements for the Worker nodes and the BPA operator will use this information to determine which hosts to assign the role of worker.
  3. KUDPlugins: This variable will contain the list of KUD plugins to be installed with KUD in the cluster

...

Code Block
languageyml
apiVersion: bpa.akraino.org/v1alpha1
kind: softwareSoftware
metadata:
  name: software-sample
  labels:
    cluster: cluster-abcxyz
    owner: c1
  name: example-software
spec:
  mastermasterSoftware:
    softwareFrom:
 - curl
    - htop
    - configMapRefjq:
         nameversion: master-configmap1.5+dfsg-1ubuntu0.1
    - workermaven:
     softwareFrom:
    version: 3.3.9-3
  workerSoftware:
    - curl
    - configMapRef:htop
    - tmux
   name: worker-configmap jq

Cluster CRD

The cluster CRD will have the Cluster name and contain the provisioning CR and/or the software CR for the specified cluster

...