nfsshare-controller

command module
v0.0.0-...-8224233 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2018 License: Apache-2.0 Imports: 33 Imported by: 0

README

nfsshare-controller

This repository implements a simple controller for watching Nfsshare resources as defined with a CustomResourceDefinition (CRD).

This particular example demonstrates how to perform basic operations such as:

  • How to register a new custom resource (custom resource type) of type Nfsshare using a CustomResourceDefinition.
  • How to create/get/list instances of your new resource type Nfsshare.
  • How to setup a controller on resource handling create/update/delete events.

This is an experiment only.

It makes use of the generators in k8s.io/code-generator to generate a typed client, informers, listers and deep-copy functions. You can do this yourself using the ./hack/update-codegen.sh script.

The update-codegen script will automatically generate the following files & directories:

  • pkg/apis/nfssharecontroller/v1alpha1/zz_generated.deepcopy.go
  • pkg/client/

Changes should not be made to these files manually, and when creating your own controller based off of this implementation you should not copy these files and instead run the update-codegen script to generate your own.

Build and Running

The nfsshare-operator need to be built, wrapped in a container, and then deployed as a single instance Pod on your cluster. You can modify Makefile rules by creating your own PrivateRules.mak file - mine looks like:

REPO_PREFIX = ""
DOCKER_IMAGE = $(REPO_PREFIX)$(DEVICE):$(TAG)

Now work through:

# update the vendor dependencies if you haven't done so already:
$ make deps

# build the operator
$ make build

# Wrap the operator in a container
$ make docker

# Deploy to the currently configured cluster
$ make k8s_deploy

Use

In the deploy/ directory there is an example of creating an nfsshare object deploy/example-nfsshare.yaml and then one for mounting the nfsshare into a Pod deploy/nfstest.yaml. You will need to edit nfstest.yaml so that the volumes.nfs.server value reflects the ClusterIP of the nfsshare object. You can find the nfsshare ClusterIP with:

$ kubectl get svc -o wide -l app=example-nfsshare

See the Makefile for other helpers.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
apis/nfssharecontroller/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/nfssharecontroller/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/nfssharecontroller/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

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