Versions Compared

Key

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

Goals

This        This document describes the specifications for designing the Binary Provisioning Agent Custom resource Definition required for the Integrated Cloud Native Akraino project iteratively.

1.1. Iterations

        This task will evolve over time and we will keep iterating and modifying this document. Iterations are small steps that will happen within a short period of time with specific tasks to roll out POCs as quickly as possible for feedback inorder to adjust the focus quickly.

2. 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;

...

5.1.  BPA CRD Yaml File (*_crd.yaml)


apiVersion: apiextensions.k8s.io/v1beta1

kind: CustomResourceDefinition

metadata:

  name: provisionings.bpa.akraino.org

spec:

  group: bpa.akraino.org

  names:

    kind: Provisioning

    listKind: ProvisioningList

    plural: provisionings

    singular: provisioning

    shortNames:

    - bpa

  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


5.2. Provisioning Agent Object Definition( *_types,go)

...

      The provisioning_types.go file is the API for the provisioning agent custom resource. 

      

// ProvisioningSpec defines the desired state of Provisioning

type ProvisioningSpec struct {

        Masters []Master `json:"master,omitempty"`

        Workers []Worker `json:"worker,omitempty"`

        Replicas int32  `json:"replicas,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"`

}



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 ProvisioningSpec struct;

...

5.3. Sample Provisioning CR YAML file

      

apiVersion: bpa.akraino.org/v1alpha1

kind: Provisioning

metadata:

  name: provisioning-sample

spec:

  master:

    cpu: 10

    memory: 4Gi

  worker:

    cpu: 20

    memory: 8Gi

  replicas: 2


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. 

...