basicextension

command
v3.0.0-alpha.0....-8bbcfa4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

Kustomize Example

This directory contains an example of extending the kubebuilder config-gen by creating a second kustomize transformer plugin which is composed with config-gen.

Prerequisites

Install the extension as a plugin

The extension is a separate plugin composed with the config-gen plugin.

# build the extension
go build -o ~/go/bin/basicextension .

# setup the extension plugin
export XDG_CONFIG_HOME=$HOME/.config
export KUBEBUILDER_PLUGIN=$XDG_CONFIG_HOME/kustomize/plugin/kubebuilder.sigs.k8s.io/kubebuilderconfiggenbasicextension
mkdir -p $KUBEBUILDER_PLUGIN
cat > $KUBEBUILDER_PLUGIN/KubebuilderConfigGenBasicExtension <<EOF
#!/bin/bash 
KUSTOMIZE_FUNCTION=true basicextension
EOF
chmod +x $KUBEBUILDER_PLUGIN/KubebuilderConfigGenBasicExtension

Modify the kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

transformers:
# this is the original kubebuilder configuration generator
- |-
  apiVersion: kubebuilder.sigs.k8s.io/v1alpha1
  kind: KubebuilderConfigGen
  metadata:
    name: example
  spec:
    # contains kubebuilder project go code for generating crds
    projectDirectory: ../../testdata/project/...

    # image containing controller-manager
    image: example/simple:latest
# this is the extension which modifies the output from the KubebuilderConfigGen
- |-
  apiVersion: kubebuilder.sigs.k8s.io
  kind: KubebuilderConfigGenBasicExtension
  metadata:
    name: example
  replicas: 5

Run kustomize

kustomize build --enable-alpha-plugins

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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