Commit Graph

70 Commits (faa13c51adae311e187380972837d81ca60d3e54)

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
2 years ago
Alexey Odinokov 37c2854cce Switching airshipctl and krm-functions to kustomize 4.2.0
Reworked build process of dependent krm functions
to use the latest airshipctl

Change-Id: If4c7f992123b86442980f381ae69fb003f4851e3
2 years ago
Graham Steffaniak edb2aae971 Validate clustermap parent-child dependancy
Add ValidateClusterMap() method to confirm there are no parent-child
dependancy issues for any clustermaps.

Closes: #481
Change-Id: Ifb57b026933909a4350d71353adca23a42440a48
2 years ago
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
2 years ago
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
2 years ago
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
2 years ago
Ruslan Aliev 035e371a5e Allow to setup timeout for get kubeconfig request
This PS replaces cluster-api implementation with our own since
it allows to configure timeout.

Change-Id: I5cbba24dd7c6a279fcd2325e904ac7d18348eabf
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #548
Closes: #548
2 years ago
Matthew Fuller 75429db630 Move CAPI resources to target-infra namespace
Moves CAPI resources in ephemeral cluster from the 'default'
namespace to a new 'target-infra' namespace.

Closes: #551
Change-Id: I419a71baa8e05e7b57b38234d15b955b36951b40
2 years ago
Kostiantyn Kalynovskyi bbd9b018dd Use site-wide kubeconfig only on demand
This patchset introduces new field to Phase.Config API object

SiteWideKubeconfig - if set to true, the phase will have access
to all kubeconfigs for each cluster defined in ClusterMap.

By default only kubeconfig of the cluster specified in
Phase.Metadata.ClusterName will be available to the phase executor.

This approach will speed up the deployment process because arishipctl
will not have to look for multiple kubeconfigs when running each phase

Closes: #547

Change-Id: Ic92027ba88d3ce8cb769c254968530037540b8fd
2 years ago
Vladimir Kozhukalov 639e53f9a0 Change default manifest target path
Now the target path for the default manifest is
  $HOME/.airship/default. This is reasonable default
  location.

  The target path is a mandatory field in the
  definition of a manifest. If a user wants
  to use her current working directory as a location
  the manifests, then it must be properly configured
  in the $HOME/.airship/config.

Relates-To: #416
Relates-To: #417
Change-Id: I96601803939df5c7369d1580842dfabeb19aa017
2 years ago
bijayasharma e9179ff018 Fix typos in various files
Signed-off-by: bijayasharma <vetbijaya@gmail.com>
Change-Id: Ibe0066e74497c3caecc50e1187abd0bde7955b04
2 years ago
Zuul 6a62e11fea Merge "[#323] Cluster list command to output in table/clusternames." 2 years ago
Zuul 5737f3bf26 Merge "Remove NameInKubeconf field from Context struct" 2 years ago
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
2 years ago
Ruslan Aliev e9041a2a22 Reduce the number of unnecessary document.NewBundleByPath() calls
Since document.NewBundleByPath() is pretty resource and time
consuming call (because it invokes kustomize under the hood),
we should avoid unnecessary calls of this function. There are
lots of the same constructor calls of new bundle from phase
bundle root path, mostly in helper, which slows airshipctl
and makes no sense. This patch fixes this problem by storing
phase root bundle variable in helper, which creates only once
during airshipctl execution.

Change-Id: I6b59d440f7ab7a68dc613091dafcc9e82df10eb7
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Closes: #488
2 years ago
Ruslan Aliev b8e0978d6d Remove NameInKubeconf field from Context struct
Since this field is no longer actually used, there is need to
remove it completely.

Change-Id: I9f7002f8def31d1660919bd0128707e43a57ad71
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2 years ago
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
2 years ago
Kostiantyn Kalynovskyi 6207e2c24d Add multiple kubeconifg sources to ClusterMap
Change ClusterMap API object to support multiple kubeconfig sources
for a cluster. If one kubeconfig source fails, kubeconfig builder
will not fail and move on to the next one. This behaviour will allow
to support cases when ephemeral cluster is not accesible anymore or
when target cluster is not yet accessible.

For more information please read issue #460 in airshipctl github

Relates-To: #460
Related-To: #460

Change-Id: I7cd32f78cd7c4ad8814eac357424c24216f40d76
2 years ago
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>
2 years ago
Kostiantyn Kalynovskyi d9f54b4171 Extend kubeconfig builder
Change-Id: I6724112826a4cc59815b7524bd05af01a9a1d01b
2 years ago
Kostiantyn Kalynovskyi c6d6516200 Cleanup ClusterMap interface
This commit deletes a left over method that was used to get
namespace of the cluster. Instead ClusterAPIRef should be
used to get both name and namespace of the cluster in
terms of cluster-api.

Change-Id: I770cd11094257df29e1cac2c63ed3edecd62e54f
2 years ago
bijayasharma 6cacf4756f Minor fix on comment message (ClusterKubeconfigContext)
This commit fixes the minor comment message on pkg/cluster/clustermap/map.go
file and not related to any issue.

Change-Id: Ie92a7c09ada8b0983631cbcd0cd82622c068fc5b
3 years ago
guhaneswaran20 fd768e36a2 Unit tests for `cluster check-certificate-expiration` command
Reference:- https://hackmd.io/aGaz7YXSSHybGcyol8vYEw

Closes: #391

Change-Id: I2e16eb99eca17f809196f9691cc8d0671b6ac15c
3 years ago
guhaneswaran20 426340e31c check node certificate expiration
Reference:- https://hackmd.io/aGaz7YXSSHybGcyol8vYEw

Relates-To: #391

Change-Id: I8c9c83dfb2eb11af48857fb96404dcf2eb3eaa55
3 years ago
guhaneswaran20 0302462450 check kubeconf certificate expiration
Reference:- https://hackmd.io/aGaz7YXSSHybGcyol8vYEw

Relates-To: #391

Change-Id: I66c1cce8a506b763d6ac18c055f3162381c9fd70
3 years ago
guhaneswaran20 ecfb38c7bf Check TLS certificate expiration
Reference:- https://hackmd.io/aGaz7YXSSHybGcyol8vYEw

Relates-To: #391

Change-Id: Ia1d4524f5228542cf3fc4b29074c668eca3c55bb
3 years ago
Zuul 084ed45ef3 Merge "Adds command objects for `cluster check-certificate-expiration`" 3 years ago
bijayasharma dfd82242d7 [#376] Add clusterapi name and namespaces to clustermap
This commit will add clusterapi name and namespaces with a given cluster
to a clustermap.

Refer code from this PS: https://review.opendev.org/#/c/759805/

Change-Id: I1937efa0bbf0b5b175d18777fdf4ba837d1d7344
Relates-To: #376
Closes: #376
3 years ago
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
3 years ago
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
3 years ago
Kostiantyn Kalynovskyi 8567ddf749 Add support for custom kubeconfig contexts
This commit extends cluster map interface to be able to specify
a custom kubeconfig context per cluster in ClusterMap

Related-To: #380
Related-To: #375
Closes: #380

Change-Id: I9a8a26e3a3666e069c243e871f89ae9222228f17
3 years ago
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
3 years ago
Ruslan Aliev fc33287204 Remove kubeconfig from config struct
Change-Id: I5ab8722dd151d9e652e0b20e1d82988cd98505af
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
3 years ago
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>
3 years ago
Ruslan Aliev 2e85043c20 Fix typos
Change-Id: I0ce87ec00d2b5974cf861d9c9685f23d7d0f5fc1
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
3 years ago
Kostiantyn Kalynovskyi 0a7661ab7c Add clustermap object and interface
This commit adds cluster map api object, cluster map
interface and it's implementation built on top of cluster map api
object.

Important note:
ClusterMap interface needs a method to identify namespace of the
cluster, it can't be a part of api object, because real source for
cluster namespace is cluster object from cluster-api upstream lib.
This will need further design discussion on how we will find
cluster-api kind: Cluster object in our manifests. For now, there
is dummy "default" namespace being used

Change-Id: I8175f54abbe77331f0c87c0bde50857ee5c0eb1d
3 years ago
Ruslan Aliev d7b9a8c8b8 Add poller
Poller provides an ability to implement status reader,
which is an object that can fetch a resource of a specific
GVK from the cluster and compute its status.

Change-Id: Ia6f5de81a0ac645903308947df56664a838076dd
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
3 years ago
Yasin, Siraj (SY495P) dace8ba6ec Refactor getGvk to use document.Document methods
* GetGroup(), GetVerion() is already added as member method of document.Document
  Use that to get group, version, kind on a resource object

Change-Id: Ib75229647461cdaad832c8c1c32af5bcaa9c9c37
3 years ago
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>
3 years ago
Alexander Noskov 84f2bc60c9 Fix default Airshipctl config parameters
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
3 years ago
Zuul 9d7c8e5c83 Merge "Add phase commandline option for interacting with phases" 3 years ago
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
3 years ago
Zuul 2cba93cbaf Merge "Create StatusMaps from current cluster state" 3 years ago
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
3 years ago
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
3 years ago
Stanislav Egorov cd9b4dddb4 Refactored airshipctl config
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
3 years ago
Zuul 88ef95d678 Merge "Enhance the fake Client" 3 years ago
Kostiantyn Kalynovskyi da2799bee3 Change bootstrap bundle entrypoint to phase dir
Change-Id: I85151f42e510eb113bcc3bb86d56043d51bf348a
Relates-To: #175
3 years ago
Ian Howell e15f1218f6 Enhance the fake Client
This change accomplishes the following:
* Add a constructor for fake.Clients
* Add the ResourceAccumulator type and several instances of
  ResourceAccumulators, each of which is intended to supply a fake.Client
  with arbitrary kubernetes resources.
* Add the client.Factory type, which provides an easier method of
  providing a fake.Client in place of a real one.

Change-Id: I97f5a613df3ca14bc4fdcf726d3e20c5413cbb5b
3 years ago
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>
3 years ago