Documentation ¶
Index ¶
- Constants
- Variables
- func IsOssInstallation(ctx context.Context, c *ConfigManagementClient, cl client.Client, ...) (bool, error)
- func MonoRepoNotice(writer io.Writer, monoRepoClusters ...string)
- func MustFprintf(w io.Writer, format string, a ...any)
- func NewWriter(out io.Writer) *tabwriter.Writer
- func PrintErr(err error) error
- func PrintErrOrDie(err error)
- func WriteObject(printer printers.ResourcePrinter, dir string, object ast.FileObject) error
- type ConfigManagementClient
- func (c *ConfigManagementClient) EnableMultiRepo(ctx context.Context) (*unstructured.Unstructured, *unstructured.Unstructured, error)
- func (c *ConfigManagementClient) IsHNCEnabled(ctx context.Context) (bool, error)
- func (c *ConfigManagementClient) IsManagedByHub(ctx context.Context) (bool, error)
- func (c *ConfigManagementClient) IsMultiRepo(ctx context.Context) (*bool, error)
- func (c *ConfigManagementClient) NestedBool(ctx context.Context, fields ...string) (bool, error)
- func (c *ConfigManagementClient) NestedInt(ctx context.Context, fields ...string) (int, error)
- func (c *ConfigManagementClient) NestedString(ctx context.Context, fields ...string) (string, error)
- func (c *ConfigManagementClient) NestedStringSlice(ctx context.Context, fields ...string) ([]string, error)
- func (c *ConfigManagementClient) RemoveFinalizers(ctx context.Context) error
- func (c *ConfigManagementClient) UpdateConfigManagement(ctx context.Context, obj *unstructured.Unstructured) error
- func (c *ConfigManagementClient) Version(ctx context.Context) (string, error)
Constants ¶
const ( // ConfigManagementName is the name of the ConfigManagement object. ConfigManagementName = "config-management" // ConfigManagementResource is the config management resource ConfigManagementResource = "configmanagements" // ConfigManagementVersionName is the field name that indicates the ConfigManagement version. ConfigManagementVersionName = "configManagementVersion" // ACMOperatorDeployment is the name of ACM Operator Deployment ACMOperatorDeployment = "config-management-operator" // ConfigManagementCRDName is the name of the ConfigManagement CustomResourceDefinition ConfigManagementCRDName = "configmanagements.configmanagement.gke.io" // ConfigSyncName is the name of the ConfigSync object for OSS installation. ConfigSyncName = "config-sync" // ReconcilerManagerName is the name of reconciler-manger ReconcilerManagerName = "reconciler-manager" // ManagedByHubAnnotationKey is the annotation key set by Hub ManagedByHubAnnotationKey = "configmanagement.gke.io/managed-by-hub" // ManagedByHubAnnotationValue is the annotation value set by Hub ManagedByHubAnnotationValue = "true" )
const ( // Indent is the extra spaces for indentation. Indent = " " // Separator is the delimiter before each cluster. Separator = "--------------------" // Bullet is the separator before each bullet item. Bullet = "- " // ColorDefault is the default color code ColorDefault = "\033[0m" // ColorRed is the red color code ColorRed = "\033[31m" // ColorGreen is the green color code ColorGreen = "\033[32m" // ColorYellow is the yellow color code ColorYellow = "\033[33m" // ColorCyan is the cyan color code ColorCyan = "\033[36m" )
const ( // ErrorMsg indicates that an error has occurred when retrieving or calculating a field value. ErrorMsg = "ERROR" // NotInstalledMsg indicates that ACM is not installed on a cluster. NotInstalledMsg = "NOT INSTALLED" // NotRunningMsg indicates that ACM is installed but not running on a cluster. NotRunningMsg = "NOT RUNNING" // NotConfiguredMsg indicates that ACM is installed but not configured for a cluster. NotConfiguredMsg = "NOT CONFIGURED" // UnknownMsg indicates that a field's value is unknown or unavailable. UnknownMsg = "UNKNOWN" // OSSMsg indicates OSS installation OSSMsg = "OSS Installation" )
Status enums shared across nomos subcommands.
const ( // FieldManager is the field manager name used by the nomos CLI. // This avoids conflicts with the reconciler and reconciler-manager. FieldManager = configsync.ConfigSyncPrefix + "nomos-cli" )
Variables ¶
var DynamicClient = func(config *rest.Config) (dynamic.Interface, error) { return dynamic.NewForConfig(config) }
DynamicClient obtains a client based on the supplied REST config. Returns dynamic.Interface to be overridden in tests.
Functions ¶
func IsOssInstallation ¶ added in v1.15.1
func IsOssInstallation(ctx context.Context, c *ConfigManagementClient, cl client.Client, ck *kubernetes.Clientset) (bool, error)
IsOssInstallation will check for the existence of ConfigManagement object, Operator deployment, and RootSync CRD If RootSync CRD exist but ConfigManagement and Operator doesn't, it indicates an OSS installation
func MonoRepoNotice ¶
MonoRepoNotice logs a notice for the clusters that are running in the legacy mode.
func MustFprintf ¶ added in v1.19.0
MustFprintf prints a formatted string to the writer and panics on error.
func NewWriter ¶
NewWriter returns a standardized writer for the CLI for writing tabular output to the console.
func PrintErrOrDie ¶
func PrintErrOrDie(err error)
PrintErrOrDie attempts to print an error to STDERR, and panics if it is unable to.
func WriteObject ¶
func WriteObject(printer printers.ResourcePrinter, dir string, object ast.FileObject) error
WriteObject writes a FileObject to a file using the provided ResourcePrinter. Writes to the file at object.OSPath(), overwriting if one exists.
Types ¶
type ConfigManagementClient ¶
type ConfigManagementClient struct {
// contains filtered or unexported fields
}
ConfigManagementClient wraps a dynamic resource interface for reading ConfigManagement resources.
func NewConfigManagementClient ¶
func NewConfigManagementClient(cfg *rest.Config) (*ConfigManagementClient, error)
NewConfigManagementClient returns a new ConfigManagementClient.
func (*ConfigManagementClient) EnableMultiRepo ¶
func (c *ConfigManagementClient) EnableMultiRepo(ctx context.Context) (*unstructured.Unstructured, *unstructured.Unstructured, error)
EnableMultiRepo removes the spec.git field and sets spec.enableMultiRepo to true. It returns both the original and the updated ConfigManagement objects.
func (*ConfigManagementClient) IsHNCEnabled ¶
func (c *ConfigManagementClient) IsHNCEnabled(ctx context.Context) (bool, error)
IsHNCEnabled returns if the ConfigManagement object has HNC enabled.
func (*ConfigManagementClient) IsManagedByHub ¶ added in v1.19.0
func (c *ConfigManagementClient) IsManagedByHub(ctx context.Context) (bool, error)
IsManagedByHub returns if the ConfigManagement object is managed by Hub.
func (*ConfigManagementClient) IsMultiRepo ¶
func (c *ConfigManagementClient) IsMultiRepo(ctx context.Context) (*bool, error)
IsMultiRepo returns if the enableMultiRepoMode is true in the ConfigManagement objects.
func (*ConfigManagementClient) NestedBool ¶
NestedBool returns the boolean value specified by the given path of field names. Returns false if a value is not found and an error if value is not a bool.
func (*ConfigManagementClient) NestedInt ¶
NestedInt returns the integer value specified by the given path of field names. Returns false if a value is not found and an error if value is not a bool.
func (*ConfigManagementClient) NestedString ¶
func (c *ConfigManagementClient) NestedString(ctx context.Context, fields ...string) (string, error)
NestedString returns the string value specified by the given path of field names. Returns empty string if a value is not found and an error if value is not a string.
func (*ConfigManagementClient) NestedStringSlice ¶
func (c *ConfigManagementClient) NestedStringSlice(ctx context.Context, fields ...string) ([]string, error)
NestedStringSlice returns the string slice specified by the given path of field names. Returns nil if a value is not found and an error if value is not a string slice.
func (*ConfigManagementClient) RemoveFinalizers ¶ added in v1.19.0
func (c *ConfigManagementClient) RemoveFinalizers(ctx context.Context) error
RemoveFinalizers removes all finalizers from the ConfigManagement object
func (*ConfigManagementClient) UpdateConfigManagement ¶
func (c *ConfigManagementClient) UpdateConfigManagement(ctx context.Context, obj *unstructured.Unstructured) error
UpdateConfigManagement updates the ConfigManagement object in the API server.