The management configuration does not have central validation, leading
to late validation errors. Additionally, there is an effort to provide
better config validation on a command-by-command basis.
This change adds central validation to the management configuration that
will be used several ways:
1. For quicker validation today
2. For a new CLI command that will be introduced in a future change
that enables imperative modification of the management config
3. Possibly in future efforts to provide command-by-command config
validation by calling the exported Validate() function
Change-Id: I19eafddc818e8d478b9afd053d4ab387c7ad38b3
Signed-off-by: Drew Walters <andrew.walters@att.com>
When reconciling clusters, airshipctl points the bootstrapInfo and
managementConfiguration to an entry named default, and the user is
unaware of this change. The result is that user settings are ignored
unless the user defines settings under entries named "default". This
change updates the cluster reconciliation logic to do this only when a
cluster is added to the airshipconfig by airshipctl.
Fixes #244
Change-Id: I2cefbf83a74d9cd566015509a4f768698d274746
Signed-off-by: Drew Walters <andrew.walters@att.com>
It's redundant and contradictory to call EnsureComplete method from
GetCurrentContext function since this method is called twice
during config load and we perform this check inside of appropriate
action function (like phase apply or cluster init).
Change-Id: Idb9ab7e7665dcc6d199bc96c21ae1dc6d059ac2e
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
This adds an env var-driven configuration for the filesystem path
in which kustomize should expect its plugins (including airshipctl)
to be. The value defaults to a subfolder off the `.airshipit` folder.
The config is persisted as a singleton rather than a member of
AirshipCTLSettings (or the Config) because
1. the settings object would have had to have been passed around
a couple dozen additional files/functions,
2. it's reasonable to expect the plugin location to be consistent
across threads in a multi-threaded, airshipctl-as-library context.
Settings_test.go was moved in to an environment_test package to avoid
a circular import dependency.
Change-Id: Icdd21bd3687ef42492e388af982d7b490af3eff3
`airshipctl config init` command, generates default Airshipctl config
with mutually exclusive checkout options.
This CR fixing config generation by setting the only branch.
The `commitHash` and `tag` remain empty as an example in config file..
Change-Id: I12ec9b713e8f6769ddbd5301e000ab0242ea8ff4
Closes: #233
Problems description:
Once we execute airshipctl config init, the default config in
~/.airship/config doesn't contain default values for:
currentContext: ~
clusters:
default:
clusterType:
target:
bootstrapInfo: ~
managementConfiguration: ~
---
This PS set default values for Airshipctl config to use it
out of the box.
Closes: #234
Change-Id: I57449e678f19ab1c0e2212c38b01ea195f62aa44
A change [0] recently merged that makes additional remote parameters
configurable; however, it changed the default wait value to two seconds
and made the wait value a duration in time between two nanoseconds.
This change restores the default wait value of thirty seconds and makes
the wait value representative of seconds again.
[0] https://review.opendev.org/717812
Change-Id: I9fad30d479419efe95fca7dc78154bfc3ca66697
Signed-off-by: Drew Walters <andrew.walters@att.com>
By specifying any other branch rather than master in airshipctl config,
`airshipctl document pull` command failing with `reference not found`
error.
The resulted target dir, after execution, still pointing to master.
The idea of this change is to use checkout options during the clone
stage, so we will be clonning the specific branch.
Added debug log about cloning default(master) branch in case of
missing checkout options.
Enabled validation for incompatible parameters in checkout options.
Aligned unit tests with code changes.
Closes: #197
Change-Id: I50ac18289a8f02997d5b90c82f1688083cff8bf3
* encoding while saving credentials in authInfo
* decoding while fethcing credentials from authInfo
* Credentials are found only in ~/.airship/kubeconfig, so did not find
anything in ~/.airship/config to be encoded.
Change-Id: I13f3d49b2ad7ccd1388cabd015fe5a93be2c7b96
Closes: #155
Remove constants and define these parameteres
in config file for remote configuration.
Closes: #138
Change-Id: Ib9250b8d39c01ef43a1262b62e4d37215481bc43
Attempts to write to a nil map will cause a runtime panic,
since we don't have explicit checks whether the map is nil
or not - they were added with proper initialization using make.
Appropriate test configuration was added.
Change-Id: Ib50686de44b782fdc881bd4608dd74588fce93bd
Relates-To: #190
Closes: #190
Adds clusters, contexts and credentials from a kube config
file to the airship config.
In case of duplicate, the existing airship config values
will take precedence.
Closes: #153
Change-Id: Id09489f7546d8836be5b436071fec43fb99b997e
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
Currently it takes ClusterType as first parameter, however
this parameter can be retrieved via appropriate function
CurrentContextClusterType in the same module.
Change-Id: I205fd7d00bf1745cada88d8fd972dac1dbe0fddf
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>
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
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
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>
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
Removed Modules from config. There are no other types of modules
that need additional configuration. BootstrapInfo is defined
in the config directly.
Used camelCase for config parameters.
Change-Id: I3531a061026f3b2f1e72af6272ba4709f28d1b3d
* moving cli helper functions to the respective packages with _helper.
* removed cmds.go within pkg/ dir and added config_helper.go
* In the first commit(https://review.opendev.org/#/c/707216/) commit CLI helper
functions were moved from the cmd/config package to the pkg/config package
* Now we are trying to move the CLI helper functions within their respective packages instead of a command cmds.go.
* Creating and implementing this convention will help us better distinguish library code and CLI helper code
* Added MaxNArgs as 1 for get-credentials and updated test cases
Relates-To: #43
Change-Id: Ibb8139102bd98c6c7596bd97377cf83381cbeb00
The go-git module (and helper modules) recently moved from
`gopkg.in/src-d/go-git` to `github.com/go-git/go-git` [0]. This commit
switches to the new module, as well as uplifts from v4 to v5.
[0] https://github.com/src-d/go-git/issues/1295#issuecomment-592965250
Change-Id: I2e73ba7bb1220a3c75c0d81aa5ab0f1f13479161
* 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
* 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
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
This change includes various code cleanups which improve the way that a
developer creates and interacts with ClusterComplexNames.
Change-Id: If3c4326f3ca46db7fd307b50ca260cdb1a82f3f3