Skip to content

Commit

Permalink
Merge pull request #212 from weaveworks/upgrade-policy-to-flux-2-rc-1
Browse files Browse the repository at this point in the history
Upgrade flux resources to v1 in weave-policy-agent
  • Loading branch information
Sara Abdelmessih authored Aug 7, 2023
2 parents 8069f63 + 8605911 commit 83d2494
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
24 changes: 11 additions & 13 deletions charts/external-secrets/Bootstrapping-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ In Flux, we can't have dependencies between Flux Kustomization and HelmRelease,

Both controllers manage the resources independently, at different moments, with no possibility to wait for each other. This means that we have a wonderful race condition where sometimes the CRs (`SecretStore`,`ClusterSecretStore`...) tries to be deployed before than the CRDs needed to recognize them.

Reference: [https://external-secrets.io/v0.6.1/examples/gitops-using-fluxcd/](https://external-secrets.io/v0.6.1/examples/gitops-using-fluxcd/)
Reference: [https://external-secrets.io/v0.6.1/examples/gitops-using-fluxcd/](https://external-secrets.io/v0.6.1/examples/gitops-using-fluxcd/)




## The solution

Expand Down Expand Up @@ -53,7 +53,7 @@ Let's see the conditions to start working on a solution:

- ***cluster-secrets/cluster-secrets.yaml***

This file will contain the main configurations and requirements to install secret management operator and all its dependencies
This file will contain the main configurations and requirements to install secret management operator and all its dependencies

**Contents:**

Expand All @@ -63,7 +63,7 @@ We will getting them from `external-secrets` repository

```yaml
# GitRepository
apiVersion: source.toolkit.fluxcd.io/v1beta1
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: external-secrets
Expand Down Expand Up @@ -93,7 +93,7 @@ We will getting them from `external-secrets` repository as well
```yaml
---
# external secrets crds
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: external-secrets-crds
Expand Down Expand Up @@ -144,14 +144,14 @@ spec:
---
```

4- External Secrets Secrets (CRs)
4- External Secrets Secrets (CRs)

In this guide the secrets are in the same repository you can create as many CRs as you need, this is one secret for elaboration

```yaml
---
# external secrets secrets
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: external-secrets-secrets
Expand All @@ -166,7 +166,6 @@ spec:
name: flux-system
path: ./secrets
prune: true
validation: client
```
- ***clusters/my-cluster/cluster-secrets***
Expand All @@ -176,7 +175,7 @@ This is the Kustomization file, the manifest of external secrets resources
**Contents:**
```yaml
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: cluster-secrets
Expand All @@ -188,7 +187,6 @@ spec:
name: flux-system
path: ../cluster-secrets
prune: true
validation: client
```
- ***secrets/aws-secret-store.yaml***
Expand Down Expand Up @@ -330,7 +328,7 @@ kubectl create secret generic ssh-credentials --from-file=./identity --from-file
**Goal**: To bootstrap the leaf cluster with flux installed & secret to authenticate ESO


**Structure**
**Structure**

```yaml
➜ wge-dev git:(main) tree
Expand Down Expand Up @@ -364,7 +362,7 @@ kubectl create secret generic ssh-credentials --from-file=./identity --from-file
└── prod
```

**1- How to create the secret**
**1- How to create the secret**

- First when creating the management cluster we will need to create manually a secret for authenticating the SecretStore also we need to create`ClusterResourceSet` for the AWS secret to be able to bootstrap it to leaf cluster. This will be copied for bootstrap location as shown before.

Expand Down Expand Up @@ -433,7 +431,7 @@ For the cluster template we will need to add 2 labels
i) `weave.works/flux: bootstrap` to match the booting clusters with the `**ClusterBootstrapConfig`** job

ii) `secretmanager: aws` to match the the booting clusters with the `ClusterResourceSet` for the AWS secret
ii) `secretmanager: aws` to match the the booting clusters with the `ClusterResourceSet` for the AWS secret

Example for the template

Expand Down
2 changes: 1 addition & 1 deletion charts/external-secrets/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: external-secrets
icon: https://raw.githubusercontent.com/external-secrets/external-secrets/main/assets/eso-round-logo.svg
description: A Weaveworks Helm chart for the External Secrets Operator
type: application
version: 0.6.1
version: 1.0.0
dependencies:
- name: external-secrets
version: "0.6.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.secretStores.enabled }}
{{- if not .Values.secretStores.sourceRef }}
apiVersion: source.toolkit.fluxcd.io/v1beta1
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: external-secrets
Expand All @@ -23,7 +23,7 @@ spec:
{{- end }}
{{- end }}
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: external-secrets
Expand All @@ -41,5 +41,4 @@ spec:
{{- end }}
path: {{ .Values.secretStores.path }}
prune: true
validation: client
{{- end }}
2 changes: 1 addition & 1 deletion charts/weave-policy-agent/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dependencies:
repository: https://weaveworks.github.io/policy-agent
version: 2.5.0
digest: sha256:2c8e91250a08f5d899643aeead53548322fba11b526628a581d95c322e7fb2c7
generated: "2023-06-26T14:28:27.694292969+03:00"
generated: "2023-06-26T14:47:54.260827988+03:00"
2 changes: 1 addition & 1 deletion charts/weave-policy-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
description: A Weaveworks Helm chart for Kubernetes to configure the policy agent
name: weave-policy-agent
appVersion: "2.5.0"
version: 1.0.0
version: 2.0.0
kubeVersion: ">=1.16.0-0"
icon: https://www.magalix.com/hubfs/Imported%20images/logo-02.png%3Fwidth=560%26name=logo-02-Dec-18-2020-11-24-41-75-AM.png
type: application
Expand Down
5 changes: 2 additions & 3 deletions charts/weave-policy-agent/templates/policy-library.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.policySource.enabled }}
{{- if not .Values.policySource.sourceRef }}
apiVersion: source.toolkit.fluxcd.io/v1beta1
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: policy-library
Expand All @@ -23,7 +23,7 @@ spec:
{{- end }}
{{- end }}
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: policy-library
Expand All @@ -41,5 +41,4 @@ spec:
{{- end }}
path: {{ .Values.policySource.path }}
prune: true
validation: client
{{- end }}

0 comments on commit 83d2494

Please sign in to comment.