ADD: return condition for blank source string.
ADD: test case 26 for example.
CHG: Updated source value variable type
Closes: #620
Change-Id: Id2bac427cd0570eac3e87b98ded665d70613d2d6
1. Extending templater with kyaml functions and creating combined catalogue
to be able to request/update the existing resources.
This is based on 'everything is transformer' concept introduced in kustomize 4.x
That includes gathering all secrets into 1 variable catalogue and
special mechanism to regenerate/merge with manual secrets.
2. Implementing 'catalogue per cluster' approach for secrets.
3. Rearranging secrets so it's possible to use:
pgp (each person may have his own key), age, Hachicorp Vault and etc
and the list of people who can decrypt documents is set in a special file.
Since in some cases there should be a separate list of people who can decrypt
data - this list is set for each cluster (ephemeral and target) separatelly.
Closes: #586
Change-Id: I038f84dd138d5ad4a35f4862c61ff2124c2fd530
'make manifests' attempts to generate all airshipctl API types,
but several types throw errors and the resulting CRDs can't be
properly generated. This change:
- updates the controller-gen version to pull in a bug fix for the
error 'map values must be a named type, not *ast.StarExpr'
- modifies the Templater type's Values member to be of type JSON
since controller-gen does not support map[string]interface{},
and unmarshals it separately in the templater itself
- adds 'image_repositories' to the VersionsCatalogueSpec struct
to ensure it doesn't get deleted from the schema when manifests
get regenerated
- checks in generated copies of all CRDs from airshipctl's API
types, not just catalogues, to be used for validation
Closes: #574
Change-Id: I89a12cfd307a08da9aaec9773eac01169ea43ace
This is needed to be able to select documents inside toolbox
and maybe other KRM functions in the future
Relates-To: #517
Change-Id: I0c0c3552d98bcbe1ea02fb7b582d844a3d8f1c16
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
This reverts commit 154bcec95cc207339f05dd4d62e987efb25d0366
We don't use this function anywhere, moreover
fs related functions are way beyond the reasonable
functionality of templater. Especially taking
into account that we have only 1 function.
Change-Id: I919d8466ff1eab2d2687db7055bf974b7b608d8e
The original sprig-library implementation of
genCA and genSignedCert may accept only CN parameter
which isn't enough for K8s admin certificate.
That certification must have O=system:masters, e.g.
/CN=admin/O=system:masters
This PR introduces the set of functions that
insted of cn accept subj argument that may have
a form compatible with openssl -subj parameter.
If the first symbol isn't '/' subj behaves as
cn argument.
The set of new functions that accept subj arg is:
genCAEx
genCAWithKeyEx
genSignedCertEx
genSignedCertWithKeyEx
Since the implementaion required to copy some
non-exported helper functions from sprig,
the decision was made to separate all go-template
extension functions into a separate package:
extlib. This package can be reused in other
go-applications, it's just necessary to use
GenericFuncMap function to get function-map.
Change-Id: I0ffddee2e597323803bf5f1b54f315ded424b7be
* This commit will removed capitalizaion in Error message
and follow the Golang code rule.
* Golang errors should not begin with capitalization:
https://github.com/golang/go/wiki/CodeReviewComments#error-strings
Signed-off-by: bijayasharma <vetbijaya@gmail.com>
Change-Id: I053cfa9e21ad56b0f30e476ec36320cb7cea4da4
The following code uses the documentFs interface and adds
simple fileExists function to templater plugin.
Change-Id: Ia53c573e54188960eaf99f7c48469359d4e3688b
Adding go code to templater to support generation of strings
based on the regular expression passed.
Closes: #438
Change-Id: Ife0c4f8d5dd8032408875c73ba098919470be9e9
This PS adds decoding features to ReplacementTransformer to decode
the source objectRef when source is of `kind: Secret` and has `data`
field. It also encodes the value in the target fieldRefs before
replacement if the target is `kind: Secret` and has `data` fields.
Throws an error if the target fieldRefs have both `data` and `stringData`
for replacement.
Change-Id: I1d918058409b3511faa9a99512d25574027bda86
Along with the change to support proxy configuration for control plane
there is a change for replacement transformer to support arrays of strings.
The current implementation of cloud-init configuration for the control plane
based on KubeadmControlPlane object and uses an array of strings for commands.
Change-Id: Id0a49cc1a0fdbc392c7c7a56859b21737065b0d6
Plugin extended to support new kustomize plugin framework which
consider each plugin as a container
Change-Id: If55b7093f711401165b7d4fd3f5b1059fde464ff
Relates-To: #340
Change introduces kyaml.RNode Pipe Filter which uses k8s go-client JSON
path parser. This enables to use JSON queries defined by
https://goessner.net/articles/JsonPath/
Change-Id: I6c2276f27652190ed9d183cea0e45eb118346c6b
Relates-To: #340
Change introduces evolution of airshipctl document plugins which
are compatible to the new approach for kustomize plugins.
Change-Id: I422110ba523b97c8a80a0b82cb43b70a4ee8e558
Relates-To: #322
Data structure representing plugin configurations should be a part of
airshipctl API module. Plugin implementations will reside in document
package.
Change-Id: Id2e359b747a16a5573052cfb05c1148d346db508
Relates-To: #322
This change adds the ability to use substring substitution to inject
numeric source values into string targets. This is required for our
networking catalogue, since a numeric k8s API port needs to be inserted into
numeric and (sub)string targets in different phases.
Co-Authored-By: Ian Howell <ian.howell0@gmail.com>
Change-Id: I24beb46a2bda4e118406129a0a922b0c56142c76
AirshipCTLSettings are not used here, so it was removed.
Change-Id: If4bf64b9991b4ac05898632c79bacbacd7872635
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
* Substring replacement failing in ReplacementTranformer when
target substring contains periods (.)
* This is temporary fix till the kpt-function way of replacement
transformer is implemented
* In this fix it is assumed that the substring condition can only occur at
the end of the path.
example:
expected: replace the nginx version from 1.7.9 to 1.17.0 for container named
`nginx-tagged`
target condition:
spec.template.spec.containers[name=nginx-tagged].image%1.7.9%
Change-Id: I76fb65f69a6eedf3cbdd692d3bc1835a214dc8fa
Relates-To: #336
Closes: #336
1) modifications to exported functions/variables documentation
2) moved some methods into a different folder
Change-Id: I212442516424bde3284f75b326d152c290d20c80
This PS has a function which constructs a collection of Metal3 BareMetalHost
resources, along with associated configuration Secrets.
It solves for a couple of things:
1. pulling the nitty gritty details for generating BMH into one reusable place,
2. allowing the site-specific details to be filled in via catalogues of values
This function leverages a couple of different plugins in sequence:
The airshipctl Replacement plugin, which pulls the site-specific data from
the catalogue documents into a Templater plugin configuration; and then
the airshipctl Templater plugin, which generates a variable number of
BMHs in a data-driven fashion.
More details can be found in the README.md in this patchset.
Closes: #245
Change-Id: I3ddbd36dc53ea6afbd633098c985f4b28bcbb793
Issues raised after enabling golint as part of golangci-lint
* error var ToDiscoveryError should have name of the
form ErrFoo (golint)
* error strings should not be capitalized or end with punctuation
or a newline (golint)
Issues not raised by golint embedded within golangci-lint
* comment on exported function <funcname> should be
of the form "<funcname> ..."
So kept the golint standalone tool also in Makefile
Change-Id: I7f2ce66d1e757bc24c042fc212226cecea297f27
The ReplacementTransformer already checks for the error condition where
a replacement source doesn't match any of the input documents.
This change adds similar error handling for missing replacement
target documents, and tweaks the naming/messages to make it clear
which situation is encountered.
This will make it easier for manifest engineers to catch typos
in their RT rules, or documents that have failed to be kustomized in
or authored.
Change-Id: I0efbcfbc2952afae05e48b9ff8e0b3c67df7e7df
Plugin is responsible for resource generation based on template
(go template format is used) supplied to its configuration.
Go template can use an object (map) specified under 'spec'
configuration parameter.
Change-Id: I8c1b7dc5676bfff2f9b1a47f6433177ae796a15f
* Add ability to to replace whole list element filtered by key and
value
* Raise an error in if user has specified wrong list filer in JSON path
* Enables support for a dot character in a value used in list filtering
Closes: #191
Closes: #192
Change-Id: I889550ee88d5738a1fb808ddef6478c3731b1561
* Replace paramter specified by JSON path with predefined value or
with the value from another resource
* Replace substring in a paramter specified by JSON path with predefined
value or with the value from another resource
Transformer copied from
https://github.com/mattmceuen/kustomize/tree/substring-subst
Closes: #174
Change-Id: I3a958a0df724fb2eb81bb199a02cf1db81bb0d2f
Co-Authored-By: Matt McEuen <matt.mceuen@att.com>
airship document plugin is intended to be executed as an exec plugin
for kustomize document model.
Environment variable is used to gather plugin configuration. Plugin to
execute is determined based on group-version-kind specified in plugin
configuration. Each airship plugin must implement plugin interface.
Relates-To: #173
Change-Id: I4f6c3b5be140c0d8fd7519f1cedd33de1cef662c