Commit Graph

47 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
2021-08-12 22:45:33 -05:00
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
2021-06-13 17:29:10 -05:00
Ruslan Aliev bc9f97ff2e Embed validation cfg into phase and plan definition
* validation config is now part of airshipctl api
 * additional CRD locations can be only kustomize entrypoints
 * changed mechanism to call document-validation executor to allow
   to pass validation config from phase or plan
 * kubeval version pinned to the latest 0.16.1
 * default k8s version to validate against uplifted to 1.18.6
 * default URL with k8s schemas changed to more updated and reliable

Change-Id: Ifb24be224d5f0860d323a671b94e28a86debc65b
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Closes: #563
2021-06-11 15:37:38 +00:00
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
2021-05-17 23:30:21 +00:00
Ruslan Aliev 7fd779ae0b Invoke validation container directly via ClientV1 package
This patch will allow us to bypass unnecassary logic in generic
container executor (e.g. mounting kubeconfig).

Change-Id: I526940e8f01c66f7609355a4ef750b38f1d9a323
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2021-05-13 13:12:18 -05:00
Zuul ed271774f6 Merge "Add Plan Status() to ifc.plan interface" 2021-05-11 09:37:16 +00:00
Zuul 6543f63ebf Merge "Add validation phases" 2021-04-28 03:26:02 +00:00
Ruslan Aliev 31995eaf9d Add validation phases
This patch introduces ability to validate phases using kubeval.
Appropriate functionality was embedded into phase/plan validate
command.

Change-Id: I1e1ccae2b7e4948bdc97a199c96c07a3eb7292b2
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #503
Closes: #2
Closes: #19
2021-04-22 11:37:12 -05:00
bijayasharma e9179ff018 Fix typos in various files
Signed-off-by: bijayasharma <vetbijaya@gmail.com>
Change-Id: Ibe0066e74497c3caecc50e1187abd0bde7955b04
2021-04-21 17:32:31 +00:00
Vladimir Kozhukalov 1b960c129d Do not pass phase helper to executor initializers
Phase helper provides plenty of useful methods for
 a phase client. But these methods are not used by
 phase executor initializers except for getting some
 configuration values. So, it is better to provide
 initializers with necessary values instead of passing
 them the phase helper.

Change-Id: I8c596455e30444570a86efad73d792af0ca83a33
Relates-To: #464
Relates-To: #465
2021-04-20 10:00:47 +03:00
niharikab 289b569de4 Add Plan Status() to ifc.plan interface
This commit adds plan Status() method to ifc.plan
interface.

Relates-To: #412
Change-Id: I4857eec9ea125902e305af64fbb336ff6de4faa8
2021-04-19 20:09:51 +05:30
Ruslan Aliev 6076891f31 Introduce plan validate command
This patch implements CLI command to invoke plan validation.
Appropriate functionality was already added to pkg previously.

Change-Id: I038b49c8de0af65f38b62950b27b31d95a6301a9
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #19
Relates-To: #497
Closes: #497
2021-03-27 12:59:30 -05:00
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
2021-03-27 12:58:36 -05:00
Zuul 818efdfc19 Merge "Remove deprecated options for phase/plan run cmd" 2021-03-25 06:20:03 +00:00
Ruslan Aliev 3ccafd9d0f Remove deprecated options for phase/plan run cmd
There are some debries left after removing --kubeconfig flag
from support, this patch cleans them up.

Change-Id: Iabdd6bcbc59d169bf162c9cddb3cb264fb88a3f7
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2021-03-24 13:39:13 -05:00
Ruslan Aliev 8bed52b057 Refactor phase related errors
* phase related errors were moved to separate package to prevent
   cycling import error;
 * error duplicates were removed;
 * non-related to package errors were moved to appropriate ones.

Change-Id: If6cfb08c48d356c1517a13157a5fe740dc1635a4
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #485
2021-03-23 22:04:28 -05:00
Kostiantyn Kalynovskyi e2d2607586 Kubeconf builder to return single cluster kubeconf
Now if clusterName is specified for kubebuilder, Build() method
will return kubeconfig containing only context for that cluster.
If no clusterName is specified kubeconfig will have contexts of
all clusters that builder can build. This behaviour is similar
to `kubeconfig get` command.

Relates-To: #460

Change-Id: Ib3bebf61bc60430d347ded41b2e31249b11126eb
2021-03-16 15:53:40 +00:00
Zuul a39d547981 Merge "Updated executor definition to introduce a status interface" 2021-03-11 21:40:43 +00:00
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
2021-03-10 18:22:30 +00:00
bijayasharma 044b636a57 Updated executor definition to introduce a status interface
Change-Id: Ib95cb2f6464b2d15ba7378e9b40a13899d273ba3
Signed-off-by: bijayasharma <vetbijaya@gmail.com>
Relates-To: #409
Closes: #409
2021-03-10 13:14:08 +00:00
Vladimir Kozhukalov f4001bcffa Remove isogen executor and related code
Isogen executor is not needed any more since there is
 iso build phase plan that runs two phases using generic
 containers.

Relates-To: #440

Change-Id: I3600e82fa1d8a92cdf103d93cd4536bf4a713cca
2021-03-02 08:14:57 +00:00
Kostiantyn Kalynovskyi 9f051e465a Integrate clusterctl client into phases
This will make sure that phases have access to kubeconfgs generated
by cluster-api for the managed clusters.

Change-Id: Iabecced78192969d7a2ee5a48e75fc3adb0af092
2021-02-10 14:53:40 +00:00
Kostiantyn Kalynovskyi f0e80cfdc5 Add BaremetalManager executor
This will allow to peform remote BMH operations as a phase

Change-Id: I8e99285e0407d1922312a08ad4f766363f8855d2
2021-02-02 16:42:09 +00:00
Dmitry Ukov f0e276bb7b Implement basic validation for plan and phase
Plan validation:
1. Each phase must be defined within phase document bundle.
2. Each phase does not return error for Validate method

Phase validation:
1. Document bundle associated with the phase can be rendered without an
error.
2. Associated executor must not return an error.

Relates-to: #330
Change-Id: I08c5e8e42570f2cafdced5a02481b033414ffae0
2021-01-28 10:13:05 +04:00
Dmitry Ukov 178b0eff3e Implement plan run command
Change-Id: Ie627ce670cd2b19d6999dc7c7a7a6dc12b25cace
Closes: #395
2021-01-28 10:13:05 +04:00
Ruslan Aliev 5a6f1096eb Groom phase/executors package
All the duplicated methods were removed. Unit tests reorganized.
Test coverage increased.

Change-Id: I0f7bd3eea63c101195ea50c0369e62945d73f297
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Closes: #432
2021-01-12 16:31:43 -06:00
Zuul 932d92664e Merge "Add PhaseEntryPointBasePath to phase helper" 2021-01-12 19:40:38 +00:00
Sidney Shiba 4b31d3b936 Bootstrap Ephemeral - Executor methods
This patchset includes the go code for the Executor for the Bootstrap
container/Ephemeral cluster and respective unit test code.

This executor allows to deploy a K8S cluster on a public/private cloud
provider through a dedicated Bootstrap container.

This patchset does not include the manifests for the executor to avoid
too big patchset. It will be included in a different patchset.

Change-Id: I3f9d2ba1bb65b344522e105fd26310af24e3a1b1
2021-01-08 10:34:01 -06:00
Vladislav Kuzmin 49c0ad4a23 Add PhaseEntryPointBasePath to phase helper
This parameter allows to get full path to current site.
Also change phaseRoot to phaseBundleRoot and
change the corresponding methods.

Change-Id: Ia4b1b55ceaa8c544ed429ec314bc8772a2fee6de
Relates-To: #379
2021-01-07 16:02:04 +00:00
Zuul b6d52343dc Merge "Allow to perform phase render using document entrypoint" 2020-12-16 16:51:46 +00:00
Kostiantyn Kalynovskyi a6987107bd Allow to perform phase render using document entrypoint
In current setup, we rely on executor to perform render operation,
however there are many usecases, when we want to have a simple
`kustomize build` performed against document entrypoint in phase.
Now this will be a default behaviour and if a user would like
executor to perform rendering to actually understand what it's
doing, he will be able to specify --executor boolean flag.

Relates-To: #403

Change-Id: I181830f9814ff48a19ba0a1284e89900187bc7d8
2020-12-15 11:28:16 -06:00
Ruslan Aliev 01266f036e Move container phase executor to a separate package
Having an executor within container package creates
potential import cycling. This patch moves it to a separate
package which can be used to conveniently store all the executors
at one place.

Change-Id: Ibd07c2ba46d1971604bdbd9e5e360759bb68a659
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #432
2020-12-14 13:16:35 -06:00
Ruslan Aliev b85f8fa8f9 Move kubernetes-apply phase executor to a separate package
Having an executor within applier package creates
potential import cycling. This patch moves it to a separate
package which can be used to conveniently store all the executors
at one place.

Change-Id: I68d909489b691e4fb7129446ef9a3fb085f8683c
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #432
2020-12-11 14:09:41 -06:00
Ruslan Aliev 36303006af Move isogen phase executor to a separate package
Having an executor within isogen package creates
potential import cycling. This patch moves it to a separate
package which can be used to conveniently store all the executors
at one place.

Change-Id: I2154c0af6c28f47abb2448863332766260106759
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #432
2020-12-11 14:09:41 -06:00
Ruslan Aliev 71dc1d4703 Move clusterctl phase executor to a separate package
Having an executor within clusterctl.client package creates
potential import cycling. This patch moves it to a separate
package which can be used to conveniently store all the executors
at one place.

Change-Id: Ib0a6072a393e68885d9ef911aa2894a0de055668
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #374
2020-12-11 14:09:41 -06:00
Vladislav Kuzmin 258b81122e Add generic container executor
This executor based on kyaml.RunFns[1].
It allows to execute arbitrary container as RunFns function
and handle any input data as ExecutorBundle.
Be aware that runtimeutils.FunctionSpec used for version 0.4.1[2]
and it can be changed in the future. It means that yaml scheme
of executor can be changed during kyaml uplift.
This executor transforms executor yaml to RunFns function acceptable format.

[1] https://github.com/kubernetes-sigs/kustomize/blob/master/kyaml/runfn/runfn.go
[2] https://github.com/kubernetes-sigs/kustomize/blob/kyaml/v0.4.1/kyaml/fn/runtime/runtimeutil/functiontypes.go#L22

Change-Id: I9eb648783f1ed462d2b8359d9dc86320c4db2a83
Closes: #202
Closes: #369
2020-11-26 17:11:56 +04:00
Kostiantyn Kalynovskyi c89cd5fba0 Small improvement to Events processor interface
In this commit, we make sure that there are no left over channels
after phase.Run is complete

Change-Id: Ia9b7a37f19aad892e77fdca5ad02efe8322e612b
2020-11-17 14:56:22 -06:00
Vladimir Kozhukalov a608d4c56d Add docEntryPointPrefix field to the metadata.yaml
* The phase.docEntryPointPrefix field in the metadata.yaml
   allows you to define a common part of the documentEntryPoint
   for all phases in the phase bundle.

   For example, let metadata.yaml be
   ---
   phase:
     path: manifests/phases
     docEntryPointPrefix: manifests/site/test-site

   and a phase be
   ---
   apiVersion: airshipit.org/v1alpha1
   kind: Phase
   metadata:
     name: initinfra-ephemeral
     clusterName: ephemeral-cluster
   config:
     executorRef:
       apiVersion: airshipit.org/v1alpha1
       kind: KubernetesApply
       name: kubernetes-apply
   documentEntryPoint: ephemeral/initinfra

   Then the documentEntryPoint for executor will be prepended with
   docEntryPointPrefix and the path to the executor bundle will be
   manifests/site/test-site/ephemeral/initinfra

Change-Id: I29ec14378790d95b66c3ff1fe6120bb200f91a50
Relates-To: #356
2020-10-22 13:29:05 +03:00
Zuul 23224e57c5 Merge "Phase docs are targetPath + phaseRepo + phase.DocumentEntrypoint" 2020-10-16 15:02:04 +00:00
Vladimir Kozhukalov dc68640389 Phase docs are targetPath + phaseRepo + phase.DocumentEntrypoint
Change-Id: I1d5ea75d1c19eb4ebaf37b28918ccde771bcef85
Relates-To: #356
2020-10-15 13:55:59 +03:00
Kostiantyn Kalynovskyi 7095d09de2 Fix kubeconfig flag to be passed to executor
Change-Id: I6e9951785158cecfb952255426d8b5bb40be37ea
Closes: #366
Relates-To: #366
2020-10-13 01:07:49 +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
Kostiantyn Kalynovskyi e6e56ffa2e Use BundleFactory instead of bundle in executors
This will allow to avoid using nil bundle and performing
additional checks inside the executors

Change-Id: Ia061cccf7e0a7948bbc5c8fce24e0e6f8b3256e1
2020-09-28 19:39:05 -05:00
Ruslan Aliev 0c736af2e8 Implement render methods
Change-Id: I03b7aad33576eaa9ef7dfaabfb579ac90cc26a12
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-23 03:06:51 +00:00
Vladislav Kuzmin 27e0ab455c Add isogen executor
Relates-To: #344
Change-Id: I1b9b04f1f723d8df6d6aad63b64a917566b22176
2020-09-18 13:49:01 +04:00
Kostiantyn Kalynovskyi b63c9e3888 Cleanup phase package
Change-Id: Ib849da5faa2f69f058bd9df814b55e117ecefb8a
Relates-To: #342
2020-09-15 17:27:40 +00:00
Kostiantyn Kalynovskyi d79c71e94d Implement phase and phase.Client interface
Relates-To: #342

Change-Id: I8882204c0e9eae05fca30c093fcd3bad58e308e1
2020-09-11 16:24:04 -05:00