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

Argo-CD example improvements #2200

Merged
merged 3 commits into from
Aug 31, 2023
Merged

Argo-CD example improvements #2200

merged 3 commits into from
Aug 31, 2023

Conversation

roosmaa
Copy link
Contributor

@roosmaa roosmaa commented Aug 24, 2023

Description

The current ArgoCD example fell somewhat short for me as I was deploying kube-prometheus on my test cluster. This PR adds the missing pieces that I had to figure out to get it deployed.

  • Using ArgoCD sync-waves to deploy CDRs before everything else
  • Work-around big CDRs causing last-applied-configuration annotation too big error (when kubectl apply'ing the CRDs)
  • Mention that application.instanceLabelKey has to be defined in ArgoCD config map for prometheus target discovery to work properly (by default ArgoCD happily overrides the desired app.kubernetes.io/instance value)

Type of change

What type of changes does your code introduce to the kube-prometheus? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

Please put a one-line changelog entry below. Later this will be copied to the changelog file.

- Update Argo-CD example project

@roosmaa
Copy link
Contributor Author

roosmaa commented Aug 24, 2023

Would also address #2075

@treenerd
Copy link

treenerd commented Aug 24, 2023

Hello @roosmaa

I used kustomize at the past, and now I try to work with jsonnet in case of kube-prometheus.
So please forgive me if I ask basic questions, because I really use jsonnet since yesterday.
I was able to customize and build the manifests like I needed them.
Now I try to get it running with argocd, so I stumbled about your merge request.

I followed the tutorials and build the manifests like described in customizing kube-prometheus.

But when I try to build the argocd basic example it fails with folowing error in my case.

./build.sh argocd-basic.jsonnet 
+ set -o pipefail
++ pwd
+ PATH=*******
+ rm -rf manifests
+ mkdir -p manifests/setup
+ xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
+ jsonnet -J vendor -m manifests argocd-basic.jsonnet
RUNTIME ERROR: multi mode: top-level object was a array, should be an object whose keys are filenames and values hold the JSON for that file.
        During manifestation

Is this expected in case of jsonnet templates for argocd?
If so, is there a workaround for people like me who would like to create yaml formated manifests?

Thank you
Regards

@roosmaa
Copy link
Contributor Author

roosmaa commented Aug 24, 2023

Is this expected in case of jsonnet templates for argocd?
If so, is there a workaround for people like me who would like to create yaml formated manifests?

@treenerd this was my first jsonnet experience as well. But, I think you have 2 options:

  1. If you want to have plain yaml files in your ArgoCD repo, then you use the structure in the example.jsonnet and use build.sh to get a directory full of kubernetes yaml files (ie effectively what kube-prometheus/manifests folder is, but with your tweaks).

  2. You use the built-in jsonnet support that ArgoCD has, in that case you follow directions in examples/continuous-delivery/argocd and you let ArgoCD build what it needs directly from the jsonnet files. (ie what's in this PR.) In this case the build.sh is not needed at all.

I think I saw some mention that 2nd option was the preferred way to do things in some docs around here somewhere, but I'm just a drive-by contributor, so I cannot really say what the suggested way is.

@treenerd
Copy link

@roosmaa

Thank you for your answer.
The reason of my reported error was because I configured the wrong path inside my ArgoCD Application for the vendor libraries.
After I red the docs of ArgoCD again, I figured out the root in such a case is the git repo.

argocd-jsonnet-userguide

It is also possible to add a shared library (e.g. vendor folder) relative to the repository root.

Never the less I had other issues, so I decided to build manifests and kustomize overlays with jsonnet.
So I use the kustomization.yaml for the rollouts within my ApplicationSets..

Thank you for your fast response and help.

@philipgough
Copy link
Contributor

@roosmaa just a heads up this is failing ci if you want to address it :)

@roosmaa
Copy link
Contributor Author

roosmaa commented Aug 31, 2023

@philipgough on my todo list :) haven't managed to open the workstation in a few evenings.

@philipgough philipgough merged commit c11655a into prometheus-operator:main Aug 31, 2023
10 checks passed
@roosmaa roosmaa deleted the argocd-improvements branch August 31, 2023 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants