Documentation
¶
Index ¶
- type ClusterConfig
- func (c ClusterConfig) AbsSubpaths() []string
- func (c ClusterConfig) CheckVersion(version string) error
- func (c ClusterConfig) DescriptiveName() string
- func (c ClusterConfig) FullPath() string
- func (c ClusterConfig) PrettySubpaths() string
- func (c ClusterConfig) PrettySubpathsList() string
- func (c ClusterConfig) RelPath() string
- func (c *ClusterConfig) SetDefaults(path string, rootPath string) error
- func (c ClusterConfig) ShortRegion() string
- func (c ClusterConfig) StarParams() map[string]interface{}
- func (c ClusterConfig) SubpathCount() int
- type Profile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct {
// Cluster is the name of the cluster.
//
// Required.
Cluster string `json:"cluster"`
// Region is the region for this cluster, e.g. us-west-2.
//
// Required.
Region string `json:"region"`
// Env is the environment or account for this cluster, e.g. production.
//
// Required.
Env string `json:"env"`
// UID is a unique identifier of this cluster. Specifically, it is the unique
// identifier of the kube-system namespace. If set, kubeapply will validate that
// cluster it is interacting with has a matching kube-system namespace uid. This
// can help prevent against accidentally running a kubeapply config on a similarly-
// named cluster but in the wrong environment.
//
// You can fetch your cluster's UID by running:
//
// kubectl get namespace kube-system -o json | jq -r .metadata.uid
//
// Optional.
UID string `json:"uid"`
// Charts is a URL for the default location of Helm charts.
//
// Required unless profile doesn't contain charts or all values files have explicit chart
// URLs.
Charts string `json:"charts"`
// ProfilePath is the path to the profile directory for this cluster.
//
// Optional, defaults to "profile" if not set.
ProfilePath string `json:"profilePath"`
// Profiles is a list of profiles for this cluster. Unlike the ProfilePath
// above, these allow for multiple profiles in a single cluster. If these are set, then
// ProfilePath will be ignored.
//
// Optional.
Profiles []Profile `json:"profiles"`
// ExpandedPath is the path to the results of expanding out all of the configs for this cluster.
//
// Optional, defaults to "expanded/[env]/[region]" if not set.
ExpandedPath string `json:"expandedPath"`
// Parameters are key/value pairs to be used for go templating.
//
// Optional.
Parameters map[string]interface{} `json:"parameters"`
// GithubIgnore indicates whether kubeapply-lambda webhooks should ignore this cluster.
//
// Optional, defaults to false.
GithubIgnore bool `json:"ignore"`
// ReviewOptional indicates that reviews should not be required for changes in this
// cluster even if strict mode is on.
//
// Optional, and only applicable to webhooks mode.
GithubReviewOptional bool `json:"reviewOptional"`
// VersionConstraint is a string version constraint against with the kubeapply binary
// will be checked. See https://github.com/Masterminds/semver for details on the expected
// format.
//
// Optional, defaults to no check.
VersionConstraint string `json:"versionConstraint"`
// KubeConfigPath is the path to a kubeconfig that can be used with this cluster.
//
// Optional, defaults to value set on command-line (when running kubeapply manually) or
// automatically generated via AWS API (when running in lambdas case).
KubeConfigPath string `json:"kubeConfig"`
// ServerSideApply sets whether we should be using server-side applies and diffs for this
// cluster.
ServerSideApply bool `json:"serverSideApply"`
// Subpath is the subset of the expanded configs that we want to diff or apply.
Subpaths []string `json:"-"`
// Profile is the current profile that's being used for config expansion.
Profile *Profile `json:"-"`
// contains filtered or unexported fields
}
ClusterConfig represents the configuration for a single Kubernetes cluster in a single region and environment / account.
func LoadClusterConfig ¶
func LoadClusterConfig(path string, rootPath string) (*ClusterConfig, error)
LoadClusterConfig loads a config from a path on disk.
func (ClusterConfig) AbsSubpaths ¶
func (c ClusterConfig) AbsSubpaths() []string
AbsSubpaths returns the absolute subpaths of the expanded configs associated with this ClusterConfig.
func (ClusterConfig) CheckVersion ¶
func (c ClusterConfig) CheckVersion(version string) error
CheckVersion checks that the version in the cluster config is compatible with this version of kubeapply.
func (ClusterConfig) DescriptiveName ¶
func (c ClusterConfig) DescriptiveName() string
DescriptiveName returns a descriptive name for this ClusterConfig.
func (ClusterConfig) FullPath ¶
func (c ClusterConfig) FullPath() string
FullPath returns the full path to this ClusterConfig.
func (ClusterConfig) PrettySubpaths ¶
func (c ClusterConfig) PrettySubpaths() string
PrettySubpaths generates a Github-friendly format for the cluster subpaths.
func (ClusterConfig) PrettySubpathsList ¶
func (c ClusterConfig) PrettySubpathsList() string
PrettySubpathsList generates a Github-friendly, bulleted list for the cluster subpaths.
func (ClusterConfig) RelPath ¶
func (c ClusterConfig) RelPath() string
RelPath returns the relative path to this ClusterConfig.
func (*ClusterConfig) SetDefaults ¶
func (c *ClusterConfig) SetDefaults(path string, rootPath string) error
SetDefaults sets reasonable defaults for missing values in the current ClusterConfig.
func (ClusterConfig) ShortRegion ¶
func (c ClusterConfig) ShortRegion() string
ShortRegion converts the region in the cluster config to a short form that may be used in some templates.
func (ClusterConfig) StarParams ¶
func (c ClusterConfig) StarParams() map[string]interface{}
StarParams generates the base starlark params for this ClusterConfig.
func (ClusterConfig) SubpathCount ¶
func (c ClusterConfig) SubpathCount() int
SubpathCount generates the number of subpaths for Github comments.
type Profile ¶
type Profile struct {
// Name is the name of the profile.
Name string `json:"name"`
// URL is where the profile configs live.
URL string `json:"url"`
// Parameters are override parameters that will be merged on top of the global parameters
// for this cluster.
//
// Optional.
Parameters map[string]interface{} `json:"parameters"`
}
Profile contains the configuration for a single profile.