Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common automatic update #124

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
ec340b1
Allow originRepo to be set via make install and main.git parameters
mbaldessari Aug 8, 2024
73313cb
resolves #21 rag-llm-gitops
day0hero Aug 8, 2024
af69b30
Merge pull request #564 from day0hero/ragllm-pr21
mbaldessari Aug 8, 2024
9142471
Merge pull request #563 from mbaldessari/main-gitea
mbaldessari Aug 8, 2024
99bc297
Fix vars that were erroneously dropped
mbaldessari Aug 12, 2024
0ec7cc6
Merge pull request #565 from mbaldessari/fix-vars
darkdoc Aug 12, 2024
58b6958
Allow more flexibility with multiSourceConfig schema
mbaldessari Aug 13, 2024
4544bc6
Merge pull request #566 from mbaldessari/extend-multisource-schema
mbaldessari Aug 13, 2024
3c28c4b
Inject VALUES_SECRET env var
mbaldessari Aug 20, 2024
5f4cf89
Merge pull request #567 from mbaldessari/values_secret
mbaldessari Aug 20, 2024
7ed4d1e
Add helmRepoUrl variable
mbaldessari Aug 21, 2024
4e3505c
Merge pull request #568 from mbaldessari/helmrepourl
mbaldessari Aug 21, 2024
9ec9af0
Update letsencrypt to v0.1.1
mbaldessari Aug 22, 2024
6617090
Merge pull request #569 from mbaldessari/letsencrypt-test
mbaldessari Aug 22, 2024
5ec42ac
Allow overriding gitops source on spokes
mbaldessari Aug 23, 2024
e6511e7
Update acm chart to v0.1.1
mbaldessari Aug 23, 2024
1a5cce8
Update clustergroup chart to 0.8.11
mbaldessari Aug 23, 2024
741a52e
Merge pull request #570 from mbaldessari/some-updates
mbaldessari Aug 23, 2024
9ccd486
Extend the schema for disconnected
mbaldessari Aug 23, 2024
654dbae
Merge pull request #571 from mbaldessari/relax-schema-for-gitops
mbaldessari Aug 23, 2024
b3cef81
Update clustergroup chart to 0.8.12
mbaldessari Aug 23, 2024
96c428d
Merge pull request #572 from mbaldessari/clustergroup-0.8.12
mbaldessari Aug 23, 2024
a8d7f94
Update super-linter to v7
mbaldessari Aug 26, 2024
3fbf2e8
Fix action path
mbaldessari Aug 26, 2024
97b9589
Fix action path v2
mbaldessari Aug 26, 2024
02bfd1f
Merge pull request #573 from mbaldessari/super-linter-new
mbaldessari Aug 26, 2024
55beff3
Upgrade ESO to v0.10.0
mbaldessari Aug 26, 2024
6cd5b50
Merge pull request #574 from mbaldessari/eso-0.10.0
mbaldessari Aug 26, 2024
bd74dba
Upgrade vault to 1.17.3
mbaldessari Aug 26, 2024
f8921c3
Merge pull request #575 from mbaldessari/vault-1.17.3
mbaldessari Aug 26, 2024
c7105bc
Update hashicorp-vault to 0.1.2
mbaldessari Aug 26, 2024
86ad342
Update golang-external-secrets to 0.1.2
mbaldessari Aug 26, 2024
29d9d0a
Merge pull request #576 from mbaldessari/hashicorp-vault-0.1.1
mbaldessari Aug 26, 2024
fc3fb1f
Switch to gitops-1.13
mbaldessari Aug 27, 2024
0a20ea6
Merge pull request #577 from mbaldessari/gitops-1.13-support
mbaldessari Aug 27, 2024
051cd8c
Add a pushsecrets policy and vault path for ESO syncing
mbaldessari Aug 29, 2024
9aef778
Fix PyInk warnings
mbaldessari Aug 30, 2024
5acb722
Merge pull request #579 from mbaldessari/push-secrets
mhjacks Aug 30, 2024
38756a2
Merge remote-tracking branch 'common-upstream/main' into common-autom…
mbaldessari Sep 6, 2024
3c28043
Update tests after common rebase
mbaldessari Sep 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion common/.github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter/slim@v6
uses: super-linter/super-linter/slim@v7
env:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main
Expand All @@ -31,10 +31,13 @@ jobs:
VALIDATE_BASH: false
VALIDATE_CHECKOV: false
VALIDATE_JSCPD: false
VALIDATE_JSON_PRETTIER: false
VALIDATE_MARKDOWN_PRETTIER: false
VALIDATE_KUBERNETES_KUBECONFORM: false
VALIDATE_PYTHON_PYLINT: false
VALIDATE_SHELL_SHFMT: false
VALIDATE_YAML: false
VALIDATE_YAML_PRETTIER: false
# VALIDATE_DOCKERFILE_HADOLINT: false
# VALIDATE_MARKDOWN: false
# VALIDATE_NATURAL_LANGUAGE: false
Expand Down
2 changes: 1 addition & 1 deletion common/Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
## October 3, 2022

* Restore the ability to install a non-default site: `make TARGET_SITE=mysite install`
* Revised tests (new output and filenames, requires adding new result files to git)
* Revised tests (new output and filenames, requires adding new result files to Git)
* ACM 2.6 required for ACM-based managed sites
* Introduced global.clusterDomain template variable (without the `apps.` prefix)
* Removed the ability to send specific charts to another cluster, use hosted argo sites instead
Expand Down
5 changes: 4 additions & 1 deletion common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,18 @@ super-linter: ## Runs super linter locally
-e VALIDATE_CHECKOV=false \
-e VALIDATE_DOCKERFILE_HADOLINT=false \
-e VALIDATE_JSCPD=false \
-e VALIDATE_JSON_PRETTIER=false \
-e VALIDATE_MARKDOWN_PRETTIER=false \
-e VALIDATE_KUBERNETES_KUBECONFORM=false \
-e VALIDATE_PYTHON_PYLINT=false \
-e VALIDATE_SHELL_SHFMT=false \
-e VALIDATE_TEKTON=false \
-e VALIDATE_YAML=false \
-e VALIDATE_YAML_PRETTIER=false \
$(DISABLE_LINTERS) \
-v $(PWD):/tmp/lint:rw,z \
-w /tmp/lint \
ghcr.io/super-linter/super-linter:slim-v6
ghcr.io/super-linter/super-linter:slim-v7

.PHONY: ansible-lint
ansible-lint: ## run ansible lint on ansible/ folder
Expand Down
2 changes: 1 addition & 1 deletion common/acm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ description: A Helm chart to configure Advanced Cluster Manager for OpenShift.
keywords:
- pattern
name: acm
version: 0.1.0
version: 0.1.1
4 changes: 2 additions & 2 deletions common/acm/templates/policies/ocp-gitops-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ spec:
labels:
operators.coreos.com/openshift-gitops-operator.openshift-operators: ''
spec:
channel: {{ default "gitops-1.12" .Values.main.gitops.channel }}
channel: {{ default "gitops-1.13" .Values.main.gitops.channel }}
installPlanApproval: Automatic
name: openshift-gitops-operator
source: redhat-operators
source: {{ default "redhat-operators" .Values.main.gitops.operatorSource }}
sourceNamespace: openshift-marketplace
config:
env:
Expand Down
2 changes: 1 addition & 1 deletion common/acm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main:
gitops:
channel: "gitops-1.12"
channel: "gitops-1.13"

global:
extraValueFiles: []
Expand Down
1 change: 1 addition & 0 deletions common/ansible/plugins/filter/parse_acm_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ def parse_acm_secrets(secrets):


class FilterModule:

def filters(self):
return {"parse_acm_secrets": parse_acm_secrets}
1 change: 1 addition & 0 deletions common/ansible/plugins/module_utils/load_secrets_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


class LoadSecretsV1:

def __init__(
self,
module,
Expand Down
1 change: 1 addition & 0 deletions common/ansible/plugins/module_utils/load_secrets_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@


class LoadSecretsV2:

def __init__(self, module, syaml, namespace, pod):
self.module = module
self.namespace = namespace
Expand Down
1 change: 1 addition & 0 deletions common/ansible/plugins/module_utils/parse_secrets_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@


class ParseSecretsV2:

def __init__(self, module, syaml, secrets_backing_store):
self.module = module
self.syaml = syaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@


class VaultSecretLoader:

def __init__(
self,
module,
Expand Down
2 changes: 1 addition & 1 deletion common/ansible/roles/iib_ci/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# IIB Utilities

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

Run `ansible-playbook common/ansible/playbooks/iib-ci/lookup.yml` to see which IIBs are available (defaults to
Expand Down
93 changes: 52 additions & 41 deletions common/ansible/roles/vault_utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ unseal_namespace: "imperative"

This relies on [kubernetes.core](https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_module.html)

## Vault out of the box configuration

This role configures four secret paths in vault:

1. `secret/global` - Any secret under this path is accessible in read-only only to all clusters known to ACM (hub and spokes)
2. `secret/hub` - Any secret under this path is accessible in read-only only to the ACM hub cluster
3. `secret/<fqdn.of.spoke.cluster>` - Any secret under this path is accessible in read-only only to the spoke cluster
4. `secret/pushsecrets` - Any secret here can be accessed in read and write mode to all clusters known to ACM. This area can
be used with ESO's `PushSecrets` so you can push an existing secret from one namespace, to the vault under this path and
then it can be retrieved by an `ExternalSecret` either in a different namespace *or* from an entirely different cluster.

## Values secret file format

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

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

### Version 1.0

Here is a well-commented example of a version 1.0 file:

```yaml
---
# By default when a top-level 'version: 1.0' is missing it is assumed to be '1.0'
# NEVER COMMIT THESE VALUES TO GIT

secrets:
# These secrets will be pushed in the vault at secret/hub/test The vault will
# have secret/hub/test with secret1 and secret2 as keys with their associated
# values (secrets)
test:
secret1: foo
secret2: bar

# This ends up as the s3Secret attribute to the path secret/hub/aws
aws:
s3Secret: test-secret

# This will create the vault key secret/hub/testfoo which will have two
# properties 'b64content' and 'content' which will be the base64-encoded
# content and the normal content respectively
files:
testfoo: ~/ca.crt
# These secrets will be pushed in the vault at secret/region1/test The vault will
# have secret/region1/test with secret1 and secret2 as keys with their associated
# values (secrets)
secrets.region1:
test:
secret1: foo1
secret2: bar1
# This will create the vault key secret/region2/testbar which will have two
# properties 'b64content' and 'content' which will be the base64-encoded
# content and the normal content respectively
files.region2:
testbar: ~/ca.crt
```

### Version 2.0

Here is a version 2.0 example file (specifying `version: 2.0` is mandatory in this case):
Expand Down Expand Up @@ -210,6 +181,46 @@ secrets:
ini_key: aws_secret_access_key
```

### Version 1.0

Here is a well-commented example of a version 1.0 file:

```yaml
---
# By default when a top-level 'version: 1.0' is missing it is assumed to be '1.0'
# NEVER COMMIT THESE VALUES TO GIT

secrets:
# These secrets will be pushed in the vault at secret/hub/test The vault will
# have secret/hub/test with secret1 and secret2 as keys with their associated
# values (secrets)
test:
secret1: foo
secret2: bar

# This ends up as the s3Secret attribute to the path secret/hub/aws
aws:
s3Secret: test-secret

# This will create the vault key secret/hub/testfoo which will have two
# properties 'b64content' and 'content' which will be the base64-encoded
# content and the normal content respectively
files:
testfoo: ~/ca.crt
# These secrets will be pushed in the vault at secret/region1/test The vault will
# have secret/region1/test with secret1 and secret2 as keys with their associated
# values (secrets)
secrets.region1:
test:
secret1: foo1
secret2: bar1
# This will create the vault key secret/region2/testbar which will have two
# properties 'b64content' and 'content' which will be the base64-encoded
# content and the normal content respectively
files.region2:
testbar: ~/ca.crt
```

Internals
---------

Expand Down
2 changes: 2 additions & 0 deletions common/ansible/roles/vault_utils/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ vault_spoke_capabilities: '[\\\"read\\\"]'
vault_spoke_ttl: "15m"
vault_global_policy: global
vault_global_capabilities: '[\\\"read\\\"]'
vault_pushsecrets_policy: pushsecrets
vault_pushsecrets_capabilities: '[\\\"create\\\",\\\"read\\\",\\\"update\\\",\\\"delete\\\"]'
external_secrets_ns: golang-external-secrets
external_secrets_sa: golang-external-secrets
external_secrets_secret: golang-external-secrets
Expand Down
24 changes: 23 additions & 1 deletion common/ansible/roles/vault_utils/tasks/vault_secrets_init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@
pod: "{{ vault_pod }}"
command: "vault policy write {{ vault_global_policy }}-secret /tmp/policy-{{ vault_global_policy }}.hcl"

- name: Configure VP pushsecrets policy template
kubernetes.core.k8s_exec:
namespace: "{{ vault_ns }}"
pod: "{{ vault_pod }}"
command: >
bash -e -c "echo \"path \\\"secret/data/{{ vault_pushsecrets_policy }}/*\\\" {
capabilities = {{ vault_pushsecrets_capabilities }} }\" > /tmp/policy-{{ vault_pushsecrets_policy }}.hcl"

- name: Add metadata path to the pushsecrets policy
kubernetes.core.k8s_exec:
namespace: "{{ vault_ns }}"
pod: "{{ vault_pod }}"
command: >
bash -e -c "echo \"path \\\"secret/metadata/{{ vault_pushsecrets_policy }}/*\\\" {
capabilities = {{ vault_pushsecrets_capabilities }} }\" >> /tmp/policy-{{ vault_pushsecrets_policy }}.hcl"

- name: Configure VP pushsecrets policy
kubernetes.core.k8s_exec:
namespace: "{{ vault_ns }}"
pod: "{{ vault_pod }}"
command: "vault policy write {{ vault_pushsecrets_policy }}-secret /tmp/policy-{{ vault_pushsecrets_policy }}.hcl"

- name: Configure policy template for hub
kubernetes.core.k8s_exec:
namespace: "{{ vault_ns }}"
Expand All @@ -93,4 +115,4 @@
vault write auth/"{{ vault_hub }}"/role/"{{ vault_hub }}"-role
bound_service_account_names="{{ external_secrets_sa }}"
bound_service_account_namespaces="{{ external_secrets_ns }}"
policies="default,{{ vault_global_policy }}-secret,{{ vault_hub }}-secret" ttl="{{ vault_hub_ttl }}"
policies="default,{{ vault_global_policy }}-secret,{{ vault_pushsecrets_policy }}-secret,{{ vault_hub }}-secret" ttl="{{ vault_hub_ttl }}"
32 changes: 30 additions & 2 deletions common/ansible/roles/vault_utils/tasks/vault_spokes_init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
loop_control:
label: "{{ item.key }}"

- name: Configure policy template
- name: Configure spoke policy template
kubernetes.core.k8s_exec:
namespace: "{{ vault_ns }}"
pod: "{{ vault_pod }}"
Expand All @@ -171,6 +171,34 @@
loop_control:
label: "{{ item.key }}"

- name: Configure spoke pushsecrets policy template
kubernetes.core.k8s_exec:
namespace: "{{ vault_ns }}"
pod: "{{ vault_pod }}"
command: >
bash -e -c "echo \"path \\\"secret/data/{{ vault_pushsecrets_policy }}/*\\\" {
capabilities = {{ vault_pushsecrets_capabilities }} }\" >> /tmp/policy-{{ item.value['vault_path'] }}.hcl"
loop: "{{ clusters_info | dict2items }}"
when:
- item.value['esoToken'] is defined
- item.key != "local-cluster"
loop_control:
label: "{{ item.key }}"

- name: Configure spoke pushsecrets metadata policy template
kubernetes.core.k8s_exec:
namespace: "{{ vault_ns }}"
pod: "{{ vault_pod }}"
command: >
bash -e -c "echo \"path \\\"secret/metadata/{{ vault_pushsecrets_policy }}/*\\\" {
capabilities = {{ vault_pushsecrets_capabilities }} }\" >> /tmp/policy-{{ item.value['vault_path'] }}.hcl"
loop: "{{ clusters_info | dict2items }}"
when:
- item.value['esoToken'] is defined
- item.key != "local-cluster"
loop_control:
label: "{{ item.key }}"

- name: Configure policy for spokes
kubernetes.core.k8s_exec:
namespace: "{{ vault_ns }}"
Expand All @@ -191,7 +219,7 @@
vault write auth/"{{ item.value['vault_path'] }}"/role/"{{ item.value['vault_path'] }}"-role
bound_service_account_names="{{ external_secrets_sa }}"
bound_service_account_namespaces="{{ external_secrets_ns }}"
policies="default,{{ vault_global_policy }}-secret,{{ item.value['vault_path'] }}-secret" ttl="{{ vault_spoke_ttl }}"
policies="default,{{ vault_global_policy }}-secret,{{ vault_pushsecrets_policy }}-secret,{{ item.value['vault_path'] }}-secret" ttl="{{ vault_spoke_ttl }}"
loop: "{{ clusters_info | dict2items }}"
when:
- item.value['esoToken'] is defined
Expand Down
1 change: 1 addition & 0 deletions common/ansible/tests/unit/test_ini_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@


class TestMyModule(unittest.TestCase):

def setUp(self):
self.testdir_v2 = os.path.join(os.path.dirname(os.path.abspath(__file__)), "v2")

Expand Down
2 changes: 2 additions & 0 deletions common/ansible/tests/unit/test_parse_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def set_module_args(args):


class BytesEncoder(json.JSONEncoder):

def default(self, o):
if isinstance(o, bytes):
return base64.b64encode(o).decode("ascii")
Expand Down Expand Up @@ -113,6 +114,7 @@ def fail_json(*args, **kwargs):

@mock.patch("getpass.getpass")
class TestMyModule(unittest.TestCase):

def create_inifile(self):
self.inifile = open("/tmp/awscredentials", "w")
config = configparser.ConfigParser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def fail_json(*args, **kwargs):


class TestMyModule(unittest.TestCase):

def setUp(self):
self.mock_module_helper = patch.multiple(
basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json
Expand Down
1 change: 1 addition & 0 deletions common/ansible/tests/unit/test_vault_load_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def fail_json(*args, **kwargs):


class TestMyModule(unittest.TestCase):

def setUp(self):
self.mock_module_helper = patch.multiple(
basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json
Expand Down
1 change: 1 addition & 0 deletions common/ansible/tests/unit/test_vault_load_secrets_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def fail_json(*args, **kwargs):

@mock.patch("getpass.getpass")
class TestMyModule(unittest.TestCase):

def create_inifile(self):
self.inifile = open("/tmp/awscredentials", "w")
config = configparser.ConfigParser()
Expand Down
2 changes: 1 addition & 1 deletion common/clustergroup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ description: A Helm chart to create per-clustergroup ArgoCD applications and any
keywords:
- pattern
name: clustergroup
version: 0.8.10
version: 0.8.12
Loading