Goals
This wiki describes the specifications for designing the Binary Provisioning Agent required for the Integrated Cloud Native Akraino project.
Overview of BPA
The BPA is part of the infra local controller which runs as a bootstrap k8s cluster in the ICN project. As described in Integrated Cloud Native Akraino project, the purpose of the BPA is to install packages that cannot be installed using kubectl. It will be called once the operating system (Linux) has been installed in the compute nodes by the baremetal operator. The Binary Provisioning Agent will carry out the following functions;
...
We do not intend to make any changes to the existing kubernetes API in order to implement the specifications described in this document. We will simply be extending the Kubernetes API using Custom Resource Definition as described here and then creating a custom controller that will handle the requirements of our provisioning Agent custom resource.
Overview of Proposed Workflow for provisioning CRD
Prerequisites: This workflow assumes that the baremetal CR and baremetal operator have been created and has successfully installed the compute nodes with Linux OS. It also assumes that the BPA controller is running.
...
Fig 1: Illustration of the proposed workflow
Workflow Summary/Description
...
Create the BPA Custom Resource
...
The BPA Operator continues to watch the k8s API server and once it sees that a new BPA CR object has been created, it queries the k8s API server for the Baremetal hosts lists. The baremetal hosts lists contains information about the compute nodes provisioned including the IP address, CPU, memory..etc of each host.
...
The BPA operator looks into the baremetal hosts list and knows which hosts should be master and which should be workers. As the master and worker fields have various parameters, it can do this in various ways;
- If the MAC address is provided in the BPA CR object, it compares that value with the value in the hosts list and assigns the roles. For example if a mac address of 00:c5:16:05:61:b2 is specified for master in the BPA CR spec, it checks the baremetal list for a host that has that MAC address and gives it the role of master.
- If there is no MAC address specified but just resources, it checks the baremetal list for hosts that meet the resource requirements
- If both MAC address and resource requirements are provided, it finds the host with the specified MAC address and confirms that the host meets the resource requirement provided in the BPA CR and then assigns the role.
...
The BPA operator then creates the hosts.ini file using the assigned roles and their corresponding IP addresses.
...
The BPA operator then installs kubernetes using kubespray on the compute nodes thus creating an active kubernetes cluster. During installation, it would continue to check the status of the installation
...
provisioning Agent custom resource.
Overview of Proposed Workflow for provisioning CRD
Prerequisites: This workflow assumes that the baremetal CR and baremetal operator have been created and has successfully installed the compute nodes with Linux OS. It also assumes that the BPA controller is running.
Fig 1: Illustration of the proposed workflow
Workflow Summary/Description
- Create Provisioning CRD and Software CRD
- The CRDs are stored in ETCD
- Start the BPA controller (It then watches for the creation of either a software CR or provisioning CR (We will be focusing on the provisioning CR) here).
Create an instance of the Provisioning Custom Resource, this can be done at any instance once the BPA operator is running
The BPA Operator continues to watch the k8s API server and once it sees that a new BPA CR object has been created, it queries the k8s API server for the Baremetal hosts lists. The baremetal hosts lists contains information about the compute nodes provisioned.
- Confirm that all the hosts specified in the provisioning CR exist in the Baremetal hosts list, then query the DHCP lease file using the MAC address of each host to get the corresponding IP addresses.
Create the hosts.ini file using the roles specified in the provisioning CR and the MAC addresses from 6 above.
- Once the hosts.ini file is created, start the KUD job.
- KUD job installs kud in the host.
BPA operator spawns a thread that continues to check the status of the KUD job.
- Once the KUD installation is completed, the BPA operator, creates a configmap for that cluster, the configmap contains a mapping of the IP address to the host label specified in the provisioning CR. (Step 11 is not shown in the diagram). This configmap will be used when the BPA operator is installing software specified in the software CR (see BPA Software CR Specs).
BPA CRD
The BPA CRD tells the Kubernetes API how to expose the provisioning custom resource object. The CRD yaml file is applied using
...
The provisioning_types.go file is the API for the provisioning agent custom resource.
...
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 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 { CPU int32 MACaddress string `json:"cpumac-address,omitempty"` Memory string CPU int32 `json:"memorycpu,omitempty"` Memory string MACaddress string `json:"mac-addressmemory,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() { MACaddress string `json:"mac-address,omitempty"` 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;
- 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.
- 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.
- Replicas: An integer that defines the number of pods that should run when the CR is deployed.KUDPlugins: This variable will contain the list of KUD plugins to be installed with KUD in the cluster
Sample Provisioning CR YAML files
...
Code Block | ||
---|---|---|
| ||
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 - masterworker-2: mac-address: 00:c6c2:1412:0403:6162:b2 workers: b1 |
Code Block | ||
---|---|---|
| ||
apiVersion: bpa.akraino.org/v1alpha1 kind: Provisioning metadata: name: sample- worker-1kud-plugins labels: cluster: cluster-efg mac-addressowner: c2 00:c6:14:04:61:b2spec: masters: - workermaster-21: mac-address: 00:c2e1:12ba:03ce:62df:b1bd hostfileKUDPlugins: /root/go/src/hosts.ini - onap4k8s |
Code Block | ||
---|---|---|
| ||
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.go file.
Based on the values above, when the BPA operator gets the baremetal hosts object (Step 5in figure 1), it would assign hosts with 10 CPUs and 4Gi memory the role of master and it would assign hosts with 20CPUs and 8Gi memory the role of worker.Currently the cpu and memory fields are not used by the BPA operator code. More Provisioning CRs can be found in here.
Sample Baremetal Lists from Query
...
The software CRD will install the required software, drivers and perform software updates. See BPA Software CR Specs.
Draft Software CRD
Code Block | ||
---|---|---|
| ||
apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: software.bpa.akraino.org spec: group: bpa.akraino.org names: kind: software listKind: softwarerList plural: software singular: software shortNames: - su scope: Namespaced subresources: status: {} validation: openAPIV3Schema: properties: apiVersion: description: type: string kind: description: type: string metadata: type: object spec: type: object status: type: object version: v1alpha1 versions: - name: v1alpha1 served: true storage: true |
...
Code Block | ||
---|---|---|
| ||
apiVersion: bpa.akraino.org/v1alpha1 kind: softwareSoftware metadata: name: software-sample labels: cluster: cluster-abcxyz owner: c1 name: example-software spec: masterSoftware: - curl - htop - masterjq: softwareFrom: version: 1.5+dfsg-1ubuntu0.1 - configMapRefmaven: nameversion: master-configmap3.3.9-3 workerworkerSoftware: - softwareFrom: 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
...
Code Block | ||
---|---|---|
| ||
apiVersion: bpa.akraino.org/v1alpha1 kind: cluster metadata: name: cluster-sample labels: cluster: cluster-abc owner: c1 spec: provisioningCR: "provisioning-sample" softwareCR: "software-sample" |
Open Questions
...
Future Work
This proposal would make it possible to assign roles to nodes based on the features discovered. Currently, the proposal makes use of CPU, memory, SRIOV and QAT. However the to nodes based on the features discovered. The baremetal operator list returns much more information about the nodes, we would be able to extend this the feature to allow the operator assign roles based on more determine the right nodes to use complex requirements such as CPU model, memory, CPU..etc This would feed into Hardware Platform Awareness (HPA)
References
- https://wikilf-akraino.akrainoatlassian.orgnet/wiki/pages/viewpage.action?pageId=1199587713665333&show-miniview
- https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#advanced-topics
Presentation:
View file name Akraino-Intergrated-Cloud-Native-NestedK8s HA.pptx height 250