Documentation
¶
Overview ¶
package opni contains various utility and helper functions that are used by the Opnictl CLI.
Index ¶
- Variables
- func CheckBarFiller(waitCtx context.Context, success func(context.Context) bool) func(mpb.BarFiller) mpb.BarFiller
- func CreateClientOrDie(opts ...ClientOption) (*api.Config, *rest.Config, client.Client)
- func CreateScheme() *runtime.Scheme
- func EditObject(obj runtime.Object, scheme *runtime.Scheme) (runtime.Object, error)
- func JoinKeyValuePairs(pairs map[string]string) []string
- func LoadClientConfig(opts ...ClientOption) (*api.Config, *rest.Config)
- func LoadConfigObjectsOrDie(configLocation string, lg logger.ExtendedSugaredLogger) meta.ObjectList
- func ParseKeyValuePairs(pairs []string) (map[string]string, error)
- func RenderAccessMatrix(am AccessMatrix) string
- func RenderBootstrapToken(token *core.BootstrapToken) string
- func RenderBootstrapTokenList(list *core.BootstrapTokenList) string
- func RenderCertInfoChain(chain []*core.CertInfo) string
- func RenderClusterList(list *core.ClusterList, stats *cortexadmin.UserIDStatsList) string
- func RenderRole(role *core.Role) string
- func RenderRoleBinding(binding *core.RoleBinding) string
- func RenderRoleBindingList(list *core.RoleBindingList) string
- func RenderRoleList(list *core.RoleList) string
- func WaitAndDisplayStatus(ctx context.Context, timeout time.Duration, k8sClient client.Client, ...) error
- type AccessMatrix
- type ClientOption
- type ClientOptions
- type StatusObject
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckBarFiller ¶
func CheckBarFiller( waitCtx context.Context, success func(context.Context) bool, ) func(mpb.BarFiller) mpb.BarFiller
CheckBarFiller creates a mpb.BarFiller which can be used to replace a bar or spinner with a ✓ or ✗ status indicator based on the return value of the provided success function. The success function will be called once when the bar is completed or when waitCtx is canceled, whichever happens first.
func CreateClientOrDie ¶
CreateClientOrDie constructs a new controller-runtime client, or exit with a fatal error if an error occurs.
func CreateScheme ¶
CreateScheme creates a new scheme with the types necessary for opnictl.
func EditObject ¶
EditObject edits an object in a temporary file using the user's default editor. It will retry on basic yaml decoding errors but will not validate the object against the schema. On success, the provided object will be modified in-place. If an error occurs, it will not be modified.
func JoinKeyValuePairs ¶
func LoadClientConfig ¶
func LoadClientConfig(opts ...ClientOption) (*api.Config, *rest.Config)
LoadClientConfig loads the user's kubeconfig using the same logic as kubectl.
func LoadConfigObjectsOrDie ¶
func LoadConfigObjectsOrDie( configLocation string, lg logger.ExtendedSugaredLogger, ) meta.ObjectList
func ParseKeyValuePairs ¶
Parses strings of the form "key=value" into a map[string]string.
func RenderAccessMatrix ¶
func RenderAccessMatrix(am AccessMatrix) string
func RenderBootstrapToken ¶
func RenderBootstrapToken(token *core.BootstrapToken) string
func RenderBootstrapTokenList ¶
func RenderBootstrapTokenList(list *core.BootstrapTokenList) string
func RenderCertInfoChain ¶
func RenderClusterList ¶
func RenderClusterList(list *core.ClusterList, stats *cortexadmin.UserIDStatsList) string
func RenderRole ¶
func RenderRoleBinding ¶
func RenderRoleBinding(binding *core.RoleBinding) string
func RenderRoleBindingList ¶
func RenderRoleBindingList(list *core.RoleBindingList) string
func RenderRoleList ¶
func WaitAndDisplayStatus ¶
Types ¶
type AccessMatrix ¶
type AccessMatrix struct { // List of users (in the order they will appear in the table) Users []string // Set of known clusters (rules referencing nonexistent clusters are marked) KnownClusters map[string]struct{} // Map of tenant IDs to a set of users that have access to the tenant ClustersToUsers map[string]map[string]struct{} }
type ClientOption ¶
type ClientOption func(*ClientOptions)
func WithConfigOverrides ¶
func WithConfigOverrides(overrides *clientcmd.ConfigOverrides) ClientOption
WithConfigOverrides allows overriding specific kubeconfig fields from the user's loaded kubeconfig.
func WithExplicitPath ¶
func WithExplicitPath(path string) ClientOption
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
ClientOptions can be passed to some of the functions in this package when creating clients and/or client configurations.
func (*ClientOptions) Apply ¶
func (o *ClientOptions) Apply(opts ...ClientOption)