secretgen

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 9 Imported by: 0

README

secretgen

Requires kustomize 3.2.2 or higher.

A kustomize plugin to generate Kubernetes secrets from sops encrypted files.

Env files generate a secret value per line, other file types use the file as value. Supports combining multiple files into a single secret.

Installation

Kustomize looks for plugins in ~/.config/kustomize/plugin.

go install sigs.k8s.io/kustomize/kustomize/v3
mkdir -p ~/.config/kustomize/plugin/secretgen
curl -Ls https://github.com/julienp/secretgen/releases/download/v0.1.1/secretgen_0.1.1_Darwin_x86_64.tar.gz | tar -C ~/.config/kustomize/plugin/secretgen -xz
Manual Installation
mkdir -p ~/.config/kustomize/plugin/secretgen
go build -o ~/.config/kustomize/plugin/secretgen/secretgen cmd/main.go

Usage

You have to pass the enable_alpha_plugins flag to kustumize when building:

kustomize build --enable_alpha_plugins my-manifests/

Testing

Import the gpg key:

gpg --import test-key.asc

and run the tests:

go test -v .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Secrets []Secret `yaml:"secrets"`
}

type File

type File struct {
	Key      string   `yaml:"key"`
	File     string   `yaml:"file"`
	TryFiles []string `yaml:"tryFiles"`
}

type Metadata

type Metadata struct {
	Name        string            `yaml:"name"`
	Namespace   string            `yaml:"namespace,omitempty"`
	Annotations map[string]string `yaml:"annotations,omitempty"`
}

type Secret

type Secret struct {
	Name      string   `yaml:"name"`
	Namespace string   `yaml:"namespace"`
	Envs      []string `yaml:"envs"`
	Files     []File   `yaml:"files"`
	Behavior  string   `yaml:"behavior"`
}

type SecretManifest

type SecretManifest struct {
	APIVersion string            `yaml:"apiVersion"`
	Kind       string            `yaml:"kind"`
	Type       string            `yaml:"type"`
	Metadata   Metadata          `yaml:"metadata"`
	Data       map[string]string `yaml:"data"`
}

func Generate

func Generate(c Config, fake bool) []SecretManifest

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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