21 Commits

Author SHA1 Message Date
Sirisha Gopigiri
3274b41151 Config- updating cmd files for documentation
The description and examples are updated for the airshipctl
commands, which will be inturn used for generating documentation.
Please ignore the .md file changes in this PS. They are added for zuul
gates to pass. Here is the PS with generated documention
files https://review.opendev.org/c/airship/airshipctl/+/789250

Relates-To: #280
Change-Id: If3ec175e2f582919296576a4bff6ae64871a7333
2021-05-25 12:14:59 +05:30
Ruslan Aliev
3dd66f7685 Change logic of config set-context cmd
* command internal logic was revised and optimized
 * added ability to delete/reset context fields
 * unit tests were reorganized, new cases were added

Change-Id: Ie35d11405e88fea21abf33cb75f44b03bb4644fd
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #348
2021-03-26 19:22:52 -05:00
Ruslan Aliev
e4436ca36d Revert "Adding commands to get and set encryption configs"
This reverts commit 694067492cfedd5e7b369b396bfce9923c0ca3a1.

Reason for revert: Encryption configs inside airship config are
no longer required. Encrypt feature was implemented different way.

Change-Id: I1c8feec75000402e314e815e4832ce740f0e1254
2021-03-10 11:30:32 -06:00
Ruslan Aliev
0c870e5244 Remove clustertype-related functions
We don't use clustertype anymore, so all the related functions must
be deleted or adjusted as well as appropriate config fields.

Change-Id: I3931fdc71d4318e916f8bbc2d94e062c9df5f641
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #349
2020-10-16 11:31:58 -05:00
bijayasharma
e99adf50ad Removed K8s Authors
To make it consistent, this commit will remove K8s authors
from copyright section.

Change-Id: I4e670cc76ea1feb6456965707a8deff258e5f215
2020-09-23 11:36:43 -04:00
Ruslan Aliev
5d52339bd6 Remove clusters, users, reconcilation and config import
All of these entities are no longer required and should be deleted.

Change-Id: Id4776efe668265df6961a38ce984b8ac37b27097
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-16 18:35:12 -05:00
uday.ruddarraju
694067492c Adding commands to get and set encryption configs
Design document: https://docs.google.com/document/d/1EjiCuXoiy8DEEXe15KxVJ4iWrwogCyG113_0LdzcWzQ/edit?usp=drive_web&ouid=102644738301620637153

This is the second of multiple patchsets to support
encryption and decryption in airshipctl

Complete feature: https://review.opendev.org/#/c/742695/

Depends-On: https://review.opendev.org/#/c/749892/
Change-Id: I1a0553622049366977af8c2efbec12012a6fa641
2020-09-16 15:58:16 +00:00
Ruslan Aliev
63b3501a53 Refactor config* commands
All the config commands was refactored for usage with new config
factory. Config object now is being initialized in pkg module on demand,
which provides more flexibility and cleaner code.

Change-Id: Ibad0985e30c16efa96109a49edf2840c60305df8
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05:00
Ian Howell
9ffc305392 Define a standard for creating commands
This commit cleans up the command constructors in an attempt to make the
codebase more uniform and approachable. This includes several refactors:

* Removed the FlagConstants - this makes the help messages and examples
  significantly more readable without needed to compile and run
  airshipctl
* Long help messages and examples are now constant
* Short, Long, and Examples all begin with a capitol letter
* Flag descriptions begin with a lowercase letter. This matches the flag
  description for the builtin "help" flag, making formatting uniform for
  all flags
* Removed redundant unit tests on non-leaf commands

This change also updates the documentation for the affected commands.

Change-Id: I8b9dcbfd9846b3deaab06dec17f80643dae78de9
2020-04-24 10:50:59 -05:00
Ian Howell
5efc26d9f0 Remove getters/setters of AirshipCTLSettings
This change removes the getters and setters for the following attributes
of pkg/environment.AirshipCTLSettings:

* airshipConfigPath
* kubeConfigPath
* config

The above attributes have been exported to account for the removal of
these methods.

Change-Id: I4e7d38bf6771f7521179a2fe2990475b936b5d95
2020-04-08 09:00:32 -05:00
Yasin, Siraj (SY495P)
c26c6e5ac1 [#74] - args for set-context is optional
* argument for set-context is optional, so removing the assignment of args[0] to Name.
  Already conditionally the args[0] is assigned if passed

Change-Id: Ib3232fc19cbaa2cf3dd14b46e910def5d20fed52
2020-03-02 17:06:11 +00:00
Drew Walters
9253f7ddba [#56] Disable context switching with set-context
Users can change their current context by executing airshipctl config
set-context [NAME]. The use-context subcommand was recently introduced
to replace this behavior. This change removes the original behavior.

Closes #56

Change-Id: Ib962d1d69a198c897aff18759fef869ee04d1beb
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-02-26 10:36:26 -06:00
Yasin, Siraj (SY495P)
8d97d5d7ee [#57] - Added --current flag to set-context
* Added --current flag to set-context command to use current-context
when context not provided
* Added validation to throw error when both context and --current flag
* Updated golden files to match the recent change
given
* Added validation to check if current context is set when --current
flag is provided

Old Format: airshipctl config set-context default --manifest default --namespace default
New Format: airshipctl config set-context --current --manifest default --namespace default

Change-Id: I9ffe3a34f33ffd7ff03ca42de7609f91f5386b37
2020-02-24 19:02:20 +00:00
Ian Howell
dc0979b65b [#42] Refactor flag operations to be uniform
This also increases unit test coverage

Change-Id: I324954a1216f2204ff3977c05eb9bd087cd87795
2020-02-20 11:25:41 -06:00
Drew Walters
18d6e2ac29 [#51] Remove current-context flag
Executing "airshipctl config set-context [NAME]" misleadingly prints a
message saying the context has been modified, but doesn't change to that
context or modify any context values. This change modifies the behavior
of context command to switch to a provided context when no flags are
specified. It also removes the current-context flag, which becomes
redundant with this change.

Change-Id: I2622fbf59539513feb1236f13b9090978aeb81ef
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-02-18 13:06:37 -06:00
Ian H. Pittwood
69b37c15b8 [#27] Move execution logic from cmd to pkg
Moves all execution logic from cmd/config to pkg/config.

Adds tests for moved execution logic.

Change-Id: I6381c9fe9eeba938e855bf7d7ea52cd22a5c08b6
2020-02-11 15:33:47 -06:00
Ian H. Pittwood
c7c1011a5c Fix various code style issues
Fixes possible name collisions between variable names and package names

Remove redundant import naming

Use nil slices for slice declarations instead of empty slices

Use make for slices of fixed lengths

Remove redundant parentheses

Replace deprecated `SetOutput` method with `SetOut`

Fix swapped actual/expected arguments on assertEqualGolden

Change-Id: Ia39ef44372c3e44948e5440575125bdb470898df
2020-02-07 09:28:18 -06:00
Rodolfo Pacheco
36a302fce1 Introduces config cmd's for set-credentials and get-credentials
to manage authentication information for clusters.

Includes username/password, certificate
and token options.

Change-Id: If95e5bbf5c3ddc4732465e81de407d5ad416e8f2
2020-02-04 13:01:19 -05:00
Dmitry Ukov
7089223607 Move configuration errors to config module
Change-Id: I878ba176f72db3dba587478f17290991b0f5b3d3
2020-01-23 13:05:17 +04:00
Ian Howell
49027f4151 Tighten the restrictions of the linter
This change causes the linter to be a bit more complainy. The hope is
that this will cut down on some of the more pedantic issues being caught
in code reviews, and thus reduce the overall time a change spends in the
review process.

This change includes various changes to the codebase to bring it up to
the new standards.

Change-Id: I570d304bca5554404354f972d8a2743279a0171b
2020-01-10 14:54:34 -06:00
Rodolfo Pacheco
a480527808 Introduces set_context and get_context operations
Each of these include an option for --current-context that set or retrieves
the curret context

This patchset mainly creates the cmd/config and pkg/config require additions

Also includes a fync getCurrentContext(<CLUSTERTYPE>)  in the config pkg
that other modules should rely on.

Introduces new  ErrMissingConfig and  ErrConfigFailed types been used by
set-context, will decimate through get/ and set/get cluster after this is
reviewed.

Change-Id: I501483a9db99f33f860eaf329a65bb0209b2aaff
2020-01-08 11:46:16 -05:00