293 Commits

Author SHA1 Message Date
Zuul
5bb9b7e623 Merge "Add command line library to integrate clusterctl with airshipctl" 2020-05-01 00:36:24 +00:00
Zuul
93a4449696 Merge "Add utility function to be get current context target-path" 2020-05-01 00:36:23 +00:00
Zuul
74a6ec4832 Merge "Add clusterctl interface and factory functions" 2020-05-01 00:34:18 +00:00
Zuul
0208251351 Merge "Fix unknown management type error" 2020-04-30 23:03:25 +00:00
Zuul
9d7c8e5c83 Merge "Add phase commandline option for interacting with phases" 2020-04-30 22:42:53 +00:00
Kostiantyn Kalynovskyi
0e17d6c7f3 Add command line library to integrate clusterctl with airshipctl
Change-Id: I41a73abc7018410b120cff826e87c6ddc559b42d
2020-04-30 16:31:42 -05:00
Kostiantyn Kalynovskyi
081721816e Add utility function to be get current context target-path
Change-Id: I9ec841ab695526736b7bdfecfa911b3cb2204b2c
2020-04-30 21:20:00 +00:00
Kostiantyn Kalynovskyi
b57c1a2d15 Add clusterctl interface and factory functions
Client interface currently has only one Init method.
Also add a constructor for the Client which is based on resource
defined in clusterctl/api package and a filesystem root to construct
bundle for repository interface. Root is expected to be derived
from the airshipctl settings document manifest.target-path

Factory functions allow to insert custom repository interface
into clusterctl client

Relates-To: #170

Change-Id: Ib27e73043b4776001f405d2d4e96016735c6f46e
2020-04-30 16:19:15 -05:00
Ruslan Aliev
0bbc88b4a9 Add phase commandline option for interacting with phases
Instead of having a lot different arbitrary named commands
such as "cluster initinfra", "cluster control-plane", add
a generic phase command that would provide capabilities
for interacting with phases (e.g. getting list or applying
specific one).

Change-Id: I1ab797121aecbfd2348933dfd993c1a5974edaf9
Relates-To: #162
2020-04-30 12:34:07 -05:00
Drew Walters
00f934af50 Fix unknown management type error
When using "redfish-dell" as the management type, airshipctl throws an
error due to a missing case statement. This change fixes the regression
by re-adding "redfish-dell" as a remote type.

Change-Id: I8314a1e356d1bb3bb1705762bbeda1adf1db41d2
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-30 16:58:52 +00:00
Zuul
c33e0a20ad Merge "Fix Lint warnings: Missing comments for functions" 2020-04-30 16:47:06 +00:00
Zuul
b0259abb6d Merge "Improve config package organization pt.2" 2020-04-30 12:40:15 +00:00
Zuul
2cba93cbaf Merge "Create StatusMaps from current cluster state" 2020-04-30 12:01:01 +00:00
Zuul
9be116e3c4 Merge "Add clusterctl resource type." 2020-04-30 10:55:39 +00:00
Zuul
383dfdf26b Merge "Add metadata support for clusterctl repository implementation" 2020-04-30 10:54:14 +00:00
Zuul
5f4193e3f5 Merge "Fix Lint warnings: Use of basic type string as key" 2020-04-30 02:00:40 +00:00
Zuul
e6a6a655e1 Merge "Replacement transformer improvement" 2020-04-29 22:46:14 +00:00
Yasin, Siraj (SY495P)
8ed791e6e6 Fix Lint warnings: Use of basic type string as key
warning:
  * should not use basic type string as key in context.WithValue

Fix:
  * Define a separate type for context Key(numRetries) and use the
    same to pass value for it
  * Added a constant ctxKeyNumRetries to be used by entire package

Relates-To: #148
Change-Id: Ifd464346ae7a8ecd82a1f1073a026af1e182fbef
2020-04-29 17:00:10 -05:00
Yasin, Siraj (SY495P)
8902d93e02 Fix Lint warnings: Missing comments for functions
* Added comments wherever missing for exported functions/constants

Change-Id: Ibfcfe9c4d89c42e4bb7f72cfe6c894a33e7c6fba
Relates-To: #148
2020-04-29 16:54:01 -05:00
Kostiantyn Kalynovskyi
aa3067cbb7 Add clusterctl resource type.
This type would allow us to control behavior of clusterctl modules
and choose components we want to install, if we put document of kind
Clusterctl into Bundle. In near future we need to generate deepcopy
methods for this object, so it can be used with kubernetes schema

Relates-To: #170

Change-Id: I2f40a7e9b66e0f7f0bbc8b6874ec45f767416c69
2020-04-29 14:39:30 -05:00
Dmitry Ukov
c458e8cde4 Add template based generator plugin
Plugin is responsible for resource generation based on template
(go template format is used) supplied to its configuration.
Go template can use an object (map) specified under 'spec'
configuration parameter.

Change-Id: I8c1b7dc5676bfff2f9b1a47f6433177ae796a15f
2020-04-29 23:38:58 +04:00
Kostiantyn Kalynovskyi
1969866b0a Add metadata support for clusterctl repository implementation
Change-Id: Ie9285cbba0fb590392b975be1eb2b02b28de56d1
2020-04-29 13:45:54 -05:00
Zuul
3fc61f3969 Merge "Add baremetal ejectmedia command" 2020-04-29 15:26:24 +00:00
Zuul
90265072d1 Merge "Add baremetal host poweron command" 2020-04-29 15:22:05 +00:00
Zuul
3d10e1cde1 Merge "Move remote cmd functionality to baremetal cmd" 2020-04-29 15:21:24 +00:00
Vladislav Kuzmin
342666c8c9 Improve config package organization pt.2
This is a series of patches that refactor config.go into
several smaller modules, each relating specifically
to one component of the configuration structure.

This patch split bootstrap, context and manifest
related part in separate modules.

Relates-To: #35

Change-Id: I692ab90a62c54f21157e093af0fbdab86c36a486
2020-04-29 18:49:00 +04:00
Ian Howell
899d3fe0a3 Create StatusMaps from current cluster state
This change modifies the constructor for StatusMaps, which uses the CRDs
currently residing in a cluster as the basis for how to define a
resource's status.

Change-Id: I15c04c1093c06840dba9b21bd5148b99f1257595
2020-04-29 09:39:27 -05:00
Ruslan Aliev
af9e46dfec Refactor CurrentContextEntryPoint function
Currently it takes ClusterType as first parameter, however
this parameter can be retrieved via appropriate function
CurrentContextClusterType in the same module.

Change-Id: I205fd7d00bf1745cada88d8fd972dac1dbe0fddf
2020-04-29 06:17:00 -05:00
Drew Walters
1ce5005cd6 Add baremetal ejectmedia command
Early airshipctl usage has identified the need to eject virtual media
on-demand using airshipctl in order to prevent booting from stuck media.
This change adds a command to eject all virtual media attached to a
baremetal node.

Change-Id: Id67fa00489093dcb84ce54216e0553fa6a737ea6
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-28 23:10:36 +00:00
Drew Walters
7ddb858135 Add baremetal host poweron command
This change introduces a command to power on baremetal hosts.

Closes: #5

Change-Id: Ie76cd7c044cc44629648ef0b02bb7e492ccccdcf
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-28 23:10:32 +00:00
Drew Walters
fd65389f1a Move remote cmd functionality to baremetal cmd
Early airshipctl usage has identified the need to change the power of
remote hosts directly from airshipctl. This functionality is typically
required during the bootstrapping phase of airshipctl; however, the
functionality could be used anytime. A logical home for this
functionality would be in a baremetal command, not a bootstrap command.
Since all functionality performed by the bootstrap command is performed on
baremetal hosts, a natural need has developed to group this
functionality together under one baremetal command.

This change moves all functionality from the remote command to a new
baremetal command.

Once all functionality is grouped within the new baremetal command, a
user can control hosts like this:

airshipctl baremetal isogen                    generate ephemeral node ISO
airshipctl baremetal remotedirect              bootstrap ephemeral node
airshipctl baremetal poweroff       [DOC_NAME] shutdown baremetal node
airshipctl baremetal poweron        [DOC_NAME] power on baremetal node
airshipctl baremetal reboot         [DOC_NAME] reboot baremetal node
airshipctl baremetal powerstatus    [DOC_NAME] retrieve baremetal node status

Relates-To: #5

Change-Id: I31239df1593aac5810e66e1918d8d3207b9f60fb
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-28 22:52:35 +00:00
Zuul
da5d62b95a Merge "Fix for Lint warnings" 2020-04-28 18:32:20 +00:00
Drew Walters
995538829e Add management support to non-ephemeral hosts
Management support is only available to the ephemeral host. This change
extends support of management features to hosts not labeled as the
ephemeral host.

Change-Id: I0ac917f2633f659e56e67cafc52d2db9d967754f
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-28 16:29:19 +00:00
Zuul
486ad67cba Merge "Add impl of Repository interface from cluster-api" 2020-04-28 15:04:42 +00:00
Yasin, Siraj (SY495P)
07f8a5e311 Fix for Lint warnings
* Adding comments for missing exported functions

Change-Id: I40c5861a5c076b654e5a3fc660c3c9c6d7b80c8f
Relates-To: #148
2020-04-28 09:40:57 -05:00
Zuul
fd3118af19 Merge "Improve config package organization pt.1" 2020-04-28 13:53:24 +00:00
Dmitry Ukov
47d8d8c886 Replacement transformer improvement
* Add ability to to replace whole list element filtered by key and
  value
* Raise an error in if user has specified wrong list filer in JSON path
* Enables support for a dot character in a value used in list filtering

Closes: #191
Closes: #192

Change-Id: I889550ee88d5738a1fb808ddef6478c3731b1561
2020-04-28 17:12:29 +04:00
Zuul
bf63997ed6 Merge "Define a standard for creating commands" 2020-04-27 20:41:41 +00:00
Zuul
ec1dbb0933 Merge "Decode Redfish error responses as raw JSON" 2020-04-27 20:03:52 +00:00
Kostiantyn Kalynovskyi
0ab9b6d7ea Add impl of Repository interface from cluster-api
Implementation would allow us to build our own cluster-api components
based on airship document bundle.

Relates-To: #170

Change-Id: Ic029fd07ca5221747e49c3cf48e80a3e279ac1f0
2020-04-27 13:44:14 -05:00
Zuul
cbc2fad7f7 Merge "Added error handler for empty runtime entry" 2020-04-27 17:48:42 +00:00
Vladislav Kuzmin
bb3daf1795 Improve config package organization pt.1
This is a series of patches that refactor config.go into
several smaller modules, each relating specifically
to one component of the configuration structure.

This particular patch split auth info and cluster
related part in separate modules.

Relates-To: #35
Change-Id: Ib2abebc87c80549544a8b7775969df9db55aa8be
2020-04-27 20:54:59 +04:00
Zuul
07ade74a80 Merge "Add management configuration module" 2020-04-27 14:45:30 +00:00
Drew Walters
7ac6362350 Decode Redfish error responses as raw JSON
Some BMCs return response formats that differ from the DMTF Redfish
specification. When the response format varies, airshipctl is unable to
decode the extended information field, leaving the user with the
general, top-level error message "A general error has occurred. See
ExtendedInfo for more information".

This change introduces raw JSON processing for all Redfish error
responses so both observed formats can be handled until this issue is
addressed by the manufacturers.

Change-Id: I6a6e87ecda65292b3cd58a0525985105db350ab8
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-27 13:35:17 +00:00
Kostiantyn Kalynovskyi
996fa6f231 Add CurrentContextCluster Type and Name methods
These are convinience methods, that may be helpful if any of our
modules need to have understanding which cluster they are operating
against.

Change-Id: Ib5d32ac3d4cd3170544bbc4d5bf3044926b52955
Relates-To: #162
2020-04-24 21:18:19 -05:00
Stanislav Egorov
611d73a2ee Added error handler for empty runtime entry
If there is no container runtime defined in the airshipctl
config then the error message is not clear. New handler shows
specific error description

Change-Id: Ib5b735ddaa1556a8a88fdb15c4b3942cd010db9b
2020-04-24 15:34:27 -07:00
Drew Walters
0986773bdd Add management configuration module
Some management options are not directly related to the remote direct
functionality, and the remote direct config should not be validated when
they are needed. This change moves those management options to a
dedicated configuration module.

Change-Id: If4388bccbc70b2c77d7804cb4c38644775404242
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-24 21:14:16 +00:00
Zuul
f555af3bf6 Merge "Replacement transformer refactoring" 2020-04-24 17:21:53 +00: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
Dmitry Ukov
c30930114a Replacement transformer refactoring
* Apply recommendations from "Effective Go"
* Simplify applySubstringPattern logic
* Reduce complexity of updateMapField
* Switch to typed errors
* Increased test coverage

Change-Id: I8e53a251a43c8f31c286284c77452fbf43ce4e43
2020-04-24 19:48:59 +04:00