220 Commits

Author SHA1 Message Date
Zuul
e7380b3ba6 Merge "Remove getters/setters of AirshipCTLSettings" 2020-04-13 16:15:02 +00:00
Zuul
121adcddc8 Merge "Fixed TODO about error definitions" 2020-04-13 13:34:51 +00:00
Yasin, Siraj (SY495P)
c25d223c7b Add copyright for missing files
* added license templates for go, bash & yaml in tools dir
* added a script that will add license information for all
    missing files. Type:  go, yaml, yml, sh
* skip adding license for all files within testdata
* Syntax:
   > ./tools/add_license.sh

* Skip license for manifests folder
* Added one extra line after licene for yaml files
* Added License after Hashbang for bash.
* Add an extra line after hashbang and before license
* Updated the go template to use multiline comments

New Files:
  1. tools/add_license.sh
  2. tools/license_go.txt
  3. tools/license_yaml.txt
  4. tools/license_bash.txt

Change-Id: Ia4da5b261e7cd518d446896b72c810421877472a
Realtes-To:#147
2020-04-09 08:35:59 -05:00
Zuul
780c6b8459 Merge "Update Kustomize to v3.3.1" 2020-04-09 10:07:30 +00:00
Zuul
9ad4db66f4 Merge "Fix for Lint warnings" 2020-04-09 10:01:26 +00: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)
f696ed5f11 Fix for Lint warnings
* This commit handles only warnings of mentioned type
  warning:
    comment on exported function <funcname> should be
      of the form "<funcname> ..."
* In this case, there were comments for the exported
  function/constant/var for which warnings raised,
  but not in expected format.
* So this fix is mostly formating the comment to avoid
  lint warnings.

  Observations:
    * comment did not had function name
    * function name in comment was immediately follwed by comma
        => function followed by space and any description is expected
    * function was not mentioned in the first line of the comment
        => when there is multiline comment, first line should start with
           function name

Change-Id: Ife97104ebc1054f4e34259dca51e8bdb42b33bbd
Relates-To:#148
2020-04-07 14:07:45 +00:00
Drew Walters
263f2ecd6f Add remote system shutdown command
This change introduces a system shutdown command that can be used to
power off remote hosts.

Relates-To: #5

Change-Id: I4fa52db055dcb17e344283fbdd772506e12f77fe
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-07 13:21:27 +00:00
Stanislav Egorov
f7a2e33b8b Fixed TODO about error definitions
Use SelectOne to replace Select and additional checks.

Change-Id: I40b4780d62fa4b3a0e01cc54ef7dbe4b32a4763d
2020-04-06 11:23:42 -07:00
Drew Walters
0c3eefe036 Add remote host power status command
This change introduces a command that allows the user to retrieve the
power status of a remote host.

Relates-To: #5

Change-Id: I4d3ded6667a5427ad6814c3d000da3becaec50a1
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-03 21:18:18 +00:00
Drew Walters
b4b792a04f Fix function name misspelling
Change-Id: I8ffb5fc459360fb9cf4cb84dc0d6ab0aa4f30d21
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-03 20:49:17 +00:00
Drew Walters
a15f978cad Use new Redfish client
The remote package in airshipctl is tightly coupled to redfish. In the
future, we may need to introduce IPMI or SMASH; however, adding those
clients now would be difficult because of our tight dependence on
redfish. This change implements usage of the new Redfish client, which
implements the generic remote client. It also separates remoteDirect
functionality from the redfish package in order to make it more loosely
coupled.

Relates #5
Closes #122

Change-Id: I45d4ea6e2a4146ea519e94ea701a3ad527e50ca0
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-03 18:10:53 +00:00
Matt McEuen
e690a4c453 Update Kustomize to v3.3.1
This updates the Kustomize module dependency to v3.3.1,
which has replacement functionality required by the Replacement Transformer
plugin, among other enhancements.

Change-Id: I058114c398464394cfb6b2626cb475d763c1bacc
2020-04-03 12:11:33 -05:00
Drew Walters
f3262bc015 Retrieve actual virtual media ID and types
The "GetVirtualID" method is stubbed for our Redifsh implementation and
always returns the same values. This change uses the Redfish client to
retrieve the correct virtual media ID and type.

Closes #141

Change-Id: I319b89c13349e7b2f5bf6eb8ced97c949e5f44b5
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-02 15:13:41 +00:00
Ian Howell
bc949f259f Improve error messages related to Selectors
This change modifies the error messages related to Selectors by
delegating formatting to the Selector's String method.

Change-Id: I88acb70751509e588139ea26a8388661b3f63511
Relates-To: #145
2020-04-02 08:07:05 -05:00
Zuul
0ad22d69b6 Merge "Add remote Client interface" 2020-04-02 07:12:28 +00:00
Zuul
5f1eff7858 Merge "Reduce the complexity of ScreenRedfishError" 2020-04-01 21:31:31 +00:00
Zuul
99189e3d5a Merge "Fix Redfish error handling logic" 2020-04-01 21:31:30 +00:00
Ian Howell
68ec25db22 Reduce the complexity of ScreenRedfishError
Change-Id: I69b7e546cd814f5e3b6b890348f4e808058ae6ef
Relates-To: #142
2020-04-01 15:34:51 -05:00
Drew Walters
bd51d1f31b Add remote Client interface
The remote package in airshipctl is tightly coupled to redfish. In
the future, we may need to introduce IPMI or SMASH; however, adding
those clients now would be difficult because of our tight dependence on
redfish. This change adds a Client interface, remote.Client, that will
be implemented by all OOB clients (i.e. Redfish, SMASH, IPMI) in order
to satisfy remoteDirect and future power commands. This change also
creates a Redfish client that implements the client.

A future change will remove the old Redfish client and de-couple the
remoteDirect functionality from the redfish package.

Relates #5, #122

Change-Id: Id9fe09e74efef0c4fcd5b92a1c12897217a4dae1
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-01 18:37:47 +00:00
Ian Howell
714496fc1f Improve document.Selector's String method
This change adds additional output to a document.Selector's String
method, making it easier to find information about the selector being
used. This is particularly helpful when reporting errors, such as those
in #145.

Change-Id: Ic3e67e7597776feec328ad4f54fdf06df863d928
Closes: #145
2020-04-01 10:24:32 -05:00
Drew Walters
ddd0f389be Fix Redfish error handling logic
A logic error in the ScreenRedfishError function causes a false success
if there is no error unmarshalling the body of a GenericOpenAPIError.
This change corrects the logic error and modifies some status checks to
use the http library constants for readability.

This functionality remains untested. The body field of the
GenericOpenAPI error is unexported; therefore, it is inaccessible to our
unit tests.

Fixes: #142

Change-Id: Ic9f248c239830e0b6013a2e2c5d74ea4d2ef25af
Signed-off-by: Drew Walters <andrew.walters@att.com>
2020-04-01 14:42:52 +00:00
Zuul
6ea552bbbc Merge "Add Redfish Authentication Support" 2020-03-27 23:30:59 +00:00
Alan Meadows
e2cca32748 Add Redfish Authentication Support
This commit also introduces a dochelper concept.  This provides
some convenience methods to the document pkg that help extract data
from known document types as well as walk document relationships to
discover related information such as BMC credentials for baremetal
hosts.

Once merged, a follow up patchset will leverage these within the
cloud-init code to deduplicate some of these lookups.

Change-Id: Ie6a770ce4b34adbea30281917f0cb2fdc460b4fb
2020-03-27 15:29:07 -07:00
Ian Howell
77ebd891a2 Cluster Status library tools
This adds the StatusMap type, which can be used to gather the Status of
a given kubernetes resource. A StatusMap can be created from a
document.Bundle and represents all possible Statuses for all
CustomResources, and the conditions that must be met for those statuses
to be valid.

Relates-To: #73
Change-Id: If2cba0bb9890fe28feff0c890bb8036489196fc4
2020-03-27 16:09:15 -05:00
Zuul
21c7c166ff Merge "Allow remotedirect to ignore http*_proxy settings" 2020-03-27 18:46:23 +00:00
Alan Meadows
2e7e6709ca Allow remotedirect to ignore http*_proxy settings
The airshipctl client performs several roles, some of them
benefit from the use of proxy settings and some of them are negatively
impacted by a proxy.

This patchset allows you to explicitly enable
remotedirect to leverage http*_proxy environmental settings but
defaults to ignoring them as that is the desired behavior that
most users will appreciate with communicating directly with BMC
(e.g. redfish) URLs.

At some point, this likely should be followed up with a more holistic
approach of how to configure airshipctl to use a proxy for some functions
but not others but this may be good enough for now.

Change-Id: I10ae4da765aaeb6633df2ca9cde5e6ab543937a5
Relates-To: #143
2020-03-27 09:44:39 -07:00
Ian Howell
567e063589 Refactor ClusterComplexName
This change includes various code cleanups which improve the way that a
developer creates and interacts with ClusterComplexNames.

Change-Id: If3c4326f3ca46db7fd307b50ca260cdb1a82f3f3
2020-03-26 17:46:35 -05:00
Zuul
cbc1e931ae Merge "Remove the various Equals methods from pkg/config" 2020-03-26 22:43:09 +00:00
Zuul
b5c7167094 Merge "Remove unused kubernetes String functions" 2020-03-26 22:43:08 +00:00
Zuul
316744559e Merge "Remove unused OutputFormat type" 2020-03-26 22:43:07 +00:00
Zuul
80d2f6b362 Merge "Remove unused code declarations" 2020-03-26 22:08:26 +00:00
Zuul
7aa39ab041 Merge "Enable insecure connections for remotedirect" 2020-03-26 21:07:42 +00:00
Ian Howell
c69d8d251d Remove the various Equals methods from pkg/config
This change removes the `Equals` methods from the types defined in
pkg/config. They are not being used anywhere in the code base and as
such are dead code.

A user who wishes to compare objects from pkg/config should defer to
using reflect.DeepEqual (several of the objects in pkg/config were
already using DeepEqual, ending up with the same result).

Change-Id: I12bb88b4bf1646f597af70fc8cca93e8d9f7c653
2020-03-26 12:18:13 -05:00
Kostiantyn Kalynovskyi
ad1e160c1a Add selector to filter docs to be deplyed to k8s
By default every document is to be deployed to kubernetes however
some documents may need to be skipped, because they serve only
informational purposes and have no consumers in kubernetes cluster

Change-Id: If2ea5659acb319c15cf3f55e9f3d9e86dc647e9f
Relates-To: #130
Closes: #130
2020-03-26 12:17:00 -05:00
Kostiantyn Kalynovskyi
7a2d01789e Add ordering of the documents
By default kustomize cli orders k8s resources, in a way, that they
can easily by applied to cluster, namespaces and crds first. In this
patch set we implementing same behavior

Relates-To: #131
Closes: #131

Change-Id: I4fc75366627ed361ac1da48e89a35949bcb79801
2020-03-26 09:54:42 -05:00
Alexander Hughes
6023b768a4 Remove unused code declarations
Removing unused declarations of SiteDirectory and AirshipHostKind

Relates-To: #129

Change-Id: I7d0a01d47315bc15adbcf44feb74425865ed325d
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2020-03-26 09:36:51 -04:00
Ian Howell
2de4a0f6a3 Remove unused OutputFormat type
Change-Id: Iffb0438e1722acbd52f7f2f083f1c00ad98455b9
2020-03-26 08:22:43 -05:00
Dmitry Ukov
1f356f82b3 Enable insecure connections for remotedirect
Change-Id: I05d5c59894763d5b537ba9bef353023a0f3e65b3
Closes: #119
2020-03-26 16:13:12 +04:00
Ian Howell
d2cbc92754 Remove unused kubernetes String functions
Change-Id: I18f2eb1563a7720b96babbb125e9b5c02a9b15d6
2020-03-25 15:48:16 -05:00
Alan Meadows
69fefba69f Remove label filtering from initinfra
Now that initinfra leverages a specific entrypoint using
the cluster type, and the Config.Initinfra subdirectory
there is no need to also require all documents be labeled
with a specific label.  That would be redundant.

Change-Id: I41ff1ea01d5f04d7d987d2308636adfff48016ea
2020-03-25 10:47:20 -07:00
Zuul
66a1332ce9 Merge "Ensure node power state ON/OFF for Reset command" 2020-03-25 13:34:56 +00:00
Zuul
14f52863e0 Merge "Add filtering method for document bundle" 2020-03-25 13:29:14 +00:00
Pavel Basov
af90464e66 Add selector to filter initinfra docs
airpship.org/phase: "initinfra" labeled documents are deployed with initinfra

Change-Id: Ie4c9421b9c4b3fe44e20a843f7a3b6551c5a7e6d
Closes: #125
2020-03-24 20:51:59 +01:00
Dmitry Ukov
09ef460e31 Add filtering method for document bundle
SelectByFieldValue method returns new bundle with documents which
values referenced by JSON path comply with function passed as input
argument to the method

Related: #14
Change-Id: I31bb6beee96b0d65719b6976caac63e54c65dcd2
2020-03-24 23:23:58 +04:00
Kostiantyn Kalynovskyi
ea3c6a626b Fix wrong buffer dirrectory for kubectl interface
Change-Id: I0b82be7fe16943f15f87a570eb724476582b51a6
Relates-To: #126
Closes: #126
2020-03-24 11:58:17 -05:00
Alexander Hughes
6832164372 Standardize KubeConfig variables
Settings variable, function names, and comments inconsistently use
either Kubeconfig, KubeconfigPath or KubeConfigPath capitalizations.

This is a minor refactor to consistently use the KubeConfig
capitalization variants.

Relates-To: #124

Change-Id: Iaece6683931164ccaa213f4f3385de9c077d26b7
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2020-03-24 08:31:47 -04:00
Ian Howell
ea9fba7278 Add the dynamic kubernetes client
The dynamic client will be needed to interact with any custom resource
that airshipctl doesn't know about. It will be required for checking the
health of a cluster, as well as any other operations that may need to be
performed on generic objects.

This also adds the pkg/k8s/client/fake package, which can be used to
create a mock instance of a client for use in unit tests.

Change-Id: Ia331ff4875a067045f6f9245daee109126fb1d33
Relates-To: #73
Relates-To: #20
2020-03-23 16:24:04 -05:00
Dmitry Ukov
2817df8482 Ensure node power state ON/OFF for Reset command
Change-Id: Icc6b18b4694a17ab2f8e0bf1112e41a1d18a5b00
Relates-To: #54
Depends-On: https://review.opendev.org/713622
2020-03-19 09:53:58 +04:00
Zuul
ae853757bc Merge "[#52] Provide Redfish feedback in RemoteDirect" 2020-03-18 05:46:49 +00:00