Commit Graph

73 Commits (faa13c51adae311e187380972837d81ca60d3e54)

Author SHA1 Message Date
Vladimir Kozhukalov fc572453a5 Remove unnecessary code
- Use
   instead of
   which makes selectors conversion code unnecessary

 - Use document.GetSecretDataKey instead of
   document.DecodeSecretData which removes code duplicates

Change-Id: Ie2c6b8d8222b7acb1b657f8d786a8c3a06b0c6fd
2 years ago
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

Relates-To: #440

Change-Id: I3600e82fa1d8a92cdf103d93cd4536bf4a713cca
2 years ago
Kostiantyn Kalynovskyi 971c81acdb Extend container interface with mounts get log opts
This commit allows to specify options to get container logs, such
as stderr, stdout and if logs should be followed.

Also extends RunCommandOptions with ability to add mounts in addtion
to binds

Relates-To: #458
Change-Id: I83507f2f7ca6ea596f52f5d3e9f868467458b6a3
2 years ago
Kostiantyn Kalynovskyi 3ae387e9f2 Change container RunMethod to allow extending
This will make sure that when we add new features to how the
docker container is run, we don't need to change interface
method signature everywhere we use it.

Relates-To: #458

Change-Id: I12273264c1a8061300017246a1a4a17125ca8ae2
2 years ago
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 <>
Closes: #432
2 years ago
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
2 years ago
Anderson, Craig (ca846m) 2daacf5f2a image-builder integration for ISO builds
This introduces airshipctl integration with image-builder [0], which
replaces the existing isogen tool for ephemeral ISO generation.

The airshipctl isogen executor has been updated for building ephemeral
ISOs using the image-builder container. The ability for user-declared
filenames for cloud-init user data and network data was removed, since
the user's only interest is in supplying the relevant overrides, not in
transparent naming coordination with the image-builder container. A new
object is added to the document package to identify the document kind,
label, and key to retrieve data from since this is pattern we will
reuse elsewhere.

Progress flag removed as requsted. Progress is reported directly by the
image-builder container.

Isogen debug flag removed in favor of using log.DebugEnabled()


Change-Id: I545004feaf2116f8ffb29faf6f7f7f5fcfe24fff
2 years ago
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 <>
Relates-To: #432
3 years ago
Ruslan Aliev b799edc0a7 Split isogen package into isogen and isogen_test
We should follow black-box pattern in unit test, so they should be
performed in a separate package. This patch fixes it for isogen

Change-Id: I60a22213e943eaa85ce75979071897c42308e1ae
Signed-off-by: Ruslan Aliev <>
Relates-To: #432
3 years ago
Ruslan Aliev 94a17694ea Move MockDocument implementation to testutils
Currently MockDocument implementation located under pkg/bootstrap/isogen
package, which is not relevant for it and makes it impossible to import
in other test packages. Also _test.go filename is not proper one for
this source file since it doesn't contain any unit tests inside.

Change-Id: I9b3f28df653637701f5d6fca4376da5a22f39658
Signed-off-by: Ruslan Aliev <>
Relates-To: #432
3 years ago
Ruslan Aliev d7ca864295 Move mockContainer implementation to testutil
Currently mockContainer implementation is located under
pkg/bootstrap/isogen and it's not possible to import it from
other packages. This patch moves it to appropriate new package
under testutil.

Signed-off-by: Ruslan Aliev <>
Relates-To : #432

Change-Id: I36510e8e065434de597e7316dfbe51da0825d343
3 years ago
Zuul 5dbacb0a20 Merge "Bootstrap Ephemeral - Command methods" 3 years ago
Sidney Shiba fb49020d00 Bootstrap Ephemeral - Command methods
This patch set includes the methods supporting the bootstrap
container feature, which will be used by the BootConfiguration
executor, as part of "phase run" implementation.

The methods under command.go file are responsible for creating the
bootstrap container, monitor its state, etc.

Change-Id: I3f6b1a0bb7c7be7ac29487d09ae2ccd5e9f4bd87
3 years ago
Dmitry Ukov aa46185975 Uplift kustomize api and kyaml versions
Change-Id: Id8334a74efb7f1004a36f2bfc0c6eca81380ef4d
Relates-to: #369
3 years ago
Sidney Shiba f4e532e91a Extending Container interface and package
Adding the following method to the interface and implementation for
docker container:
- InspectContainer() - used to determine container status

Change-Id: I4a8096f4f5addad31daa5038a30b1ffcf1d424e9
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 ac6e8d1194 Remove not needed context pointers in container interface
Container interface is being extended right now, because we
build new things on top of it, such as bootstrap containers.

Current version of it, was delivered as MVP and is used only
in ISOGEN. During MVP stage we didn't bother too much about
the pointers and readability. However now when we built something
new on top of it, we want to make sure that it we dont make
matters worse, and building on solid foundation.

The pointers are not needed in any way, and they are dereferenced
on top of that, context.Context is an interface, and there is
very limited theoretical use of pointers to interfaces.

Change-Id: Iee1eeb89f058aa8e994cba685b49085707362ee1
3 years ago
Ruslan Aliev 0a1bb41e2d Simplify ShowProgress unit test
Due to variable CPU load on zuul site, there is a possibility that
progress bar will dump its intermittent state during ShowProgress
test execution. This patch simplifies a bit assertion logic so only
"Completed" state of progress bar will matter, possible intermittent
output will be omitted from assertion.

Change-Id: I5369bf57752df928c0bd9f223cfaa17f8f0b0018
Signed-off-by: Ruslan Aliev <>
3 years ago
Vladislav Kuzmin f9f8c43e8a Add timestamp for events
Relates-To: #339
Change-Id: Iec939e167b6ae3c72aa31e102407d0fffc370766
3 years ago
Ruslan Aliev a6363f1c1e Run image build command like a phase
We perform almost the same activities prior calling createBootstrapIso
function like we do that in phase executor, also image build command
now is techically outdated since it doesn't work because it fails with
"phase document was not found" error. This patch removes unnecessary
functions like GenerateBootstrapIso and runs image build command in
a phase way. Test coverage increases slightly (by 0.2%) by removing
partially duplicating code which was not tested properly. Minor bug
fixes included.

Change-Id: I545004cea721164838b296ae647a7651cde248ff
Signed-off-by: Ruslan Aliev <>
3 years ago
Vladimir Kozhukalov 0dc4ab7491 Replace PrimaryRepositoryName with PhaseRepositoryName
Change-Id: I2276a3b3ea50b8e81dd240815cd00a0a2a2af96e
Relates-To: #356
3 years ago
Ruslan Aliev fc33287204 Remove kubeconfig from config struct
Change-Id: I5ab8722dd151d9e652e0b20e1d82988cd98505af
Signed-off-by: Ruslan Aliev <>
3 years ago
Ruslan Aliev cc46ae2ef4 Fix unit test for showProgress function
Sometimes unit test for showProgress function fails if progress bar
was not finished before refreshing event occurs, so progress bar
prints to io.Writer its intermediate state (which is normal since
in regular terminal the output everytime overwrites by carriage
return), so expected and actual output become different. This PS
changes the concept of testing this function and adds the error
tracking of showProgress execution. Some other minor changes included.

Change-Id: I78b4fa9674d4412fa83c1e9320b686923cbe8084
Signed-off-by: Ruslan Aliev <>
3 years ago
Zuul 2a47c00f00 Merge "Add progress bar and improve cmd output for image build command" 3 years ago
Zuul e4a2c68d3e Merge "Use BundleFactory instead of bundle in executors" 3 years ago
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
3 years ago
Ruslan Aliev ec51a71181 Add progress bar and improve cmd output for image build command
This patch provides the ability to show progress bar using
container logs (ubuntu/debian based only).

Change-Id: I86eebe4d368d81c4685fb27ca31b86cbb3dea08d
Signed-off-by: Ruslan Aliev <>
Relates-To: #278
3 years ago
Kostiantyn Kalynovskyi 065888d6c7 Add functions for default api objects
This allows to avoid nil pointers when working with unmarshaled
objects, that may be missing some fields.

Next step would be to revisit why pointers are used in such obj
as Clusterctl and ImageConfiguration

Change-Id: I99a711529a53943ef1b0cb1ebb4d240f2482fac8
3 years ago
Ruslan Aliev 0c736af2e8 Implement render methods
Change-Id: I03b7aad33576eaa9ef7dfaabfb579ac90cc26a12
Signed-off-by: Ruslan Aliev <>
3 years ago
Zuul 0bdbd690db Merge "Fix typos" 3 years ago
Kostiantyn Kalynovskyi fc72884676 Fix clusterctl, IsoGen executors to emit proper events
Change-Id: Ib69d9c85f7d27b83726f925d5a802c8e950c3a86
3 years ago
Ruslan Aliev 2e85043c20 Fix typos
Change-Id: I0ce87ec00d2b5974cf861d9c9685f23d7d0f5fc1
Signed-off-by: Ruslan Aliev <>
3 years ago
Vladislav Kuzmin 27e0ab455c Add isogen executor
Relates-To: #344
Change-Id: I1b9b04f1f723d8df6d6aad63b64a917566b22176
3 years ago
Ruslan Aliev 5a94f9f99c Remove get/set-authinfo/cluster commands
These commands are no longer required since we going to remove
clusters and users from config. Appropriate fields will be removed
from Config struct in different PS.

Change-Id: I121280e91e394a38384202d9f5ffaaf4e458f82f
Signed-off-by: Ruslan Aliev <>
Relates-To: #327
3 years ago
Ruslan Aliev e81116b1a9 Refactor image* commands
All the image 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: I3c51f201ec70b194ce1f127ff43a28292cf691f3
Signed-off-by: Ruslan Aliev <>
Relates-To: #327
3 years ago
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 <>
Relates-To: #327
3 years ago
Vladimir Kozhukalov e9c8425c30 Move bootstrapInfo config section to manifests
This is a part of two activities
  * Refactor config and store all parameters to document model
  * Implement everything as phases (which are supposed to be purely document driven)

 This patch removes bootstrapInfo section from the airshipctl config and
 makes these to commands
  * airshipctl baremetal isogen
  * airthipctl baremetal remotedirect
 to take necessary parameters from documents

 We introduce two airship API kinds ImageGenerator and RemoteDirect.
 Instead of storing config parameters in cm/secrets we use these two
 API objects.

Relates-To: #246
Closes: #254
Change-Id: I42903c45dce1c73da184c07277fec76fd88c700f
3 years ago
Ruslan Aliev 160117af3a Use log module to determine current log level
As part of config refactoring process, it makes sense to
remove Debug field of AirshipCTLSettings and use log module
method as source of truth about current log level.

Change-Id: I42e3a9fd3b4e2778c71278f98a0d168421dfd2fb
Signed-off-by: Ruslan Aliev <>
Relates-To: #327
3 years ago
bijayasharma 241714d042 [#308] Removed code style issue on Error string
* This commit will remove code style issue on Error string

Change-Id: Ib2344de75768362a88c077354193878366ce4b0c
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
Kostiantyn Kalynovskyi da2799bee3 Change bootstrap bundle entrypoint to phase dir
Change-Id: I85151f42e510eb113bcc3bb86d56043d51bf348a
Relates-To: #175
3 years ago
Zuul 8438935cfe Merge "Update Kustomize integration to api/v0.3.1" 3 years ago
Zuul e7380b3ba6 Merge "Remove getters/setters of AirshipCTLSettings" 3 years ago
Matt McEuen e52ed80363 Update Kustomize integration to api/v0.3.1
This updates the Kustomize dependency for airshipctl to
api/v0.3.1, which is the oldest version which will support the
Replacement Transformer plugin.

Some changes were needed to accomodate the fact that various apis
that airshipctl was relying on were moved to kustomize-insternal
packages, namely:
- Integrated with the krusty.Kustomizer to drive kustomization
- Removed the custom plugin loader which leveraged the Unknown type
- Worked around NoFieldError becoming private, inc. removing a test

As a follow on we'll need to re-integrate plugin functionality somehow.

Also, in this release Kustomize has implemented support for the
"" annotation, which we'd planned
to use to to avoid deploying some documents to the Kubernetes API.
It turns out the semantics are different than we anticipated;
Kustomize also fails to return these docs via document *selection*.
Therefore, this change reverts to an earlier approach which uses
a custom label.

Change-Id: I7022e12464ea7b6a3ca8609f99f3699bf8da0edd
3 years ago
Zuul 121adcddc8 Merge "Fixed TODO about error definitions" 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/

* 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/
  2. tools/license_go.txt
  3. tools/license_yaml.txt
  4. tools/license_bash.txt

Change-Id: Ia4da5b261e7cd518d446896b72c810421877472a
3 years ago
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
3 years ago
Stanislav Egorov f7a2e33b8b Fixed TODO about error definitions
Use SelectOne to replace Select and additional checks.

Change-Id: I40b4780d62fa4b3a0e01cc54ef7dbe4b32a4763d
3 years ago
Alan Meadows e2cca32748 Add Redfish Authentication Support
This commit also introduces a dochelper concept.  This provides
some convenience methods to the document pkg that help extract data
from known document types as well as walk document relationships to
discover related information such as BMC credentials for baremetal

Once merged, a follow up patchset will leverage these within the
cloud-init code to deduplicate some of these lookups.

Change-Id: Ie6a770ce4b34adbea30281917f0cb2fdc460b4fb
3 years ago
Kostiantyn Kalynovskyi c1cce8f9c5 Add single source of Seletors
Also this commit, adds condition to setup testbundle, that ignores

Commit adds new set of functions that allow easy selection of
documents from bundle for different modules.

Relates-To: #61
Closes: #61

Change-Id: I6011203a1f573cbb847e9f57c04aa60bf8278ef1
3 years ago