nodeexporter

package
Version: v0.0.0-...-bfebeee Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

Node Exporter Configuration Function

Creates Resource configs to deploy Node Exporter on Kubernetes.

Function Features

Function metadata is documented in the ConfigFunction Go type.

Getting Started

In the following example we create Resource configs for a Node Exporter DaemonSet.

Set up a workspace and define a function configuration.

DEMO=$(mktemp -d)
mkdir $DEMO/functions

cat <<EOF >$DEMO/functions/configmap_my-nodeexporter.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-nodeexporter
  namespace: example
  annotations:
    config.kubernetes.io/function: |
      container:
        image: gcr.io/config-functions/nodeexporter:v0.0.1
EOF

Generate Resources.

config run $DEMO

Generated Resources

The function generates the following resources.

EXPECTED='.
├── [Resource]  ConfigMap example/my-nodeexporter
├── [Resource]  DaemonSet example/my-nodeexporter-server
└── [Resource]  Service example/my-nodeexporter-server'

TEST="$(config tree $DEMO --graph-structure=owners)"
[ "$TEST" = "$EXPECTED" ]

Configuration

Default Function Configuration

The function adds any missing configuration fields to the function ConfigMap we created above, populating their values with defaults.

EXPECTED='apiVersion: v1
kind: ConfigMap
metadata:
  name: my-nodeexporter
  namespace: "example"
  labels:
    app.kubernetes.io/instance: my-nodeexporter
    app.kubernetes.io/name: nodeexporter
  annotations:
    config.kubernetes.io/function: |
      container:
        image: gcr.io/config-functions/nodeexporter:v0.0.1'

TEST="$(cat $DEMO/functions/configmap_my-nodeexporter.yaml)"
[ "$TEST" = "$EXPECTED" ]

Cleanup the demo workspace.

rm -rf $DEMO

Documentation

Index

Constants

View Source
const DefaultAppNameAnnotationValue = "nodeexporter"

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigFunction

type ConfigFunction struct {
	cfunc.ConfigFunction `yaml:",inline"`
}

ConfigFunction implements kio.Filter and holds information used in Resource templates.

func (*ConfigFunction) Filter

func (f *ConfigFunction) Filter(in []*yaml.RNode) ([]*yaml.RNode, error)

Filter generates Resources.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL