Open perezjasonr opened 3 years ago
ok so i got this to work by taking the original chart and including it, then putting kustomize and its patch yaml alongside it. this example looks like it references the helm-guestbook chart as a dependency, but I don't know exactly how thats supposed to work.
basically i had to take the helm-guestbook chart (not this plugin chart), and add kustomize/patch files to it.
is this example supposed to work by only referencing it? or are there prereq steps being assumed in it like I've done?
I also add a few problems with this example:
--include-crds
helm dependency build
is done globaly (a temporary dir should be created instead)helm repo add
is missingI've done a few hacks to make this work, and behave a bit like flux:
In argocd-cm
:
data:
configManagementPlugins: |
- name: kustomized-helm
init:
command: ["/bin/sh", "-c"]
args:
- KUBITUS_TMP="$(mktemp -d)" &&
export XDG_CACHE_HOME="$KUBITUS_TMP/cache" &&
export XDG_CONFIG_HOME="$KUBITUS_TMP/config" &&
export XDG_DATA_HOME="$KUBITUS_TMP/data" &&
export HELM_HOME="$KUBITUS_TMP" &&
[ -z "$HELM_REPOSITORY_URLS" ] || helm repo add "$HELM_REPOSITORY_NAMES" "$HELM_REPOSITORY_URLS" &&
helm dependency build &&
rm -r "$KUBITUS_TMP"
generate:
command: [sh, -c]
args:
- helm template --release-name "$ARGOCD_APP_NAME" --namespace "$ARGOCD_APP_NAMESPACE" . > all.yaml &&
kustomize build
In application:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "prometheus-stack"
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
source:
repoURL: "https://gitlab.example.org/gitops/infra.git"
targetRevision: main
path: "prometheus-stack"
plugin:
name: kustomized-helm
env:
- name: HELM_REPOSITORY_NAMES
value: "kube-prometheus-stack"
- name: HELM_REPOSITORY_URLS
value: "https://prometheus-community.github.io/helm-charts"
destination:
name: ''
namespace: "prometheus-stack"
server: 'https://kubernetes.default.svc'
In the repo:
$ cat prometheus-stack/kustomization.yaml
resources:
- ./all.yaml
patchesStrategicMerge:
- |-
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
argocd.argoproj.io/sync-options: Replace=true
name: prometheuses.monitoring.coreos.com
Relevant bug and commits in the kubitus-installer repo:
I am trying to follow the post-render example using kustomize. I am pointing directly to this online repo:
I get:
I did some research, and found that someone else who got this says it means the patch is targeting something that doesn't exist (in this case, release-name-helmguestbook deployment). But why would that be? we don't need to separately deploy the helm chart right? we cannot do both helm and plugin in the same app object.
unless the example readme is leaving out a step i would think you can use it "as is".
I think the plugin installed successfully, since it is indeed trying to run the provided generate command (helm template --args)