Documentation ¶
Index ¶
Constants ¶
const ( GcloudProject = "gcloud.core.project" GcloudProjectNumber = "gcloud.project.projectNumber" )
Variables ¶
var GetProjectNumberFromProjectID = func(projectID string) (string, error) { gcloudCmd := exec.Command("gcloud", "projects", "describe", projectID, "--format", "value(projectNumber)") b, err := gcloudCmd.Output() if err != nil { return "", errors.Wrapf(err, "failed to get project number for %s, please verify gcloud "+ "credentials are valid and try again", projectID) } return strings.TrimSpace(string(b)), nil }
Functions ¶
func DefExists ¶ added in v0.26.0
DefExists returns true if the setterName exists in Kptfile definitions
func SetV1AutoSetter ¶ added in v0.34.0
SetV1AutoSetter sets the input auto setter recursively in all the sub-packages of root Sets GcloudProjectNumber as well, if input setter is GcloudProject
Types ¶
type AutoSet ¶ added in v0.36.0
type AutoSet struct { // Writer is the output writer Writer io.Writer // PackagePath is the path of the package to apply auto-setters PackagePath string }
func (AutoSet) PerformAutoSetters ¶ added in v0.36.0
PerformAutoSetters auto-fills the setter values from the local environment in the target path for the setters which are not already set previously Auto setters are applied in the following order of precedence 1. Setter values from the parent package 2. Setter values from the environment variables 3. Setter values from gcloud configs The auto setters are applied for all the subpackages with in the directory tree of input PackagePath Only the setters which are NOT set locally (identified by isSet flag in setter definition of Kptfile), are only set by this operation
func (AutoSet) SetEnvAutoSetters ¶ added in v0.36.0
SetEnvAutoSetters auto-fills setters from the environment
func (AutoSet) SetGcloudAutoSetters ¶ added in v0.36.0
SetGcloudAutoSetters auto-fills setters from gcloud config
func (AutoSet) SetInheritedSetters ¶ added in v0.36.0
SetInheritedSetters traverses the absolute parentPath all the way to the root of file system to find a kpt package with Kptfile and auto-fills the setter values in targetPath and all its subpackages