273 Commits

Author SHA1 Message Date
Ruslan Aliev
a6363f1c1e Run image build command like a phase
We perform almost the same activities prior calling createBootstrapIso
function like we do that in phase executor, also image build command
now is techically outdated since it doesn't work because it fails with
"phase document was not found" error. This patch removes unnecessary
functions like GenerateBootstrapIso and runs image build command in
a phase way. Test coverage increases slightly (by 0.2%) by removing
partially duplicating code which was not tested properly. Minor bug
fixes included.

Change-Id: I545004cea721164838b296ae647a7651cde248ff
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-10-13 17:48:55 -05:00
Vladimir Kozhukalov
0dc4ab7491 Replace PrimaryRepositoryName with PhaseRepositoryName
Change-Id: I2276a3b3ea50b8e81dd240815cd00a0a2a2af96e
Relates-To: #356
2020-10-12 15:28:27 +03:00
Zuul
76e4d3f48c Merge "Remove kubeconfig from config struct" 2020-10-07 21:57:49 +00:00
Ruslan Aliev
fc33287204 Remove kubeconfig from config struct
Change-Id: I5ab8722dd151d9e652e0b20e1d82988cd98505af
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-10-07 14:35:07 -05:00
Zuul
64ef1f9ef1 Merge "Adding encrypt and decrypt subcommands to secret command" 2020-10-07 19:21:18 +00:00
uday.ruddarraju
8fccf09753 Adding encrypt and decrypt subcommands to secret command
Design document: https://docs.google.com/document/d/1EjiCuXoiy8DEEXe15KxVJ4iWrwogCyG113_0LdzcWzQ/edit?usp=drive_web&ouid=102644738301620637153

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

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

Change-Id: Ibe1060a83d11233cccaa3d3989765968a4dbed76
2020-10-06 08:37:56 -07:00
Ruslan Aliev
07c44eedb7 Add ability to perform baremetal operation against all nodes
If no name or label filter specified baremetal operation will
be performed against all nodes with baremetalhost kind. Also,
baremeral cmd code was refactored and combined, which allowed
to remove duplicated code and slighlty improve test coverage
by reducing the number of untestable lines.

Change-Id: Ieadafdb9f55b995d4b47aeff1dc7233325f3191c
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #361
Closes: #361
2020-10-05 00:29:40 -05:00
Ruslan Aliev
cc46ae2ef4 Fix unit test for showProgress function
Sometimes unit test for showProgress function fails if progress bar
was not finished before refreshing event occurs, so progress bar
prints to io.Writer its intermediate state (which is normal since
in regular terminal the output everytime overwrites by carriage
return), so expected and actual output become different. This PS
changes the concept of testing this function and adds the error
tracking of showProgress execution. Some other minor changes included.

Change-Id: I78b4fa9674d4412fa83c1e9320b686923cbe8084
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-10-02 01:52:59 -05:00
Zuul
2a47c00f00 Merge "Add progress bar and improve cmd output for image build command" 2020-09-30 14:34:03 +00:00
Zuul
30914340da Merge "Refactor cluster status command" 2020-09-28 23:01:59 +00:00
Zuul
7502da5c34 Merge "Add document pull step to gate script runner" 2020-09-28 22:45:02 +00:00
Sirajudeen
3e4c228638 Add timeout flag for phase run in cli
Syntax:
	airshipctl phase run <PHASE_NAME> --timeout <time_unit>

Exmaple:
	airshipctl phase run initinfra-ephemeral --debug --wait-timeout 1000s

Change-Id: Ic8c699f5302eb482f32aee0e7d7c593df2ed7d3b
2020-09-28 16:58:18 +00:00
Ruslan Aliev
ec51a71181 Add progress bar and improve cmd output for image build command
This patch provides the ability to show progress bar using
container logs (ubuntu/debian based only).

Change-Id: I86eebe4d368d81c4685fb27ca31b86cbb3dea08d
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #278
2020-09-28 16:11:34 +00:00
Zuul
484a4b1549 Merge "Update metadataPath using set-manifest in cli" 2020-09-28 14:41:01 +00:00
Zuul
14cf69d9eb Merge "Redirect airshipctl log output to stderr" 2020-09-25 09:59:43 +00:00
Ruslan Aliev
d8a6139e81 Add document pull step to gate script runner
Currently we don't test document pull step by rewriting
manifest_directory variable as current source path, which
makes a mess in target_path, manifest_path and related paths
(concatenation of target_path+manifest_path won't return
an existing and proper location). This patch organizes
mentioned variables and enables document pull step which
starts working properly. The latest repo state used as
git source for this command.

Change-Id: I5abce73877441c7529f2f77add79cf410e2226d8
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-25 00:39:28 -05:00
Ruslan Aliev
94d99c85d0 Refactor cluster status command
This patch moves all cluster status functionality from
cmd level to pkg level as well as unit tests, making code
cleaner and improving actual test coverage.

Change-Id: Ia811887b684b2129ca30dd90b5afc72e726271ff
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-24 20:06:00 +00:00
Sirajudeen
2769c62c8a Update metadataPath using set-manifest in cli
* Added metatada-path as a flag to set-manifest

Change-Id: Id26f20c4a6350b4aae34da850bbfcab42cbe9f21
2020-09-24 19:33:15 +00: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
2f5402ae80 Remove phase apply command
Command phase run will be used instead, so phase apply became no
longer needed.

Change-Id: I8bdbd6bcad7efbb03632978d8952700fc39d55ba
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-23 01:42:16 -05:00
Ruslan Aliev
0c736af2e8 Implement render methods
Change-Id: I03b7aad33576eaa9ef7dfaabfb579ac90cc26a12
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-23 03:06:51 +00:00
Kostiantyn Kalynovskyi
7aec434452 Redirect airshipctl log output to stderr
This would allow us to extract information from airshipctl, and
not mix it with logging messages.

Change-Id: I4b22d143956909b35b9f55571d8f7ad6798df4f2
2020-09-22 09:38:56 -05:00
Ruslan Aliev
2e85043c20 Fix typos
Change-Id: I0ce87ec00d2b5974cf861d9c9685f23d7d0f5fc1
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-21 02:49:33 -05: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
Kostiantyn Kalynovskyi
5c6709478b Switch phase commands to use refactored command objects
Change-Id: I1f9f1620d6e0d3ac836e0189f403b7f794818d53
Relates-To: #342
2020-09-12 15:21:30 +00:00
Ruslan Aliev
233bbda0e0 Remove pkg/environment module
This module is no longer needed since all config preloading actions
were moved to config module and global flags are stored within root
level cmd.

Change-Id: I411f6717e5b3d2998706c35a82f1e7f1b2aef3a8
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05:00
Ruslan Aliev
fba618225a Remove AirshipCTLSettings from root level cmd
AirshipCTLSettings will no longer be used by any command, so this
patch removes it from root level.

Change-Id: I2aa1d80ab0785b498af1ac2c86334f9b0d9ff047
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05:00
Ruslan Aliev
2166062f2e Refactor config init command
Config init command will no longer use AirshipCTLSettings for
defining a config object which needs to be saved.

Change-Id: I303f05a8df1e7439d1b3dcfd41cf2679d729a9f8
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05:00
Ruslan Aliev
88ec55d34b Refactor phase* commands
All the phase 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: I742c39788098c3185ce89936ea81cd461bf97af3
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05: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
Ruslan Aliev
5a94f9f99c Remove get/set-authinfo/cluster commands
These commands are no longer required since we going to remove
clusters and users from config. Appropriate fields will be removed
from Config struct in different PS.

Change-Id: I121280e91e394a38384202d9f5ffaaf4e458f82f
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05:00
Ruslan Aliev
a567007199 Refactor cluster* commands
All the cluster 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: I1088ecbce0c34a146a646270404ff206b152d310
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-03 23:52:49 -05:00
Ruslan Aliev
e81116b1a9 Refactor image* commands
All the image 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: I3c51f201ec70b194ce1f127ff43a28292cf691f3
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05:00
Ruslan Aliev
a2b8d45cb0 Refactor baremetal* commands
All the baremetal 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: If75cd3f1a8bc22fc47ea132188bd9fec989ee434
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-03 23:52:49 -05:00
Ruslan Aliev
285aeeba8c Refactor document pull command
This command 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: Iff75eb66db2fee922e6db1bf2930892c02c3b601
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-02 23:41:05 -05:00
Ruslan Aliev
4c0d2c0b57 Remove debug field from AirshipCTLSettings
As part of config refactoring process, we should remove debug field
from AirshipCTLSettings structure since debug variable is stored in
log module.

Change-Id: I02f3c7160ed0301605de32e0d0267be8524ccc12
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-02 23:41:05 -05:00
Ruslan Aliev
f1b606f8bf Fix cmd document pull with help test
Previously it was not executed due to typo.

Change-Id: I91e166ded37e818ae1836cc33295579af068bd53
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-02 23:41:05 -05:00
Zuul
fe1f1f6955 Merge "Move bootstrapInfo config section to manifests" 2020-09-01 18:54:44 +00:00
Ruslan Aliev
78364d7d44 Refactor document plugin command
AirshipCTLSettings are not used here, so it was removed.

Change-Id: If4bf64b9991b4ac05898632c79bacbacd7872635
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-09-01 10:15:58 -05:00
Vladimir Kozhukalov
e9c8425c30 Move bootstrapInfo config section to manifests
This is a part of two activities
  * Refactor config and store all parameters to document model
  * Implement everything as phases (which are supposed to be purely document driven)

 This patch removes bootstrapInfo section from the airshipctl config and
 makes these to commands
  * airshipctl baremetal isogen
  * airthipctl baremetal remotedirect
 to take necessary parameters from documents

 We introduce two airship API kinds ImageGenerator and RemoteDirect.
 Instead of storing config parameters in cm/secrets we use these two
 API objects.

Relates-To: #246
Closes: #254
Change-Id: I42903c45dce1c73da184c07277fec76fd88c700f
2020-08-31 16:54:46 +03:00
Ruslan Aliev
abd1317566 Refactor airshipctl root command
As part of config refactoring process, we have to prepare root
level command to future changes, optimize function signatures
and its logic.

Change-Id: I563a7556ce1cca795a74cf2c6a26380467a15a5d
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
2020-08-25 17:37:19 -05:00
Zuul
f396702824 Merge "Exclude kubeconfig from use-context update" 2020-08-20 05:00:23 +00:00
Kostiantyn Kalynovskyi
2f1b520ab2 Change executor interface to accept channels
Now Run method will accept channels that they will write
events to, this will allow us to pass channels we want to them,
instead of execting them to return us a channel.

Wait method is removed from interface for now, as it needs more
design.

Change-Id: Ibd47dfe49172f537b79bcc8f83f7c76aece8e862
2020-08-18 09:05:56 -05:00
Ian Howell
a8bdae6c9a Uplift cobra to v1.0.0
This commit uplifts cobra to the latest version. It also includes
various changes accounting for differences in the new version.

Change-Id: I0d1ed3ecd3b8d406428fded92abf6e782951d005
2020-08-14 09:19:34 -05:00
Zuul
16fa7730c6 Merge "Add airshipctl phase run" 2020-08-11 20:00:53 +00:00
Kostiantyn Kalynovskyi
5ff6d38e03 Add airshipctl phase run
Commands execution logic will be added when executors are implemented

Change-Id: I78ef95a858117d0c6d407289955228b6ba1a3d5e
2020-08-10 16:07:45 -05:00
Ruslan Aliev
53e4f7ffc6 Add and refactor cluster cmd unit tests
This patch adds some missing cmd unit tests for cluster module
and refactors current ones as well, slightly improving test coverage.

Change-Id: I80c449e213d9aed9abd11fe794afac07ca16bdc6
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-08-06 15:46:39 +00:00
Ruslan Aliev
79555848f2 Fix document pull unit test in cmd
TestPull unit test should not perform functional verification. The purpose of
cmd unit tests should be testing proper cmd object creation, not actually run
the command. Moreover, we don't have possibility to mock and track all the
objects that created inside of called functions. We can only verify golden output
with help or when command performs basic stuff just inside of RunE interface. Actual
test of called methods performed in pkg module.

Change-Id: I2ad6b76f67cbf59d798c0f2b93752b3e3b3b053d
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-08-03 23:29:10 -05:00
Ruslan Aliev
71f7a8bc85 Improve document pull command
This patch refactors some code and adds useful debug/info log output.

Change-Id: I590f6e5c300e5c91443af0a8fdb1073229602a67
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #278
2020-07-28 22:01:20 +00:00