dataset-operator

module
v0.0.0-...-73ae208 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2021 License: Apache-2.0

README

Dataset Operator

Overview

This operator adds the Dataset CRD (Custom Resource Definition) to a k8s cluster and allows you to create objects like the example in dataset_cr

apiVersion: com.ie.ibm.hpsys/v1alpha1
kind: Dataset
metadata:
  name: example-dataset
spec:
  # Add fields here
  type: COS
  conf:
    onefield: valueaa
    anotherfield: bb

Prerequisites

In order to build the operator there are some tools required:

Getting Started With the Operator

After you have configured kubectl to point to the correct k8s context, invoke ./build-minikube.sh && ./install.sh

If you check with kubectl get pods you should see the operator running:

NAME                               READY   STATUS    RESTARTS   AGE
dataset-operator-644f8d854-dct95   1/1     Running   0          15s

Now you can do kubectl create -f dataset.yaml with a yaml which looks like this:

apiVersion: com.ie.ibm.hpsys/v1alpha1
kind: Dataset
metadata:
  name: example-dataset
spec:
  # Add fields here
  type: COS
  conf:
    onefield: valueaa
    anotherfield: bb

If you check the pods now you should find:

NAME                               READY   STATUS    RESTARTS   AGE
example-dataset-pod                1/1     Running   0          20s
dataset-operator-644f8d854-dct95   1/1     Running   0          3m50s

The demo behavior of the operator is just to create a pod for every dataset object.

Delete the new dataset object and the operator:

./uninstall.sh

Notes

The logic for the controller can be found in dataset_controller.go

Directories

Path Synopsis
cmd
pkg
admissioncontroller
Package mutate deals with AdmissionReview requests and responses, it takes in the request body and returns a readily converted JSON []byte that can be returned from a http Handler w/o needing to further convert or modify it, it also makes testing Mutate() kind of easy w/o need for a fake http server, etc.
Package mutate deals with AdmissionReview requests and responses, it takes in the request body and returns a readily converted JSON []byte that can be returned from a http Handler w/o needing to further convert or modify it, it also makes testing Mutate() kind of easy w/o need for a fake http server, etc.
apis/com
Package com contains com API versions.
Package com contains com API versions.
apis/com/v1alpha1
Package v1alpha1 contains API Schema definitions for the com v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=com.ie.ibm.hpsys Package v1alpha1 contains API Schema definitions for the com v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=com.ie.ibm.hpsys
Package v1alpha1 contains API Schema definitions for the com v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=com.ie.ibm.hpsys Package v1alpha1 contains API Schema definitions for the com v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=com.ie.ibm.hpsys

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL