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

Connect or register Civo created cluster in ArgoCD #18

Closed
exocode opened this issue Jan 25, 2022 · 4 comments
Closed

Connect or register Civo created cluster in ArgoCD #18

exocode opened this issue Jan 25, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@exocode
Copy link

exocode commented Jan 25, 2022

I have a cluster which is created by Crossplane through the Civo provider.
That process created a secret containing the kubeconfig.

  • How can I register that cluster in ArgoCD automatically (GitOps)?

Normally, I manually add the IP address to the ArgoCD AppProject if the cluster creation process has finished. Then I manually change all manifests which are using this server address. In an issue I raised here: argoproj/argo-cd#8107 (comment) they mentioned, that I can use a "string reference" of my cluster, (they pointed me there: https://doc.crds.dev/github.com/crossplane-contrib/provider-argocd/projects.argocd.crossplane.io/Project/v1alpha1@v0.1.0#spec-forProvider-destinations )

but I have no idea to do that. I simply didn't get it,...

That is my current state:

appProject

apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
  name: staging
  namespace: argocd
spec:
  description: staging deployment
  destinations:
    - namespace: "staging"
      name: "staging"
      server: https://123.456.789.0 # <<-- Somewhere here
      serverRef:                    # <<-- or here
        name: "staging"             # <<-- or here I can reference to my crossplane cluster by a name string, right?

How can I bridge the gap between my Crossplane created cluster and ArgoCD Application deployments without manual intervention? Isn't your repo's intention to exactly do that? I didn't found any example which makes sense for me to get that working.

What I found is, that I can create a secret to register my cluster (if I am not completely misunderstand):

apiVersion: v1
kind: Secret
metadata:
  name: staging-cluster-secret
  labels:
    argocd.argoproj.io/secret-type: cluster
type: Opaque
stringData:
  name: mycluster.com
  server: https://mycluster.com
  config: |
    {
      "bearerToken": "<authentication token>",
      "tlsClientConfig": {
        "insecure": false,
        "caData": "<base64 encoded certificate>"
      }
    }

Am I right, that my demands are not possible to achieve automatically at the moment? If not, who is "responsible" to create that? CivoProvider? provider-argocd? argocd itself?

It would be awesome if someone can get me out of that configuration hell 😈

@exocode exocode added the enhancement New feature or request label Jan 25, 2022
@janwillies
Copy link
Collaborator

First you would create a cluster in provider-argocd, see here for an example: https://github.com/crossplane-contrib/provider-argocd/blob/main/examples/cluster/cluster.yaml

Then you'd create a project, for example: https://github.com/crossplane-contrib/provider-argocd/blob/main/examples/projects/project.yaml. Within the project you can reference a cluster by its kubernetes resource name. You don't need to keep the URLs in sync manually, this should be done by provider-argocd automatically.

From what I understand provider-civo creates a kubeconfig in the connection secret. This is currently not parsed by provider-argocd, see #13

@exocode
Copy link
Author

exocode commented Jan 25, 2022

@janwillies sorry to pick your time. I found your repo https://github.com/janwillies/crossargo-sync and wanna know, if this repo could be modified in a way, that other providers can use them (eg. civo-provider) (https://github.com/crossplane-contrib/provider-civo) ?

Filling this gap would be a big value for the crossplane/argocd community, because we can practice a more complete and automated Gitops.

@janwillies
Copy link
Collaborator

I think it would be better to support this in provider-argocd. #13 tracks the issue.

Closing this as duplicate

@jonashackt
Copy link

jonashackt commented Apr 3, 2024

Thank you guys for getting me on the right track!

If anybody is wondering, what @janwillies meant with #18 (comment), I wrote a comprehensive answer on stackoverflow about the concrete steps to connect ArgoCD with Crossplane created clusters.

Just a side note: you only need the argocd-provider Cluster object to register the Crossplane created cluster in ArgoCD. The Project is not needed, if you use the default Argo project and just reference the Cluster name as spec.destination.name (NOT spec.destination.server). This will then look into Argo's Cluster list and should find the registered cluster. The stackoverflow answer also has an example ArgoCD Application ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants