diff --git a/pkg/k8s/kubectl/apply_options.go b/pkg/k8s/kubectl/apply_options.go index 106b4db55..83c4da49e 100644 --- a/pkg/k8s/kubectl/apply_options.go +++ b/pkg/k8s/kubectl/apply_options.go @@ -27,10 +27,12 @@ type ApplyOptions struct { ApplyOptions *apply.ApplyOptions } +// SetDryRun enables/disables the dry run flag in kubectl apply options func (ao *ApplyOptions) SetDryRun(dryRun bool) { ao.ApplyOptions.DryRun = dryRun } +// SetPrune enables/disables the prune flag in kubectl apply options func (ao *ApplyOptions) SetPrune(label string) { if label != "" { ao.ApplyOptions.Prune = true @@ -45,6 +47,7 @@ func (ao *ApplyOptions) SetSourceFiles(fileNames []string) { ao.ApplyOptions.DeleteOptions.Filenames = fileNames } +// Run executes the `apply` command. func (ao *ApplyOptions) Run() error { return ao.ApplyOptions.Run() } diff --git a/pkg/k8s/kubectl/kubectl.go b/pkg/k8s/kubectl/kubectl.go index 3936e6d11..a41f5f30f 100644 --- a/pkg/k8s/kubectl/kubectl.go +++ b/pkg/k8s/kubectl/kubectl.go @@ -50,6 +50,7 @@ func NewKubectl(f cmdutil.Factory) *Kubectl { } } +// WithBufferDir sets buffer dir func (kubectl *Kubectl) WithBufferDir(bd string) *Kubectl { kubectl.bufferDir = bd return kubectl diff --git a/pkg/k8s/utils/utils.go b/pkg/k8s/utils/utils.go index 2f4e2d2f3..bb43f0d2a 100644 --- a/pkg/k8s/utils/utils.go +++ b/pkg/k8s/utils/utils.go @@ -19,6 +19,8 @@ import ( cmdutil "k8s.io/kubectl/pkg/cmd/util" ) +// FactoryFromKubeConfigPath returns a factory with the +// default Kubernetes resources for the given kube config path func FactoryFromKubeConfigPath(kp string) cmdutil.Factory { kf := genericclioptions.NewConfigFlags(false) kf.KubeConfig = &kp diff --git a/pkg/remote/errors.go b/pkg/remote/errors.go index 918742acf..fb908c06a 100644 --- a/pkg/remote/errors.go +++ b/pkg/remote/errors.go @@ -20,10 +20,15 @@ import ( aerror "opendev.org/airship/airshipctl/pkg/errors" ) +// TODO: This need to be refactored to match the error format used elsewhere in airshipctl +// Usage of this error should be deprecated as it doesn't provide meaningful feedback to the user. + +// GenericError provides general feedback about an error that occurred in a remote operation type GenericError struct { aerror.AirshipError } +// NewRemoteDirectErrorf retruns formatted remote direct errors func NewRemoteDirectErrorf(format string, v ...interface{}) error { e := &GenericError{} e.Message = fmt.Sprintf(format, v...) diff --git a/pkg/remote/redfish/utils.go b/pkg/remote/redfish/utils.go index 0c5298a73..469f22c33 100644 --- a/pkg/remote/redfish/utils.go +++ b/pkg/remote/redfish/utils.go @@ -26,6 +26,8 @@ import ( "opendev.org/airship/airshipctl/pkg/log" ) +// URLSchemeSeparator holds the separator for URL scheme +// Example: git+ssh const ( redfishURLSchemeSeparator = "+" )