Skip to content

Commit

Permalink
add policy-generator component (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
strangiato committed May 2, 2024
1 parent e137200 commit 3b3614b
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ resources:
components:
- ../../components/kustomize-build-enable-helm
```

## Known Incompatibilities

### kustomize-build-policy-generator

This component is not compatible with the [kustomize-build-policy-generator](openshift-gitops-operator/instance/components/kustomize-build-policy-generator) component.

Both components are attempting to patch the `spec.kustomizeBuildOptions` field.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# kustomize-build-policy-generator

## Purpose
This component is designed to turn on the `--enable-helm` feature of `kustomize build` in ArgoCD to support helm charts inside of a kustomization.yaml file.

To learn more about the `--enable-helm` feature, refer to the ArgoCD docs [here](https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/#kustomizing-helm-charts) or the kustomize [examples](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/chart.md).

## Usage

This component can be added to a base by adding the `components` section to your overlay `kustomization.yaml` file:

```
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
components:
- ../../components/kustomize-build-policy-generator
```

## Known Incompatibilities

### kustomize-build-enable-helm

This component is not compatible with the [kustomize-build-enable-helm](openshift-gitops-operator/instance/components/kustomize-build-enable-helm) component.

Both components are attempting to patch the `spec.kustomizeBuildOptions` field.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

patches:
- path: patch-enable-policy-generator.yaml
target:
kind: ArgoCD
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
name: openshift-gitops
namespace: openshift-gitops
spec:
repo:
env:
- name: KUSTOMIZE_PLUGIN_HOME
value: /etc/kustomize/plugin
initContainers:
- args:
- -c
- cp /etc/kustomize/plugin/policy.open-cluster-management.io/v1/policygenerator/PolicyGenerator
/policy-generator/PolicyGenerator
command:
- /bin/bash
image: registry.redhat.io/rhacm2/multicluster-operators-subscription-rhel8:v2.8
name: policy-generator-install
volumeMounts:
- mountPath: /policy-generator
name: policy-generator
volumeMounts:
- mountPath: /etc/kustomize/plugin/policy.open-cluster-management.io/v1/policygenerator
name: policy-generator
volumes:
- emptyDir: {}
name: policy-generator
kustomizeBuildOptions: --enable-alpha-plugins

0 comments on commit 3b3614b

Please sign in to comment.