-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #2262: Allowing users to specify arbitrary CLI arguments for A…
…nsible-based operators (#3374) * Added `--ansible-args` flag that allows users to pass in arbitrary flags to the ansible binary.
- Loading branch information
1 parent
96b4e32
commit bd9057c
Showing
13 changed files
with
167 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
entries: | ||
- description: > | ||
Added the "--ansible-args" command-line flag that allows users to specify arbitrary | ||
CLI arguments for ansible-based operators that are passed through ansible-runner. | ||
For example, passing --ansible-vault as an arbitrary argument allows the user to store | ||
sensitive data in encrypted files. | ||
kind: "addition" | ||
breaking: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
test/ansible/deploy/crds/test.example.com_argstest_crd.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: argstests.test.example.com | ||
spec: | ||
group: test.example.com | ||
names: | ||
kind: ArgsTest | ||
listKind: ArgsTestList | ||
plural: argstests | ||
singular: argstest | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
x-kubernetes-preserve-unknown-fields: true | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
- name: Create the test.example.com/v1alpha1.ArgsTest | ||
k8s: | ||
state: present | ||
definition: | ||
apiVersion: test.example.com/v1alpha1 | ||
kind: ArgsTest | ||
metadata: | ||
name: args-test | ||
namespace: '{{ namespace }}' | ||
spec: | ||
field: value | ||
wait: yes | ||
wait_timeout: 300 | ||
wait_condition: | ||
type: Running | ||
reason: Successful | ||
status: "True" | ||
register: args_test | ||
|
||
- name: Assert sentinel ConfigMap has been created for Molecule Test | ||
assert: | ||
that: cm.data.msg == "The decrypted value is thisisatest" | ||
vars: | ||
cm: "{{ q('k8s', api_version='v1', kind='ConfigMap', namespace=namespace, | ||
resource_name='args-test').0 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- hosts: localhost | ||
gather_facts: no | ||
collections: | ||
- community.kubernetes | ||
tasks: | ||
- name: Get the decrypted message variable | ||
include_vars: | ||
file: /opt/ansible/vars.yml | ||
name: the_secret | ||
- name: Create configmap | ||
k8s: | ||
definition: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: '{{ meta.name }}' | ||
namespace: '{{ meta.namespace }}' | ||
data: | ||
msg: The decrypted value is {{the_secret.the_secret}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters