Skip to content

Commit 6a26fec

Browse files
authored
Merge pull request #40 from mbaldessari/common-automatic-update
common automatic update
2 parents 1cdf086 + ebab53d commit 6a26fec

File tree

75 files changed

+2164
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2164
-568
lines changed

common/.github/workflows/superlinter.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
# Run Linter against code base #
2222
################################
2323
- name: Lint Code Base
24-
uses: github/super-linter/slim@v6
24+
uses: super-linter/super-linter/slim@v7
2525
env:
2626
VALIDATE_ALL_CODEBASE: true
2727
DEFAULT_BRANCH: main
@@ -31,10 +31,13 @@ jobs:
3131
VALIDATE_BASH: false
3232
VALIDATE_CHECKOV: false
3333
VALIDATE_JSCPD: false
34+
VALIDATE_JSON_PRETTIER: false
35+
VALIDATE_MARKDOWN_PRETTIER: false
3436
VALIDATE_KUBERNETES_KUBECONFORM: false
3537
VALIDATE_PYTHON_PYLINT: false
3638
VALIDATE_SHELL_SHFMT: false
3739
VALIDATE_YAML: false
40+
VALIDATE_YAML_PRETTIER: false
3841
# VALIDATE_DOCKERFILE_HADOLINT: false
3942
# VALIDATE_MARKDOWN: false
4043
# VALIDATE_NATURAL_LANGUAGE: false

common/Changes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
## October 3, 2022
125125

126126
* Restore the ability to install a non-default site: `make TARGET_SITE=mysite install`
127-
* Revised tests (new output and filenames, requires adding new result files to git)
127+
* Revised tests (new output and filenames, requires adding new result files to Git)
128128
* ACM 2.6 required for ACM-based managed sites
129129
* Introduced global.clusterDomain template variable (without the `apps.` prefix)
130130
* Removed the ability to send specific charts to another cluster, use hosted argo sites instead

common/Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,18 @@ super-linter: ## Runs super linter locally
238238
-e VALIDATE_CHECKOV=false \
239239
-e VALIDATE_DOCKERFILE_HADOLINT=false \
240240
-e VALIDATE_JSCPD=false \
241+
-e VALIDATE_JSON_PRETTIER=false \
242+
-e VALIDATE_MARKDOWN_PRETTIER=false \
241243
-e VALIDATE_KUBERNETES_KUBECONFORM=false \
242244
-e VALIDATE_PYTHON_PYLINT=false \
243245
-e VALIDATE_SHELL_SHFMT=false \
244246
-e VALIDATE_TEKTON=false \
245247
-e VALIDATE_YAML=false \
248+
-e VALIDATE_YAML_PRETTIER=false \
246249
$(DISABLE_LINTERS) \
247250
-v $(PWD):/tmp/lint:rw,z \
248251
-w /tmp/lint \
249-
ghcr.io/super-linter/super-linter:slim-v6
252+
ghcr.io/super-linter/super-linter:slim-v7
250253

251254
.PHONY: ansible-lint
252255
ansible-lint: ## run ansible lint on ansible/ folder

common/acm/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ description: A Helm chart to configure Advanced Cluster Manager for OpenShift.
33
keywords:
44
- pattern
55
name: acm
6-
version: 0.1.0
6+
version: 0.1.1

common/acm/templates/policies/ocp-gitops-policy.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ spec:
3535
labels:
3636
operators.coreos.com/openshift-gitops-operator.openshift-operators: ''
3737
spec:
38-
channel: {{ default "gitops-1.12" .Values.main.gitops.channel }}
38+
channel: {{ default "gitops-1.13" .Values.main.gitops.channel }}
3939
installPlanApproval: Automatic
4040
name: openshift-gitops-operator
41-
source: redhat-operators
41+
source: {{ default "redhat-operators" .Values.main.gitops.operatorSource }}
4242
sourceNamespace: openshift-marketplace
4343
config:
4444
env:

common/acm/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
main:
22
gitops:
3-
channel: "gitops-1.12"
3+
channel: "gitops-1.13"
44

55
global:
66
extraValueFiles: []

common/ansible/plugins/filter/parse_acm_secrets.py

+1
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,6 @@ def parse_acm_secrets(secrets):
7979

8080

8181
class FilterModule:
82+
8283
def filters(self):
8384
return {"parse_acm_secrets": parse_acm_secrets}

common/ansible/plugins/module_utils/load_secrets_v1.py

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727

2828
class LoadSecretsV1:
29+
2930
def __init__(
3031
self,
3132
module,

common/ansible/plugins/module_utils/load_secrets_v2.py

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141

4242
class LoadSecretsV2:
43+
4344
def __init__(self, module, syaml, namespace, pod):
4445
self.module = module
4546
self.namespace = namespace

common/ansible/plugins/module_utils/parse_secrets_v2.py

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343

4444
class ParseSecretsV2:
45+
4546
def __init__(self, module, syaml, secrets_backing_store):
4647
self.module = module
4748
self.syaml = syaml

common/ansible/plugins/modules/vault_load_parsed_secrets.py

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282

8383

8484
class VaultSecretLoader:
85+
8586
def __init__(
8687
self,
8788
module,

common/ansible/roles/iib_ci/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# IIB Utilities
22

3-
A set of ansible plays to fetch an IIB (Image Index Bundle, aka a container created by the operator sdk
3+
A set of ansible plays to fetch an IIB (Image Index Bundle, aka a container created by the operator SDK
44
that contains a bunch of references to operators that can be installed in an OpenShift cluster)
55

66
Run `ansible-playbook common/ansible/playbooks/iib-ci/lookup.yml` to see which IIBs are available (defaults to

common/ansible/roles/vault_utils/README.md

+52-41
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ unseal_namespace: "imperative"
4040
4141
This relies on [kubernetes.core](https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_module.html)
4242
43+
## Vault out of the box configuration
44+
45+
This role configures four secret paths in vault:
46+
47+
1. `secret/global` - Any secret under this path is accessible in read-only only to all clusters known to ACM (hub and spokes)
48+
2. `secret/hub` - Any secret under this path is accessible in read-only only to the ACM hub cluster
49+
3. `secret/<fqdn.of.spoke.cluster>` - Any secret under this path is accessible in read-only only to the spoke cluster
50+
4. `secret/pushsecrets` - Any secret here can be accessed in read and write mode to all clusters known to ACM. This area can
51+
be used with ESO's `PushSecrets` so you can push an existing secret from one namespace, to the vault under this path and
52+
then it can be retrieved by an `ExternalSecret` either in a different namespace *or* from an entirely different cluster.
53+
4354
## Values secret file format
4455

4556
Currently this role supports two formats: version 1.0 (which is the assumed
@@ -55,49 +66,9 @@ By default, the first file that will looked up is
5566
The paths can be overridden by setting the environment variable `VALUES_SECRET` to the path of the
5667
secret file.
5768

58-
The values secret yaml files can be encrypted with `ansible-vault`. If the role detects they are encrypted, the password to
69+
The values secret YAML files can be encrypted with `ansible-vault`. If the role detects they are encrypted, the password to
5970
decrypt them will be prompted when needed.
6071

61-
### Version 1.0
62-
63-
Here is a well-commented example of a version 1.0 file:
64-
65-
```yaml
66-
---
67-
# By default when a top-level 'version: 1.0' is missing it is assumed to be '1.0'
68-
# NEVER COMMIT THESE VALUES TO GIT
69-
70-
secrets:
71-
# These secrets will be pushed in the vault at secret/hub/test The vault will
72-
# have secret/hub/test with secret1 and secret2 as keys with their associated
73-
# values (secrets)
74-
test:
75-
secret1: foo
76-
secret2: bar
77-
78-
# This ends up as the s3Secret attribute to the path secret/hub/aws
79-
aws:
80-
s3Secret: test-secret
81-
82-
# This will create the vault key secret/hub/testfoo which will have two
83-
# properties 'b64content' and 'content' which will be the base64-encoded
84-
# content and the normal content respectively
85-
files:
86-
testfoo: ~/ca.crt
87-
# These secrets will be pushed in the vault at secret/region1/test The vault will
88-
# have secret/region1/test with secret1 and secret2 as keys with their associated
89-
# values (secrets)
90-
secrets.region1:
91-
test:
92-
secret1: foo1
93-
secret2: bar1
94-
# This will create the vault key secret/region2/testbar which will have two
95-
# properties 'b64content' and 'content' which will be the base64-encoded
96-
# content and the normal content respectively
97-
files.region2:
98-
testbar: ~/ca.crt
99-
```
100-
10172
### Version 2.0
10273

10374
Here is a version 2.0 example file (specifying `version: 2.0` is mandatory in this case):
@@ -210,6 +181,46 @@ secrets:
210181
ini_key: aws_secret_access_key
211182
```
212183

184+
### Version 1.0
185+
186+
Here is a well-commented example of a version 1.0 file:
187+
188+
```yaml
189+
---
190+
# By default when a top-level 'version: 1.0' is missing it is assumed to be '1.0'
191+
# NEVER COMMIT THESE VALUES TO GIT
192+
193+
secrets:
194+
# These secrets will be pushed in the vault at secret/hub/test The vault will
195+
# have secret/hub/test with secret1 and secret2 as keys with their associated
196+
# values (secrets)
197+
test:
198+
secret1: foo
199+
secret2: bar
200+
201+
# This ends up as the s3Secret attribute to the path secret/hub/aws
202+
aws:
203+
s3Secret: test-secret
204+
205+
# This will create the vault key secret/hub/testfoo which will have two
206+
# properties 'b64content' and 'content' which will be the base64-encoded
207+
# content and the normal content respectively
208+
files:
209+
testfoo: ~/ca.crt
210+
# These secrets will be pushed in the vault at secret/region1/test The vault will
211+
# have secret/region1/test with secret1 and secret2 as keys with their associated
212+
# values (secrets)
213+
secrets.region1:
214+
test:
215+
secret1: foo1
216+
secret2: bar1
217+
# This will create the vault key secret/region2/testbar which will have two
218+
# properties 'b64content' and 'content' which will be the base64-encoded
219+
# content and the normal content respectively
220+
files.region2:
221+
testbar: ~/ca.crt
222+
```
223+
213224
Internals
214225
---------
215226

common/ansible/roles/vault_utils/defaults/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ vault_spoke_capabilities: '[\\\"read\\\"]'
1717
vault_spoke_ttl: "15m"
1818
vault_global_policy: global
1919
vault_global_capabilities: '[\\\"read\\\"]'
20+
vault_pushsecrets_policy: pushsecrets
21+
vault_pushsecrets_capabilities: '[\\\"create\\\",\\\"read\\\",\\\"update\\\",\\\"delete\\\"]'
2022
external_secrets_ns: golang-external-secrets
2123
external_secrets_sa: golang-external-secrets
2224
external_secrets_secret: golang-external-secrets

common/ansible/roles/vault_utils/tasks/vault_secrets_init.yaml

+23-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@
7171
pod: "{{ vault_pod }}"
7272
command: "vault policy write {{ vault_global_policy }}-secret /tmp/policy-{{ vault_global_policy }}.hcl"
7373

74+
- name: Configure VP pushsecrets policy template
75+
kubernetes.core.k8s_exec:
76+
namespace: "{{ vault_ns }}"
77+
pod: "{{ vault_pod }}"
78+
command: >
79+
bash -e -c "echo \"path \\\"secret/data/{{ vault_pushsecrets_policy }}/*\\\" {
80+
capabilities = {{ vault_pushsecrets_capabilities }} }\" > /tmp/policy-{{ vault_pushsecrets_policy }}.hcl"
81+
82+
- name: Add metadata path to the pushsecrets policy
83+
kubernetes.core.k8s_exec:
84+
namespace: "{{ vault_ns }}"
85+
pod: "{{ vault_pod }}"
86+
command: >
87+
bash -e -c "echo \"path \\\"secret/metadata/{{ vault_pushsecrets_policy }}/*\\\" {
88+
capabilities = {{ vault_pushsecrets_capabilities }} }\" >> /tmp/policy-{{ vault_pushsecrets_policy }}.hcl"
89+
90+
- name: Configure VP pushsecrets policy
91+
kubernetes.core.k8s_exec:
92+
namespace: "{{ vault_ns }}"
93+
pod: "{{ vault_pod }}"
94+
command: "vault policy write {{ vault_pushsecrets_policy }}-secret /tmp/policy-{{ vault_pushsecrets_policy }}.hcl"
95+
7496
- name: Configure policy template for hub
7597
kubernetes.core.k8s_exec:
7698
namespace: "{{ vault_ns }}"
@@ -93,4 +115,4 @@
93115
vault write auth/"{{ vault_hub }}"/role/"{{ vault_hub }}"-role
94116
bound_service_account_names="{{ external_secrets_sa }}"
95117
bound_service_account_namespaces="{{ external_secrets_ns }}"
96-
policies="default,{{ vault_global_policy }}-secret,{{ vault_hub }}-secret" ttl="{{ vault_hub_ttl }}"
118+
policies="default,{{ vault_global_policy }}-secret,{{ vault_pushsecrets_policy }}-secret,{{ vault_hub }}-secret" ttl="{{ vault_hub_ttl }}"

common/ansible/roles/vault_utils/tasks/vault_spokes_init.yaml

+30-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
loop_control:
158158
label: "{{ item.key }}"
159159

160-
- name: Configure policy template
160+
- name: Configure spoke policy template
161161
kubernetes.core.k8s_exec:
162162
namespace: "{{ vault_ns }}"
163163
pod: "{{ vault_pod }}"
@@ -171,6 +171,34 @@
171171
loop_control:
172172
label: "{{ item.key }}"
173173

174+
- name: Configure spoke pushsecrets policy template
175+
kubernetes.core.k8s_exec:
176+
namespace: "{{ vault_ns }}"
177+
pod: "{{ vault_pod }}"
178+
command: >
179+
bash -e -c "echo \"path \\\"secret/data/{{ vault_pushsecrets_policy }}/*\\\" {
180+
capabilities = {{ vault_pushsecrets_capabilities }} }\" >> /tmp/policy-{{ item.value['vault_path'] }}.hcl"
181+
loop: "{{ clusters_info | dict2items }}"
182+
when:
183+
- item.value['esoToken'] is defined
184+
- item.key != "local-cluster"
185+
loop_control:
186+
label: "{{ item.key }}"
187+
188+
- name: Configure spoke pushsecrets metadata policy template
189+
kubernetes.core.k8s_exec:
190+
namespace: "{{ vault_ns }}"
191+
pod: "{{ vault_pod }}"
192+
command: >
193+
bash -e -c "echo \"path \\\"secret/metadata/{{ vault_pushsecrets_policy }}/*\\\" {
194+
capabilities = {{ vault_pushsecrets_capabilities }} }\" >> /tmp/policy-{{ item.value['vault_path'] }}.hcl"
195+
loop: "{{ clusters_info | dict2items }}"
196+
when:
197+
- item.value['esoToken'] is defined
198+
- item.key != "local-cluster"
199+
loop_control:
200+
label: "{{ item.key }}"
201+
174202
- name: Configure policy for spokes
175203
kubernetes.core.k8s_exec:
176204
namespace: "{{ vault_ns }}"
@@ -191,7 +219,7 @@
191219
vault write auth/"{{ item.value['vault_path'] }}"/role/"{{ item.value['vault_path'] }}"-role
192220
bound_service_account_names="{{ external_secrets_sa }}"
193221
bound_service_account_namespaces="{{ external_secrets_ns }}"
194-
policies="default,{{ vault_global_policy }}-secret,{{ item.value['vault_path'] }}-secret" ttl="{{ vault_spoke_ttl }}"
222+
policies="default,{{ vault_global_policy }}-secret,{{ vault_pushsecrets_policy }}-secret,{{ item.value['vault_path'] }}-secret" ttl="{{ vault_spoke_ttl }}"
195223
loop: "{{ clusters_info | dict2items }}"
196224
when:
197225
- item.value['esoToken'] is defined

common/ansible/tests/unit/test_ini_file.py

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030

3131
class TestMyModule(unittest.TestCase):
32+
3233
def setUp(self):
3334
self.testdir_v2 = os.path.join(os.path.dirname(os.path.abspath(__file__)), "v2")
3435

common/ansible/tests/unit/test_parse_secrets.py

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def set_module_args(args):
6262

6363

6464
class BytesEncoder(json.JSONEncoder):
65+
6566
def default(self, o):
6667
if isinstance(o, bytes):
6768
return base64.b64encode(o).decode("ascii")
@@ -113,6 +114,7 @@ def fail_json(*args, **kwargs):
113114

114115
@mock.patch("getpass.getpass")
115116
class TestMyModule(unittest.TestCase):
117+
116118
def create_inifile(self):
117119
self.inifile = open("/tmp/awscredentials", "w")
118120
config = configparser.ConfigParser()

common/ansible/tests/unit/test_vault_load_parsed_secrets.py

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def fail_json(*args, **kwargs):
7070

7171

7272
class TestMyModule(unittest.TestCase):
73+
7374
def setUp(self):
7475
self.mock_module_helper = patch.multiple(
7576
basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json

common/ansible/tests/unit/test_vault_load_secrets.py

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def fail_json(*args, **kwargs):
7474

7575

7676
class TestMyModule(unittest.TestCase):
77+
7778
def setUp(self):
7879
self.mock_module_helper = patch.multiple(
7980
basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json

common/ansible/tests/unit/test_vault_load_secrets_v2.py

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def fail_json(*args, **kwargs):
7777

7878
@mock.patch("getpass.getpass")
7979
class TestMyModule(unittest.TestCase):
80+
8081
def create_inifile(self):
8182
self.inifile = open("/tmp/awscredentials", "w")
8283
config = configparser.ConfigParser()

common/clustergroup/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ description: A Helm chart to create per-clustergroup ArgoCD applications and any
33
keywords:
44
- pattern
55
name: clustergroup
6-
version: 0.8.10
6+
version: 0.8.12

0 commit comments

Comments
 (0)