cluster-bootstrap-controller

command module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

README

cluster-bootstrap-controller

This is a controller that tracks CAPI Cluster objects.

It provides a CR for a ClusterBootstrapConfig which provides a Job template.

When a CAPI Cluster is "provisioned" a Job is created from the template, the template can access multiple fields.

apiVersion: capi.weave.works/v1alpha1
kind: ClusterBootstrapConfig
metadata:
  name: clusterbootstrapconfig-sample
  namespace: default
spec:
  clusterSelector:
    matchLabels:
      demo: "true"
  jobTemplate:
    generateName: 'run-wego-{{ .ObjectMeta.Name }}'
    spec:
      containers:
      - image: alpine:latest
        name: cat-kubeconfig
        volumeMounts:
        - name: kubeconfig
          mountPath: "/etc/wego"
          readOnly: true
        command: ["cat", "/etc/wego/value"]
      restartPolicy: Never
      volumes:
      - name: kubeconfig
        secret:
          secretName: '{{ .ObjectMeta.Name }}-kubeconfig'

This is using Go templating and the Cluster object is provided as the context, this means that expressions like {{ .ObjectMeta.Name }} will get the name of the Cluster that has transitioned to "provisioned".

Annotations

Go templating doesn't easily support access to strings that have "/" in them, which is a common annotation naming strategy.

The templating provides a function called "annotation", this can accept a string annotation which can access an annotation.

e.g.

      volumes:
      - name: kubeconfig
        secret:
          secretName: '{{ annotation "example.com/secret-name }}'

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the capi v1alpha1 API group +kubebuilder:object:generate=true +groupName=capi.weave.works
Package v1alpha1 contains API Schema definitions for the capi v1alpha1 API group +kubebuilder:object:generate=true +groupName=capi.weave.works

Jump to

Keyboard shortcuts

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