Commit Graph

29 Commits (faa13c51adae311e187380972837d81ca60d3e54)

Author SHA1 Message Date
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
2 years ago
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>
2 years ago
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
2 years ago
Kostiantyn Kalynovskyi b53fdf48da Add utulity to expand tilde in file path
Relates-To: #460
Change-Id: I564887643388d5db32e13b3f432f3d0f1b6428e7
2 years ago
Alexey 6d9ae7c228 Revert "Adding Utility to generate CA"
This reverts commit c514384626.

Reason for revert: this was the original idea
to incorporate everything into airhsipct.
But later we implemented generation/encryption
via templater/sops plugins and this part isn't needed
anymore.

Change-Id: Ib09eb08f10b783091470940fdd1c618a1aeece1b
2 years ago
Ruslan Aliev f9fdf4eaa9 Use document filesystem in config object to read/write files
It allows us to have more clear and controllable unit tests and
to move towards bringing all file operations in airshipctl to a
common standard for all source files (using only document
filesystem module).

Change-Id: I560edb7c8e9cd682f3c188527245fcd40045e16c
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #415
2 years ago
Dmitry Ukov c36a8ea022 Introduce generic table printer
* Table printer is based on cli-utils approach
* Rename 'phase plan' command to 'phase list' and print all Phase
documents from model instead of just printing PhasePlan object

Relates-To: #358
Change-Id: If3c5e2463e32f6794af4c82c12955a45583fce80
2 years ago
guhaneswaran20 c514384626 Adding Utility to generate CA
This patchset provides utility to generate CA crt and keys. This
is needed for `airshipctl secret generate certificate`

Design Document : https://hackmd.io/@sirishagopigiri/HkXlX-mLv

Relates-To: #402

Change-Id: I5a7c3aba636a8a03523e243f6487b766125f4222
3 years ago
Vladislav Kuzmin d7101bcb2c Refactor environment module
Move code from environment module to util and document
modules to prevent circular dependencies.

Relates-To: #264

Change-Id: Ifec9ab3f1ada01cc662e655ff4a6f2cfebe4150a
3 years ago
Yasin, Siraj (SY495P) d630b55235 Increase test coverage
* Few more minor changes to increase test coverage

Change-Id: Id34a33732d3201637027cb3eb512a245acbd77b5
3 years ago
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
3 years ago
Yasin, Siraj (SY495P) f12446afdf Increase test coverage
Added test cases:
	WriteFiles
	TabWriter
	NewRedfishRemoteDirectClient

Updated:
	ReadYAMLFile	=> new test case with invalid yaml file

Change-Id: I06c6f2eefd1c1c1659e0bf3c08fbe28628c80725
3 years ago
Kostiantyn Kalynovskyi 147b97048b Split document model, add entrypoints for repos
Add NewBundleByPath function, that would return bundle built from
the specified path argument

Add CurrentContextEntryPoint method of the config
object, that would allow easily get kustomize root path based on
clusterType and phase. You can also leave phase arg empty string,
which would try to return bundle for all phases

Introduce changes to config pakage objects:

- Manifest:
  SubPath: this is relative path to the root of the repository that
contains directories with sites (SiteNames)
    PrimaryRepositoryName: this is a string that must correspond to a key
of the Repositories map of manifest object, which is used to derive
primary repository
    Repositories object is a map, map keys correspond to names of the
directories where `document pull` command will download repositories
defined in manifest prepended by manifest.TargetPath.

Introduce new config method CurrentContextEntryPoint(), method takes
TargetPath, PrimaryRepo.URL, SubPath, and clusterType and phase
constructs a path to the entry point out of which the DocumentBundle
should be build, and returns it to the caller. After that caller can
build a bundle out of it, the bundle will contain documents relevant to
particular cluster-type and phase.

All objects that depend on bundle interface are updated to use the
CurrentContextEntryPoint() method of the config object

Relates-To: #99

Closes: #99

Change-Id: I99320c4cb626841d46f4c298b583e9af90b1dce4
3 years ago
Ian H. Pittwood 8a3950d238 Fix typos in variable names and comments
Change-Id: I361916cc18c67e72fbfdbb4b6547f80a5d098327
3 years ago
Ian Howell 49027f4151 Tighten the restrictions of the linter
This change causes the linter to be a bit more complainy. The hope is
that this will cut down on some of the more pedantic issues being caught
in code reviews, and thus reduce the overall time a change spends in the
review process.

This change includes various changes to the codebase to bring it up to
the new standards.

Change-Id: I570d304bca5554404354f972d8a2743279a0171b
3 years ago
Dmitry Ukov 6b82a529fc [AIR-145] Generate cloud init settings
Settins are generated based on a secret data

Change-Id: Ib4c25e720759694432e03796ae5d1b4f2f2a1a1b
4 years ago
Ian Howell d775b2159a This updates the current unit tests for testify
This commit removes any assertion from Go's "testing" package,
preferring instead to use an assertion from the testify package. All
tests now have uniformity.

This also decrease the number of iterations in the password generation
test, decreasing test runtime tenfold

Change-Id: I8799110e93dfa19bebe9050528e865b4c991c3df
4 years ago
Kostiantyn Kalynovskyi 3101e642ce Small increase in test coverage
Improving test coverage

Change-Id: I0e4da35f24b16d143cf0e4045182ae7d93d13b1c
4 years ago
Kostiantyn Kalynovskyi f8f6f8be27 [AIR-97] Moving WriteOut function from bundle pkg
This commit moves Write function to separate yaml package, and makes
it available to anyone for dumping documents in single file, with
correct yaml separators '---', '...'.

This will allow, for example dumping of filtered from bundle documents
to disk or any writer, like Stdout, for debugging purposes. Specifically
it will be used as part of `airshipctl cluster initinfra` command as a
buffer for delivering resources to kubernetes cluster.

Change-Id: I780e3f2d2ff446b8787153f500d04d10487ed71b
4 years ago
Ian Howell dc9c78b210 Fix the coverage tests
This fixes a bug where `make cover` was missing packages. The target now
covers all code except for code placed in the top level package (such as
main.go) and anything placed in the testutils directory.

This also fixes minor issues with the Dockerfile and the coverage_check
script

Note that this commit also strives to increase code coverage beyond the
80% margin

Change-Id: I9e1cbcf841cc869345a00f05e39774cb3da10065
4 years ago
Dmitry Ukov 1f2e20e106 [AIR-137] Add isogen subcommand for bootstrap
This is just a frame for command that will execute docker container
with ISO builder scripts

Change-Id: I59a5c494785af3cbcffd3b9f6a488d93f73f4878
4 years ago
Ian Howell d6b06a8787 Zuul: Switch from travis to zuul
This PS adds the skeleton for a set of zuul checks and gates for
airshipctl and removes the travis config.

This PS also removes some dead code from the util package. This change
is required to get unit tests passing.

Change-Id: Ifb1be49cb1bb82c62a0085b6da9b8ff1b261a95b
4 years ago
Ian Howell a8e649eb67 Move workflow listing to its own package
* adds the AGE, DURATION, and PRIORITY columns
* adds the --all-namespaces flag
4 years ago
Ian Howell be2a61047c Move tabwriter to package util
This offloads the "magic numbers" that are used when creating a
tabwriter
4 years ago
Ian Howell 34d0ff7e4d Remove dead code related to old plugin method 4 years ago
Ian Howell 6f6abb3b36 Remove bogus test files 4 years ago
Ian Howell 6f879da587 Separate plugins from airshipctl 4 years ago
Ian Howell 7a34fd98d9 Change airshipadm to airshipctl 4 years ago
Ian Howell b019ba757f Add checks for readable kube config 4 years ago