iampolicygenerator

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package gkesagenerator contains a kio.Filter that that generates a iampolicy-related resources for a given cloud provider

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	IAMPolicyGenerator types.IAMPolicyGeneratorArgs `json:",inline,omitempty" yaml:",inline,omitempty"`
}
Example
f := Filter{}
var err = yaml.Unmarshal([]byte(`
cloud: gke
kubernetesService: 
  namespace: k8s-namespace
  name: k8s-sa-name
serviceAccount:
  name: gsa-name
  projectId: project-id
`), &f)
if err != nil {
	log.Fatal(err)
}

err = kio.Pipeline{
	Inputs:  []kio.Reader{},
	Filters: []kio.Filter{f},
	Outputs: []kio.Writer{kio.ByteWriter{Writer: os.Stdout}},
}.Execute()
if err != nil {
	log.Fatal(err)
}
Output:

apiVersion: v1
kind: ServiceAccount
metadata:
  annotations:
    iam.gke.io/gcp-service-account: gsa-name@project-id.iam.gserviceaccount.com
  name: k8s-sa-name
  namespace: k8s-namespace

func (Filter) Filter

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

Filter adds a GKE service account object to nodes

Jump to

Keyboard shortcuts

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