Documentation
¶
Index ¶
- Constants
- Variables
- func AddNamespaceFlags(flags *pflag.FlagSet, allowAll bool)
- func Age(t time.Time) string
- func CaptureStdout(t *testing.T)
- func ConditionsValue(conditions duckv1.Conditions) string
- func CreateDynamicTestKnCommand(cmd *cobra.Command, knParams *KnParams, objects ...runtime.Object) (*cobra.Command, *dynamic_fake.FakeDynamicClient, *bytes.Buffer)
- func CreateEventingTestKnCommand(cmd *cobra.Command, knParams *KnParams) (*cobra.Command, *eventing_fake.FakeEventingV1alpha1, *bytes.Buffer)
- func CreateSourcesTestKnCommand(cmd *cobra.Command, knParams *KnParams) (*cobra.Command, *sources_fake.FakeSourcesV1alpha1, *bytes.Buffer)
- func CreateTestKnCommand(cmd *cobra.Command, knParams *KnParams) (*cobra.Command, *fake.FakeServingV1alpha1, *bytes.Buffer)
- func NewKnTestCommand(subCommand *cobra.Command, params *KnParams) *cobra.Command
- func NonReadyConditionReason(conditions duckv1.Conditions) string
- func ReadStdout(t *testing.T) string
- func ReadyCondition(conditions duckv1.Conditions) string
- func ReleaseStdout(t *testing.T)
- func TranslateTimestampSince(timestamp metav1.Time) string
- func WriteConditions(dw printers.PrefixWriter, conditions []apis.Condition, printMessage bool)
- func WriteMapDesc(dw printers.PrefixWriter, m map[string]string, label string, details bool)
- func WriteMetadata(dw printers.PrefixWriter, m *metav1.ObjectMeta, printDetails bool)
- func WriteSliceDesc(dw printers.PrefixWriter, s []string, label string, printDetails bool)
- type Config
- type HumanPrintFlags
- type KnParams
- func (params *KnParams) CurrentNamespace() (string, error)
- func (params *KnParams) GetClientConfig() (clientcmd.ClientConfig, error)
- func (params *KnParams) GetNamespace(cmd *cobra.Command) (string, error)
- func (params *KnParams) Initialize()
- func (params *KnParams) RestConfig() (*rest.Config, error)
- type WaitFlags
Constants ¶
const FakeNamespace = "current"
const TruncateAt = 100
Max length When to truncate long strings (when not "all" mode switched on)
const WaitDefaultTimeout = 600
Default time out to use when waiting for reconciliation. It is deliberately very long as it is expected that the service doesn't stay in `Unknown` status very long and eventually ends up as `False` or `True` in a timely manner
Variables ¶
var CfgFile string
CfgFile is Kn's config file is the path for the Kubernetes config
Functions ¶
func AddNamespaceFlags ¶
AddNamespaceFlags adds the namespace-related flags: * --namespace * --all-namespaces
func CaptureStdout ¶
CaptureStdout collects the current content of os.Stdout
func ConditionsValue ¶
func ConditionsValue(conditions duckv1.Conditions) string
conditionsValue returns the True conditions count among total conditions
func CreateDynamicTestKnCommand ¶ added in v0.11.0
func CreateDynamicTestKnCommand(cmd *cobra.Command, knParams *KnParams, objects ...runtime.Object) (*cobra.Command, *dynamic_fake.FakeDynamicClient, *bytes.Buffer)
CreateDynamicTestKnCommand helper for creating test commands using dynamic client
func CreateEventingTestKnCommand ¶ added in v0.11.0
func CreateEventingTestKnCommand(cmd *cobra.Command, knParams *KnParams) (*cobra.Command, *eventing_fake.FakeEventingV1alpha1, *bytes.Buffer)
CreateEventingTestKnCommand helper for creating test commands
func CreateSourcesTestKnCommand ¶ added in v0.11.0
func CreateSourcesTestKnCommand(cmd *cobra.Command, knParams *KnParams) (*cobra.Command, *sources_fake.FakeSourcesV1alpha1, *bytes.Buffer)
CreateSourcesTestKnCommand helper for creating test commands
func CreateTestKnCommand ¶
func CreateTestKnCommand(cmd *cobra.Command, knParams *KnParams) (*cobra.Command, *fake.FakeServingV1alpha1, *bytes.Buffer)
CreateTestKnCommand helper for creating test commands
func NewKnTestCommand ¶
NewKnTestCommand needed since calling the one in core would cause a import cycle
func NonReadyConditionReason ¶
func NonReadyConditionReason(conditions duckv1.Conditions) string
NonReadyConditionReason returns formatted string of reason and message for non ready conditions
func ReadStdout ¶
ReadStdout returns the collected os.Stdout content
func ReadyCondition ¶
func ReadyCondition(conditions duckv1.Conditions) string
readyCondition returns status of resource's Ready type condition
func ReleaseStdout ¶
ReleaseStdout releases the os.Stdout and restores to original
func TranslateTimestampSince ¶
translateTimestampSince returns the elapsed time since timestamp in human-readable approximation.
func WriteConditions ¶
func WriteConditions(dw printers.PrefixWriter, conditions []apis.Condition, printMessage bool)
Print out a table with conditions.
func WriteMapDesc ¶
Write a map either compact in a single line (possibly truncated) or, if printDetails is set, over multiple line, one line per key-value pair. The output is sorted by keys.
func WriteMetadata ¶
func WriteMetadata(dw printers.PrefixWriter, m *metav1.ObjectMeta, printDetails bool)
func WriteSliceDesc ¶ added in v0.10.0
func WriteSliceDesc(dw printers.PrefixWriter, s []string, label string, printDetails bool)
Writer a slice compact (printDetails == false) in one line, or over multiple line with key-value line-by-line (printDetails == true)
Types ¶
type Config ¶
Config contains the variables for the Kn config
var Cfg Config
Cfg is Kn's configuration values
type HumanPrintFlags ¶
HumanPrintFlags provides default flags necessary for printing. Given the following flag values, a printer can be requested that knows how to handle printing based on these values.
func NewHumanPrintFlags ¶
func NewHumanPrintFlags() *HumanPrintFlags
NewHumanPrintFlags returns flags associated with human-readable printing, with default values set.
func (*HumanPrintFlags) AddFlags ¶
func (f *HumanPrintFlags) AddFlags(c *cobra.Command)
AddFlags receives a *cobra.Command reference and binds flags related to human-readable printing to it
func (*HumanPrintFlags) AllowedFormats ¶
func (f *HumanPrintFlags) AllowedFormats() []string
AllowedFormats returns more customized formating options
func (*HumanPrintFlags) EnsureWithNamespace ¶
func (f *HumanPrintFlags) EnsureWithNamespace()
EnsureWithNamespace sets the "WithNamespace" humanreadable option to true.
func (*HumanPrintFlags) ToPrinter ¶
func (f *HumanPrintFlags) ToPrinter(getHandlerFunc func(h hprinters.PrintHandler)) (hprinters.ResourcePrinter, error)
ToPrinter receives returns a printer capable of handling human-readable output.
type KnParams ¶
type KnParams struct { Output io.Writer KubeCfgPath string ClientConfig clientcmd.ClientConfig NewServingClient func(namespace string) (serving_kn_v1alpha1.KnServingClient, error) NewSourcesClient func(namespace string) (sources_kn_v1alpha1.KnSourcesClient, error) NewEventingClient func(namespace string) (eventing_kn_v1alpha1.KnEventingClient, error) NewDynamicClient func(namespace string) (dynamic_kn.KnDynamicClient, error) // General global options LogHTTP bool // contains filtered or unexported fields }
KnParams for creating commands. Useful for inserting mocks for testing.
func (*KnParams) CurrentNamespace ¶
CurrentNamespace returns the current namespace which is either provided as option or picked up from kubeconfig
func (*KnParams) GetClientConfig ¶
func (params *KnParams) GetClientConfig() (clientcmd.ClientConfig, error)
GetClientConfig gets ClientConfig from KubeCfgPath
func (*KnParams) GetNamespace ¶
GetNamespace returns namespace from command specified by flag
func (*KnParams) Initialize ¶
func (params *KnParams) Initialize()
type WaitFlags ¶
type WaitFlags struct { // Timeout in seconds for how long to wait for a command to return TimeoutInSeconds int // If set then just apply resources and don't wait Async bool }
Flags for tuning wait behaviour
func (*WaitFlags) AddConditionWaitFlags ¶
func (p *WaitFlags) AddConditionWaitFlags(command *cobra.Command, waitTimeoutDefault int, action string, what string)
Add flags which influence the sync/async behaviour when creating or updating resources. Set `waitDefault` argument if the default behaviour is synchronous. Use `what` for describing what is waited for.