815 Commits

Author SHA1 Message Date
Niharika Bhavaraju
5085f22c56 [#394] plan list -o yaml changes
Added yaml output flag to show plan list in yaml format

Relates-To: #394
Co-authored By: Niharika Bhavaraju<niha.twinkle@gmail.com>
Change-Id: I8bed077573eb79783cfc77e4ebf82c819f41d125
2021-04-29 18:10:57 +05:30
Alexey Odinokov
10b0385691 Extended replacement plugin with Targets field
The user can use either `target` or `targets` that is list of
several `target` objects.

Change-Id: I38e457842e1250a2d048f93ba2aac9258758d163
2021-04-28 16:36:19 +00:00
Zuul
6543f63ebf Merge "Add validation phases" 2021-04-28 03:26:02 +00:00
Zuul
afed13d166 Merge "Add util functions to set/unset env variables" 2021-04-28 03:02:01 +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
Ruslan Aliev
3c53dcabdf Add util functions to set/unset env variables
Proposed util functions can set variable amount of env vars at once,
covered with unit tests and handles possible errors in more convenient
way.

Change-Id: Ibd31f528fba1b10be49d1e8cc5e5f29c6b3d902a
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2021-04-22 11:13:49 -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
Zuul
1fd133329c Merge "Do not pass phase helper to executor initializers" 2021-04-20 17:40:58 +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
Pallav Gupta
10e75b5580 Fix plan list command
The aim of this PS to fix current issue we have when we have
new plan created with description width more than 40 char.
Added condition if width is more than specified in command
so the command execution will not break and just crop
exceeding description length.
Eg: e351b2bc43/pkg/print/table/columndefs.go (L71)

Change-Id: Icc353ec688b2fbb563add39f8d38004008093895
2021-04-15 12:18:23 -07:00
Zuul
359c362861 Merge "Fix docker stdin write." 2021-04-07 19:13:11 +00:00
Zuul
7bc47c8a34 Merge "Pass HostNetwork value to docker container" 2021-04-07 19:13:06 +00:00
Kostiantyn Kalynovskyi
7c9dd85eeb Fix docker stdin write.
Without this commit airship can hang endlessly waiting for stdin
to be open. Apparently it depends on the containerd and docker
server version. This commit adds asnyc writing to stdin, this way
we don't have to wait for write to complete before starting docker
container. The code uses similar approach to upstream docker cli
implementation.

Related-To: #513

Change-Id: I2e6d4cbe37df1f8cba356af79c1c2cf18438e86c
2021-04-07 14:37:17 +00:00
Ruslan Aliev
675f718317 Remove unused fields from ExecutorConfig
AirshipConfig and BundleName fields are not used within Executors,
so they should be removed.

Change-Id: I23c54b854938ae554e888102a41c7ec215b85c27
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2021-04-03 16:52:15 -05:00
Kostiantyn Kalynovskyi
c17246b006 Pass HostNetwork value to docker container
This fixes a bug when in host value is specified in api object,
but it is ignored by docker

Closes: #512
Related-To: #512

Change-Id: I57e66a19124d1d0a295396491dbd22e2e2193d31
2021-04-03 17:09:32 +00:00
Zuul
9329b9cc21 Merge "Remove redundant logging when building kubeconfig" 2021-03-31 14:48:27 +00:00
Zuul
5c7f919261 Merge "Add function to generate SSH KeyPair via templater" 2021-03-31 12:02:51 +00:00
Zuul
f1cab5b579 Merge "Change logic of config set-management-config command" 2021-03-31 12:02:34 +00:00
Kostiantyn Kalynovskyi
ef19a9e5da Remove redundant logging when building kubeconfig
Closes: #500

Change-Id: I0fed5bf5abd5c3bfd193270b7c418f493746bea4
2021-03-31 09:44:33 +00:00
Zuul
6a62e11fea Merge "[#323] Cluster list command to output in table/clusternames." 2021-03-31 03:00:29 +00:00
Zuul
bba25054b0 Merge "Change logic of config set-context cmd" 2021-03-31 02:11:41 +00:00
Zuul
5737f3bf26 Merge "Remove NameInKubeconf field from Context struct" 2021-03-31 02:11:36 +00:00
Zuul
ba5e56d3c9 Merge "Introduce plan validate command" 2021-03-31 02:02:55 +00:00
Zuul
9196dd089a Merge "Reduce the number of unnecessary document.NewBundleByPath() calls" 2021-03-31 02:02:41 +00:00
Sreejith Punnapuzha
ab85f2236f Add function to generate SSH KeyPair via templater
This commit adds functionality to generate SSH keypair via templater
plugins. ssh keypairs can be generated via generate-secrets phase.

Signed-off-by: Sreejith Punnapuzha <Sreejith.Punnapuzha@outlook.com>
Change-Id: I83720df5f934caf65dab201a1d0894ed3fee6cb5
2021-03-30 18:00:23 -05:00
Ruslan Aliev
1684ad45cf Change logic of config set-management-config command
* command internal logic was revised and optimized
 * added ability to delete/reset management config fields
 * unit tests were reorganized, new cases were added

Change-Id: I911df180e6986cb1f4dab6aea01216c8a4e15353
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #348
2021-03-30 12:16:13 -05:00
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
Zuul
adacadda4d Merge "[#358] Introduce Phase List command to output phase list(pkg module)." 2021-03-30 00:37:04 +00:00
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
Ruslan Aliev
3dd66f7685 Change logic of config set-context cmd
* command internal logic was revised and optimized
 * added ability to delete/reset context fields
 * unit tests were reorganized, new cases were added

Change-Id: Ie35d11405e88fea21abf33cb75f44b03bb4644fd
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #348
2021-03-26 19:22:52 -05:00
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>
2021-03-26 19:22:52 -05:00
Ruslan Aliev
92ce88fc29 Allow relative and ~ path for container mount
This patch allow to specify relative and home (~/) path for container
mounts.src field. In case if specified path is not absolute, it will be
created by following pattern: 'targetPath+mounts.src'; in case if path
contains ~/ - it will be properly expanded (it will allow us to mount
~/.airship working directory).

Change-Id: I878094371a2bc4e48216b1d076e466e3d29a86f6
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #484
Closes: #484
2021-03-25 16:41:30 -05:00
Niharika Bhavaraju
9bf40366a5 [#358] Introduce Phase List command to output phase list(pkg module).
* Phase list command lists phases of current documentset/plan in
  table or yaml format.
 airshipctl phase list
 airshipctl phase list --plan planName
 airshipctl phase list --plan planName -o yaml
 airshipctl phase list --plan planName -o table(default format)

Relates-To: #358

Co-Authored-By: Niharika Bhavaraju <niha.twinkle@gmail.com>

Change-Id: I37add2fc9dca2433de525bac8c2cc9e56fe39621
2021-03-25 20:16:27 +05:30
bijayasharma
60488d4d7a Add phase status command
Signed-off-by: bijayasharma <vetbijaya@gmail.com>
Change-Id: I09fc1e84f195982a43c97f80feb82fb2e489771d
Relates-To: #411
2021-03-25 12:36:01 +00:00
Zuul
4e296dacab Merge "Don't fail if docEntryPoint isn't defined for Container exec" 2021-03-25 08:49:25 +00: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
395aa537ca Don't fail if docEntryPoint isn't defined for Container exec
Input for this executor could be empty, so we have to handle
ErrDocumentEntrypointNotDefined error more intelligently.

Change-Id: I73e0f770e64cead7dbbbce2af2b7a2ebd323b83b
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #485
Closes: #485
2021-03-23 22:04:40 -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
Matthew Fuller
fbdff6c38e Fix Config object permissions
This change fixes a bug where the default file and directory
permissions weren't getting added (if missing) to the Config
object at runtime.

Change-Id: I87ed2f40af9fe079baade67c506a19de427c4e64
2021-03-22 21:18:15 +00:00
Zuul
853b16997a Merge "Remove defaults from Config object at runtime" 2021-03-22 16:40:09 +00:00
Zuul
bfe23f4755 Merge "Improve error messages from Event Processor" 2021-03-19 19:19:40 +00:00
Matthew Fuller
585af5a516 Remove defaults from Config object at runtime
This change fixes a bug where the default values that are
populated during an `airshipctl config init` were getting
mixed in with user specified values at runtime. For example,
a user with two contexts defined in their airship config
file would actually see a third phantom context with default
values in the output of `airshipctl config get-context`.

Also fixes a number of the config cmd and pkg unit tests that
were affected by this bug.

Change-Id: Iac591d4c2a616090028eb730576478edefb82544
Closes: #447
2021-03-19 17:31:02 +00:00
Zuul
86bd2c9984 Merge "Get-kubeconfig return all cluster contexts" 2021-03-19 01:20:48 +00:00
Zuul
c3e5355322 Merge "Kubeconf builder to return single cluster kubeconf" 2021-03-18 20:55:57 +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
Zuul
7277a8492a Merge "Remove clusterctl command related functionality" 2021-03-17 17:48:49 +00:00
Zuul
3bc529fc93 Merge "Revert "Adding encryption config to airshipctl config"" 2021-03-17 04:02:50 +00: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