argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
16.76k stars 5.08k forks source link

using ServerName instead of server URL to reference cluster IPs #8384

Open exocode opened 2 years ago

exocode commented 2 years ago

Summary

Applications and AppProjects should be able to access Cluster by it's ServerName instead of URL to be less redundant.

Motivation

In ArgoCD I can add clusters by manifests. These manifests already contain a name. But AppProjects and Applications need to pass the server IP You have to change all AppProject and Application manifests when the Cluster IP is changing which is not good when practicing GitOps.

Proposal

Clusters have serverIPs, but also have a name. Why not simply referencing the ArgoCD clusterName in AppProject and Application manifests? Why only using redundant and error prone repetiton of cluster IPs?

rodrigo14miguel commented 2 years ago

I'm using argocd to apply its own configuration. My AppProject and Applications yams only have the "name" field in destination, I omit "server". When applied, they stay the same without populating the empty "server". Maybe the "server" field in destination only gets populated when creating an application or project though the UI.

O5ten commented 1 year ago

@rodrigo14miguel following your advice on this and use the name-field instead of server i get certificate errors towards my remote cluster that i'm not getting when i specify the url directly. 🤔

geowalrus4gh commented 11 months ago

Am using automation to setup argocd project and application. Each Project is specific for a cluster. Cluster is also added dynamically. its hard to to setup dynamic cluster URL to match the project. It would be nice if cluster name is used to match the rules and assign applications to this project with server name.

ForbiddenEra commented 7 months ago

Also RBAC uses the URL instead of the name..

delaskoff commented 3 months ago

Applications do work with a server name.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: foo
spec:
  destination:
    name: sbx-eks-cluster
    namespace: default

No need to specify the server endpoint Other than that, yeah, is not support

ForbiddenEra commented 3 months ago

Applications do work with a server name.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: foo
spec:
  destination:
    name: sbx-eks-cluster
    namespace: default

No need to specify the server endpoint Other than that, yeah, is not support

What version area you using? This didn't work last time I tried it

delaskoff commented 3 months ago

Applications do work with a server name.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: foo
spec:
  destination:
    name: sbx-eks-cluster
    namespace: default

No need to specify the server endpoint Other than that, yeah, is not support

What version area you using? This didn't work last time I tried it

I, personally, discovered it not so long ago (v2.10.1+a79e0ea), but my colleague has v2.6.7+5bcd846 and it works fine for him as well

ForbiddenEra commented 3 months ago

Applications do work with a server name.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: foo
spec:
  destination:
    name: sbx-eks-cluster
    namespace: default

No need to specify the server endpoint Other than that, yeah, is not support

What version area you using? This didn't work last time I tried it

I, personally, discovered it not so long ago (v2.10.1+a79e0ea), but my colleague has v2.6.7+5bcd846 and it works fine for him as well

Interesting, I was on 2.9.0 when I tried but perhaps I'm conflating something similar or didn't do it right or something, will have to test again later. Thanks

proligde commented 1 month ago

Good thing I found this ticket. I only ever used name in my Application yamls and was assuming that an applicationSet just uses the same fields for its template under the hood. Until it didn't and I started searching what I was doing wrong.

delaskoff commented 1 month ago

@proligde But ApplicationSet does use the same fields for it's template under the hood and it supports using the name. I'm already using them with a name as destination and it works

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: aws-load-balancer-controller
  finalizers: [resources-finalizer.argocd.argoproj.io]
spec:
  generators:
    - list:
        elements:
          - environment: sbx
            cluster: sbx-eks-cluster
          ...
  template:
    metadata:
      name: '{{ environment }}-aws-load-balancer-controller'
      finalizers: [resources-finalizer.argocd.argoproj.io]
    spec:
      destination:
        name: '{{ cluster }}'
        namespace: kube-system