50 Commits

Author SHA1 Message Date
Ruslan Aliev
b8ddc1fe43 Allow to specify multiple clusters per get-kubeconfig request
Change-Id: I1b736a4b9cae4e6e47ddb7909a8fd619518e975c
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Closes: #567
2021-08-12 22:45:33 -05:00
Ruslan Aliev
ada5d6f131 Remove cluster resetsatoken subcommand
This command is outdated and no longer needed, according to the
design call it should be removed.

Change-Id: I7c96fdd8cbc21c56ad9d0d6291ea9b6c6626735d
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #588
2021-06-28 17:45:30 -05:00
Ruslan Aliev
7a89572149 Remove cluster check-expiration subcommand
This command is outdated and no longer used, according to the design call
it should be removed.

Change-Id: I5953f0c66e9cee40c070afe148aa98c9d07113f7
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #588
2021-06-28 17:43:27 -05:00
Sirisha Gopigiri
4da8a54887 Separate folders-Create airshipctl cli user guide documentation
Current modified go code, generates RsT files for each airshipctl
cmd and places them in a folder specific to the airshipctl subcommand.
It also generates the index.rst file for the specific airshipctl
subcommand folders. These generated rst files are appropriate to sphinx,
so that they can be easliy rendered in docs.airshipit.org

Steps to render the document locally

	* Install sphinx: python3 -m pip install sphinx
        * Clone airshipctl: git clone https://github.com/airshipit/airshipctl.git
        * Download current PS: cd airshipctl; git fetch "https://review.opendev.org/airship/airshipctl" refs/changes/50/789250/2 && git checkout -b change-789250-1 FETCH_HEAD
	* Build sphinx html pages: cd docs/source; sphinx-build -b html . _build
	* Run local server: cd _build; python3 -m http.server
	* Open URL to access the page: http://localhost:8000/ navigate to commands section access the document

Relates-To: #280
Change-Id: Ifa1dafc7b296014cc826072ac2c52f4488421352
2021-06-28 10:20:55 +05:30
bijayasharma
622d45f3bd Add flags to airshipctl get-kubeconfig cmd
* This commits add --file and --merge flags to
  airshipctl get-kubeconfig cmd

Change-Id: I919d4f068d3ef9bcda6b3a7c9aeb0826a4e5c0d4
Signed-off-by: bijayasharma <vetbijaya@gmail.com>
Relates-To: #495
Closes: #495
2021-06-23 13:41:14 +00:00
Sirisha Gopigiri
21f015b502 Updating cmd files for documentation
This PS updates cmd related to root, completion, document and
version subcommands. It also updates minor details in other
subcommands.

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: I562c15c0d25b2e9731c0eb03854d1d348eb435f2
2021-06-09 09:56:21 +00:00
Sirisha Gopigiri
d13d15f453 Cluster- 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: I7c088528842ff859f502d4484ff9a3847ebb1177
2021-05-07 19:23:55 +05:30
Niharika Bhavaraju
1f90036413 [#323] Cluster list command to output in table/clusternames.
* airshipctl cluster list
* airshipctl cluster list -o table
* airshipctl cluster list -o name(lists cluster names)

Relates-To: #323
Change-Id: Ic4609b8e05984c14acf8f20053123423d5e0088a
2021-03-30 17:03:13 +05:30
bijayasharma
ddf1641168 Modify airshipctl cluster status cmd
* This commits modifies airshipctl cluster status cmd to
  return not implemented error

Change-Id: I7a9fea382217f4eb3d9903b6575f9df5d331255d
Signed-off-by: bijayasharma <vetbijaya@gmail.com>
Relates-To: #370
Closes: #370
2021-03-25 12:35:15 +00:00
Zuul
86bd2c9984 Merge "Get-kubeconfig return all cluster contexts" 2021-03-19 01:20:48 +00:00
Kostiantyn Kalynovskyi
f24bf00d17 Get-kubeconfig return all cluster contexts
Now if we run `airshipctl cluster get-kubeconfig` without args
it will return kubeconfig for the entire site, which will have
contexts for every cluster defined in cluster map.

Relates-To: #460
Closes: #460

Change-Id: Icf1f09724a5c60ac520b1dbcbda69c3280ac4c7e
2021-03-17 19:27:14 +00:00
Kostiantyn Kalynovskyi
6cae709dba Remove clusterctl command related functionality
It is not used anywhere anymore as commands themselves were
deprecated and removed in favor of clusterctl move and init
executors.

Change-Id: I526f75d95b70754034f0846edfc9d3e468648ced
2021-03-16 15:05:14 +00:00
Zuul
442f9965fb Merge "Remove deprecated cluster init/move commands" 2021-03-16 04:48:32 +00:00
Ruslan Aliev
68e76a9059 Extend cluster get-kubeconfig cmd functionality
This PS will allow us to retrieve kubeconfig from different
kind of sources.

Change-Id: I31381cf466c58373efda40d06587e34bef411c68
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2021-03-02 00:22:45 -06:00
Kostiantyn Kalynovskyi
b5b68b3d0f Remove deprecated cluster init/move commands
Instead of these commands users should run apporopriate phase
linked to clusterctl executor

Relates-To: #463

Change-Id: Iecb7320668fa98cfe322cbf922eb77e9490acbdc
2021-02-24 15:17:10 +00:00
Ruslan Aliev
7bf93ba699 Implement cluster list command
Required for document validation script.

Change-Id: I555173a445278b31ef51ebf831a79e63446a19bc
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2021-02-08 23:54:57 -06:00
Ruslan Aliev
899bbdbe07 Link cluster get-kubeconfig cmd with appropriate functionality
This patch links cluster get-kubeconfig command call with
appropriate clusterctl functionality, and also replaces old
callbacks and removes outdated implementation.

Change-Id: Ibd0d981985f94497db250c8df3f5675fdec1d2ca
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #374
2021-01-26 11:03:59 -06:00
Ruslan Aliev
9cde986a31 Introduce cluster get-kubeconfig command
This command will be used to retrieve kubeconfig from from leveraging
cluster or from document model. Particular implementation will be
added in further commits to make it easier for review.

Change-Id: If9e35dd90fdfcad6fa60a3cc4fab76ec1cb57f62
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Related-To: #374
2020-12-16 16:13:42 -06:00
Zuul
084ed45ef3 Merge "Adds command objects for cluster check-certificate-expiration" 2020-11-11 10:09:30 +00:00
Zuul
788d846b01 Merge "Introducing subcommand cluster check-certificate-expiration" 2020-11-09 21:52:39 +00:00
guhaneswaran20
dd03db0916 Adds command objects for cluster check-certificate-expiration
Reference:- https://hackmd.io/aGaz7YXSSHybGcyol8vYEw
Previous work:- https://review.opendev.org/#/c/755291/

Below is the complete ordered flow of PS for the feature:
https://review.opendev.org/#/c/760498/ - Cobra command
https://review.opendev.org/#/c/760501/ - Command Objects
https://review.opendev.org/#/c/760504/ - TLS check
https://review.opendev.org/#/c/760517/ - Kubeconf check
https://review.opendev.org/#/c/760532/ - Node check
https://review.opendev.org/#/c/760537/ - Combined Unit tests

Change-Id: Ie0fac7799724b7fb2255e387b7e90b26159bda5c
Relates-To: #391
2020-11-06 13:14:21 +00:00
guhaneswaran20
260d6905a4 Introducing subcommand cluster check-certificate-expiration
This command runs through the cluster and reports expirable
entities

Reference:- https://hackmd.io/aGaz7YXSSHybGcyol8vYEw
Previous work:- https://review.opendev.org/#/c/755291/

Below is the complete ordered flow of PS for the feature:
https://review.opendev.org/#/c/760498/ - Cobra command
https://review.opendev.org/#/c/760501/ - Command Objects
https://review.opendev.org/#/c/760504/ - TLS check
https://review.opendev.org/#/c/760517/ - Kubeconf check
https://review.opendev.org/#/c/760532/ - Node check
https://review.opendev.org/#/c/760537/ - Combined Unit tests

Change-Id: I7e20a6d3821877e16a5bc2cb8de3dd3c8b7850e2
Relates-To: #391
2020-11-06 05:28:47 +00:00
Michael Beaver
193dc935f1 Refactor subPath out of config manifests
This change removes the SubPath entry portion of the config manifests, and
refactors several areas that used it. This also updates unit tests to
reflect the new changes.

Closes: #255

Change-Id: Ibbb519a3f1fb28a1594e971274c5de54b99c867e
2020-11-04 09:30:03 -06:00
Guhan Eswaran
b7dd46c4e6 Support rotation of svc account tokens
This patchset introduces airshipctl command
- airshipctl cluster rotate-sa-token which basically rotates SA tokens

Previous work: https://review.opendev.org/#/c/749470/

Change-Id: Ibe932fa8d2831979e5b2ac2781f746e8ec2fdc3c
2020-10-19 07:06:58 +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
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
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
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
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
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
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
niharikab
c73d527824 Removed duplicate YAML keys
As mentioned in the issue there is only one duplicate key:
cmd/cluster/testdata/statusmap/legacy-crd.yaml:metadata

Change-Id: I2c82595c44645f3a104b45db52c2a3943877d9f1
Relates-To: #311
2020-07-24 20:19:10 +05:30
Ian Howell
eecc417495 Implement airshipctl cluster status
This change introduces the subcommand `status` to the `airshipctl
cluster` command. The `status` command will iterate over all defined
custom resources in the target path, check their status against the
resources currently in the cluster, and then report results on stdout.

Change-Id: Ieaff6b91fd9055f995c5ba8ce79959356a2a8a02
Relates-To: #73
2020-06-10 10:14:12 -05:00
Arvinderpal Wander
3edf72eeb6 Adds support for clusterctl move of capi and bmo resources
from ephermeral to workload cluster.

Change-Id: Ib6d31282056468d5a153177dfb33ce4a55514ab3
2020-06-04 10:19:41 +00:00
Ruslan Aliev
917d6896b6 Remove "cluster initinfra" command
Command "cluster initinfra" should be removed since
"phase apply" was introduced instead.

Change-Id: I263f8988a4456fc03314093a55ee1c1da8048404
Relates-To: #162
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-05-16 01:45:34 -05:00
Ruslan Aliev
bc90c4f39e Move config init and load from root cmd level
There are several commands which do not require to load config:
completion, help, secret, version. Hovewer, PersistentPreRun call
at root level forces airshipctl to load config anyway. Therefore,
we can observe unnecessary config load errors instead of actual result.
This patch moves config load to subcommand level where it is necessary.

Change-Id: I774a7d038c408e71688f7bf04f1cb87a2132a342
2020-05-09 01:51:09 -05:00
Kostiantyn Kalynovskyi
1e97f2b480 Add airshipctl cluster init command
Change-Id: Ieb23b3e313126a69e8c3256f5178651ff40a80f9
2020-04-30 16:44:47 -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
Kostiantyn Kalynovskyi
f34c900ecc Uplift cobra dependency to v0.0.6
This version is required to integrate with clusterctl.
Starting v0.0.6 cobra Execute() method returns ErrSubCommandRequired if
command is executed when its not runnable (Run or RuneE == nil), hence
all tests that invoke such commands need to be either remove or adjusted
to expect these errors

Change-Id: Ia7935c1bf83d47b3a7d3a6c03d1989d53ad57a9a
Relates-To: #187
2020-04-23 10:47:46 -05:00
Alexander Hughes
c70f4a2742 Refactor of codebase addressing IDE errors
Goland is complaining of a number of bad practices, and unused code.
This patchset addresses some of those complaints, such as:
- struct initialization without field names
- error string should not be capitalized or end with punctuation
- name starts with package name
- duplicate yaml keys
- snake case
- redundant parentheses

For the http.Transport redundant parentheses, the lint target fails
without the use of //nolint:errcheck so it has been added as
(currently) there is no potential for there to be an error returned
see [0] for example.

[0] https://golang.org/src/net/http/transport.go#L42

Change-Id: Ib1b20639c9b6e9be097ef1f158ecd7472f578488
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2020-04-14 15:55:04 -04:00
Zuul
e7380b3ba6 Merge "Remove getters/setters of AirshipCTLSettings" 2020-04-13 16:15:02 +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
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
Alexander Hughes
26fdd05b0f [#38] Add end-user documentation to project
1. Add end-user documentation of CLI commands
2. Minor refactor of several help messages
3. Update of golden test data to reflect help message changes

Change-Id: I58b8ac3a7871efdb569887ab65191bfb1842c24e
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2020-03-10 16:45:19 +00:00
Sreejith Punnapuzha
713d0f5c6d [#83] fix output message of airshipctl initinfra
This PS fixes the output of airshipctl cluster initinfra --help.
This adds the missing space between 'as' and 'metal3.io'

Change-Id: I2ffc8a91d2b563e75d69f211472e0405f5b18205
Signed-off-by: Sreejith Punnapuzha <sreejith.punnapuzha@outlook.com>
2020-03-04 19:30:55 +00:00
Kostiantyn Kalynovskyi
e1bc8ee07d [AIR-97] Adding initinfra subcommand
Command will deploy initial inftrastructure that is identified by
airshipctl document module, bundle interface, documents will be fitered
based on label and annotation, which will indicate that it belongs to
initial infrastructure.

After the documents are identified, they will be labeled
indicating that these resources are deployed by initinfra, if flag
`prune` is specified, resources that have initinfra annotation and
deployedBy initinfra label, but are not part of the documents supplied
by bundle interface will be deleted. If user wants to avoid pruning of
some resources he can remove label deployBy manually from the kubernetes
resources that should not prunned.

Change-Id: I143835291d449be420bfcb2944ba7eaec37c3411
2020-02-27 08:38:51 -06:00
Steve Wilkerson
b1d37d8cd3 Update references to 'kubernetes' to proper name
This updates references to 'kubernetes' to be consistent with
the proper naming reference used elsewhere ('Kubernetes').

Change-Id: Ia44f5cbc75c2fba79ac6531282e0612e62cbb9f9
Signed-off-by: Steve Wilkerson <sw5822@att.com>
2019-10-30 11:37:43 -05:00
Kostiantyn Kalynovskyi
c58862e17e [AIR-97] Adding base airshipctl cluster command
New subcommands will be added later, this commit is a simple base
for other commits related to airshipctl cluster command

Change-Id: I77057c291b88bae3b8fca08ddf56bdf6d183fd24
2019-10-02 14:26:38 -05:00