set-project-id: Advanced Example #
Overview #
This example shows how
set-project-id
function works on packages with
sub-packages.
Running set-project-id
function on the example packed will:
- Set
project-id
setter. - Add
cnrm.cloud.google.com/project-id
annotation on Config Connector resources that don’t have it.
Fetch the example package #
Get the example package by running the following commands:
kpt pkg get https://github.com/kptdev/krm-functions-catalog.git/examples/set-project-id-advanced
Function invocation #
Invoke the function with the following command:
kpt fn eval set-project-id-advanced --image ghcr.io/kptdev/krm-functions-catalog/set-project-id:latest -- 'project-id=foo'
Expected result #
- File setters.yaml will include
project-id: foo
setter. - In resources.yaml
my-test-project-second-bucket
StorageBucket resource will includecnrm.cloud.google.com/project-id: foo
annotation. - Kptfile in subpkg folder will include
apply-setters
mutator withproject-id: foo
setter. - In resources.yaml in subpkg folder
iamserviceaccount-sample
IAMServiceAccount resource will includecnrm.cloud.google.com/project-id: foo
annotation.