17 Commits

Author SHA1 Message Date
Ruslan Aliev
2e85043c20 Fix typos
Change-Id: I0ce87ec00d2b5974cf861d9c9685f23d7d0f5fc1
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
2020-09-21 02:49:33 -05:00
Sirajudeen
1d34132b87 Added unit test for missing document functions
* Added more unit tests to increase test coverage

Change-Id: I292ddcd1c98ae49b37032a7d6111e063be397de3
2020-07-16 15:36:04 -05:00
Dmitry Ukov
c05286d3f6 Implement document filtering using api objects
Change-Id: I9ac70ed85c949224d091e9e3afead70084b38170
Co-Authored-By: Vladimir Kozhukalov <kozhukalov@gmail.com>
2020-06-23 13:12:33 +04:00
Kostiantyn Kalynovskyi
36facd30eb Add new constructor to create documents
The change would allow to build a document object from bytes

Change-Id: I15c13a960b4e989cffa4525c85b8f32f2a51a0e1
Relates-To: #238
Relates-To: #279
Closes: #279
2020-06-17 22:31:24 +00:00
Dmitry Ukov
155db7dca5 Extend document interface with utility methods
* GetGroup, GetVersion and GetKind now can be used to construct GVK
  structs
* ToObject deserialize document to a particular object. This is
  needed to precess custom resources which were defined for airship

Change-Id: I527e2c73288e865455853c5553bffd508a2d2eb6
2020-06-02 15:20:01 +04:00
Zuul
8438935cfe Merge "Update Kustomize integration to api/v0.3.1" 2020-04-14 11:36:33 +00:00
Zuul
f520dc1190 Merge "Change Label and Annotate to accept map of string" 2020-04-13 19:07:47 +00:00
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
"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
2020-04-13 10:06:41 -05:00
Kostiantyn Kalynovskyi
b485f00c58 Change Label and Annotate to accept map of string
The methods are useful when incoming data are not key value pairs,
rather than iterating two times, one time when we call Annotate()
or Label() over the map, and then iterate again inside the function,
it would be better if we could skip iterating the first time, and
let everything to be handled by Annotate or Label functions

Relates-To: #162

Change-Id: Ia9d989a0534d15e4024317c4606a187ac021b751
2020-04-09 16:34:05 -05:00
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
2020-04-09 08:35:59 -05:00
Ian Howell
cdc6ba66f1 [#102] Add function pass forwarding for annotating
* Expose the GetAnnotations method of the document.Document interface.
* Add the Annotate method for adding a single annotation to a
  document.Document
* Clean up the implementation of Label and GetLabels

Change-Id: I94af2380f50848bfcd64af9d5c2c991305d9746f
Relates-To: #102
2020-03-17 12:18:52 -05:00
Stanislav Egorov
5224ed1b62 [#103]: replaced external methods for document interface
Removed external methods from document interface.
Created new methods to supply document labelling.

Change-Id: I4c20ad515999a6c049a2feddafdb62af8e1dfefb
2020-03-16 15:08:19 -07:00
Kostiantyn Kalynovskyi
c1cce8f9c5 Add single source of Seletors
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
2020-03-13 16:31:12 -05:00
Ian H. Pittwood
c7c1011a5c Fix various code style issues
Fixes possible name collisions between variable names and package names

Remove redundant import naming

Use nil slices for slice declarations instead of empty slices

Use make for slices of fixed lengths

Remove redundant parentheses

Replace deprecated `SetOutput` method with `SetOut`

Fix swapped actual/expected arguments on assertEqualGolden

Change-Id: Ia39ef44372c3e44948e5440575125bdb470898df
2020-02-07 09:28:18 -06:00
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
2020-01-10 14:54:34 -06:00
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
2019-11-07 12:15:06 -06:00
Alan Meadows
7eeb529053 Initial commit for document pkg library
This introduces two new interfaces to airshipctl:

* Bundle: represents a Kustomize rendered
collection of your documents that allows you to
iterate over or filter the documents in the bundle.

* Document: a thin wrapper around a rendered
document.

This commit also includes a proposal for a way to
represent YAML test fixtures as testdatafs.go
and a new testdata subfolder within the document
pkg.

Change-Id: I4282b27977617552c25c5ae2c3b7da44e67dd014
2019-10-04 14:22:26 -07:00