set-project-id

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

set-project-id

Overview

The set-project-id function sets 'project-id' setter and cnrm.cloud.google.com/project-id annotation to the provided project ID, only if they are not already set.

Usage

set-project-id function is expected to be executed imperatively like:

kpt fn eval --include-meta-resources --image gcr.io/kpt-fn/set-project-id:v0.2 -- 'project-id=foo'

The set-project-id function does the following:

  1. Sets the the 'project-id' setter to the provided project ID.
    • If an 'apply-setters' function is present in the Kptfile which does not have the 'project-id' setter or sets it to an empty value, update that config to set the “project-id” setter to the provided project ID value.
    • If no 'apply-setters' function is present in the Kptfile, add one with just the 'project-id' setter set to the provided project ID value.
    • If no pipeline is declared in the Kptfile, declare it and add 'apply-setters' function as mutator with the 'project-id' setter set to the provided project ID value.
  2. For all Config Connector resources, check if they have the cnrm.cloud.google.com/project-id annotation set. If the annotation is not present or is set to an empty value, set it to the provided project ID value.
FunctionConfig

This function supports ConfigMap functionConfig and expects the 'project-id' value to be present in the map.

Examples

Setting the project-id setter on the package without setters.

Let's start with the Kptfile of an example package.

apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
  name: example-package

Invoke the function:

kpt fn eval --include-meta-resources --image gcr.io/kpt-fn/set-project-id:v0.2 -- 'project-id=foo'

Kptfile will be updated to the following:

apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
  name: example-package
pipeline:
  mutators:
    - image: gcr.io/kpt-fn/apply-setters:v0.2
      configMap:
        project-id: foo

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Code generated by "mdtogo"; DO NOT EDIT.
Code generated by "mdtogo"; DO NOT EDIT.

Jump to

Keyboard shortcuts

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