- Use opendev.org/airship/airshipctl/pkg/document.Selector
instead of sigs.k8s.io/kustomize/api/types.Selector
which makes selectors conversion code unnecessary
- Use document.GetSecretDataKey instead of
document.DecodeSecretData which removes code duplicates
Change-Id: Ie2c6b8d8222b7acb1b657f8d786a8c3a06b0c6fd
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
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
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
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
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
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()
[0] https://review.opendev.org/#/c/730777/
Depends-On: https://review.opendev.org/c/airship/images/+/730777/
Change-Id: I545004feaf2116f8ffb29faf6f7f7f5fcfe24fff
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
We should follow black-box pattern in unit test, so they should be
performed in a separate package. This patch fixes it for isogen
package.
Change-Id: I60a22213e943eaa85ce75979071897c42308e1ae
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #432
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 <raliev@mirantis.com>
Relates-To: #432
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 <raliev@mirantis.com>
Relates-To : #432
Change-Id: I36510e8e065434de597e7316dfbe51da0825d343
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
Adding the following method to the interface and implementation for
docker container:
- InspectContainer() - used to determine container status
Change-Id: I4a8096f4f5addad31daa5038a30b1ffcf1d424e9
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
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
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 <raliev@mirantis.com>
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 <raliev@mirantis.com>
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 <raliev@mirantis.com>
This patch provides the ability to show progress bar using
container logs (ubuntu/debian based only).
Change-Id: I86eebe4d368d81c4685fb27ca31b86cbb3dea08d
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #278
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
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 <raliev@mirantis.com>
Relates-To: #327
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 <raliev@mirantis.com>
Relates-To: #327
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 <raliev@mirantis.com>
Relates-To: #327
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
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 <raliev@mirantis.com>
Relates-To: #327
Currently it takes ClusterType as first parameter, however
this parameter can be retrieved via appropriate function
CurrentContextClusterType in the same module.
Change-Id: I205fd7d00bf1745cada88d8fd972dac1dbe0fddf
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
"config.kubernetes.io/local-config" 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 airshipit.org/deploy-k8s label.
Change-Id: I7022e12464ea7b6a3ca8609f99f3699bf8da0edd
* 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
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
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
hosts.
Once merged, a follow up patchset will leverage these within the
cloud-init code to deduplicate some of these lookups.
Change-Id: Ie6a770ce4b34adbea30281917f0cb2fdc460b4fb
Also this commit, adds condition to setup testbundle, that ignores
directories
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