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

feat: add support for multi-cluster with the same API Url #10897

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1719,7 +1719,7 @@ func TestValidateGeneratedApplications(t *testing.T) {
kubeclientset := kubefake.NewSimpleClientset(objects...)

argoDBMock := dbmocks.ArgoDB{}
argoDBMock.On("GetCluster", mock.Anything, "https://kubernetes.default.svc").Return(&myCluster, nil)
argoDBMock.On("GetClusterByUrl", mock.Anything, "https://kubernetes.default.svc").Return(&myCluster, nil)
argoDBMock.On("ListClusters", mock.Anything).Return(&argov1alpha1.ClusterList{Items: []argov1alpha1.Cluster{
myCluster,
}}, nil)
@@ -1825,8 +1825,8 @@ func TestReconcilerValidationErrorBehaviour(t *testing.T) {
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(&appSet).Build()
goodCluster := argov1alpha1.Cluster{Server: "https://good-cluster", Name: "good-cluster"}
badCluster := argov1alpha1.Cluster{Server: "https://bad-cluster", Name: "bad-cluster"}
argoDBMock.On("GetCluster", mock.Anything, "https://good-cluster").Return(&goodCluster, nil)
argoDBMock.On("GetCluster", mock.Anything, "https://bad-cluster").Return(&badCluster, nil)
argoDBMock.On("GetClusterByUrl", mock.Anything, "https://good-cluster").Return(&goodCluster, nil)
argoDBMock.On("GetClusterByUrl", mock.Anything, "https://bad-cluster").Return(&badCluster, nil)
argoDBMock.On("ListClusters", mock.Anything).Return(&argov1alpha1.ClusterList{Items: []argov1alpha1.Cluster{
goodCluster,
}}, nil)
6 changes: 3 additions & 3 deletions cmd/argocd/commands/admin/cluster.go
Original file line number Diff line number Diff line change
@@ -346,7 +346,7 @@ func NewClusterEnableNamespacedMode() *cobra.Command {
continue
}

cluster, err := argoDB.GetCluster(ctx, server)
cluster, err := argoDB.GetClusterByUrl(ctx, server)
if err != nil {
return fmt.Errorf("error getting cluster from server: %w", err)
}
@@ -401,7 +401,7 @@ func NewClusterDisableNamespacedMode() *cobra.Command {
continue
}

cluster, err := argoDB.GetCluster(ctx, server)
cluster, err := argoDB.GetClusterByUrl(ctx, server)
if err != nil {
return fmt.Errorf("error getting cluster from server: %w", err)
}
@@ -502,7 +502,7 @@ func NewClusterConfig() *cobra.Command {
kubeclientset, err := kubernetes.NewForConfig(conf)
errors.CheckError(err)

cluster, err := db.NewDB(namespace, settings.NewSettingsManager(ctx, kubeclientset, namespace), kubeclientset).GetCluster(ctx, serverUrl)
cluster, err := db.NewDB(namespace, settings.NewSettingsManager(ctx, kubeclientset, namespace), kubeclientset).GetClusterByUrl(ctx, serverUrl)
errors.CheckError(err)
err = kube.WriteKubeConfig(cluster.RawRestConfig(), namespace, output)
errors.CheckError(err)
4 changes: 2 additions & 2 deletions controller/appcontroller.go
Original file line number Diff line number Diff line change
@@ -992,7 +992,7 @@ func (ctrl *ApplicationController) finalizeApplicationDeletion(app *appv1.Applic

// Attempt to validate the destination via its URL
if validDestination {
if cluster, err = ctrl.db.GetCluster(context.Background(), app.Spec.Destination.Server); err != nil {
if cluster, err = ctrl.db.GetClusterByUrl(context.Background(), app.Spec.Destination.Server); err != nil {
log.Warnf("Unable to locate cluster URL for Application being deleted: %v", err)
validDestination = false
}
@@ -1720,7 +1720,7 @@ func (ctrl *ApplicationController) canProcessApp(obj interface{}) bool {
return false
}
if ctrl.clusterFilter != nil {
cluster, err := ctrl.db.GetCluster(context.Background(), app.Spec.Destination.Server)
cluster, err := ctrl.db.GetClusterByUrl(context.Background(), app.Spec.Destination.Server)
if err != nil {
return ctrl.clusterFilter(nil)
}
2 changes: 1 addition & 1 deletion controller/cache/cache.go
Original file line number Diff line number Diff line change
@@ -380,7 +380,7 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e
return clusterCache, nil
}

cluster, err := c.db.GetCluster(context.Background(), server)
cluster, err := c.db.GetClusterByUrl(context.Background(), server)
if err != nil {
return nil, fmt.Errorf("error getting cluster: %w", err)
}
2 changes: 1 addition & 1 deletion controller/sync.go
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ func (m *appStateManager) SyncAppState(app *v1alpha1.Application, state *v1alpha
return
}

clst, err := m.db.GetCluster(context.Background(), app.Spec.Destination.Server)
clst, err := argo.GetClusterByDestination(m.db, app.Spec.Destination)
if err != nil {
state.Phase = common.OperationError
state.Message = err.Error()
91 changes: 66 additions & 25 deletions docs/developer-guide/code-contributions.md
Original file line number Diff line number Diff line change
@@ -2,12 +2,19 @@

## Preface

The Argo CD project continuously grows, both in terms of features and community size. It gets adopted by more and more organisations which entrust Argo CD to handle their critical production workloads. Thus, we need to take great care with any changes that affect compatibility, performance, scalability, stability and security of Argo CD. For this reason, every new feature or larger enhancement must be properly designed and discussed before it gets accepted into the code base.
The Argo CD project continuously grows, both in terms of features and community size.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file, have there been any changes except line breaks?

Can you please revert the changes of the line breaks?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! You're correct I've only changed the line breaks (:

It gets adopted by more and more organisations which entrust Argo CD to handle their critical production workloads.
Thus, we need to take great care with any changes that affect compatibility, performance, scalability, stability
and security of Argo CD. For this reason, every new feature or larger enhancement must be properly designed and
discussed before it gets accepted into the code base.

We do welcome and encourage everyone to participate in the Argo CD project, but please understand that we can't accept each and every contribution from the community, for various reasons.
We do welcome and encourage everyone to participate in the Argo CD project, but please understand that we can't accept
each and every contribution from the community, for various reasons.

If you want to submit code for a great new feature or enhancement, we kindly ask you to take a look at the
enhancement process outlined below before you start to write code or submit a PR. This will ensure that your idea is well aligned with the project's strategy and technical requirements, and it will help greatly in getting your code merged into our code base.
enhancement process outlined below before you start to write code or submit a PR.
This will ensure that your idea is well aligned with the project's strategy and technical requirements,
and it will help greatly in getting your code merged into our code base.

Before submitting code for a new feature (and also, to some extent, for more complex bug fixes) please
[raise an Enhancement Proposal or Bug Issue](https://github.com/argoproj/argo-cd/issues/new/choose)
@@ -18,7 +25,9 @@ Each enhancement proposal needs to go through our
before we accept code contributions. To facilitate triage and to provide transparency, we use
[this GitHub project](https://github.com/orgs/argoproj/projects/18) to keep track of this process' outcome.

_Please_ do not spend too much time on larger features or refactorings before the corresponding enhancement has been triaged. This may save everyone some amount of frustration and time, as the enhancement proposal might be rejected, and the code would never get merged. However, sometimes it's helpful to have some PoC code along with a proposal.
_Please_ do not spend too much time on larger features or refactorings before the corresponding enhancement has been
triaged. This may save everyone some amount of frustration and time, as the enhancement proposal might be rejected,
and the code would never get merged. However, sometimes it's helpful to have some PoC code along with a proposal.

We will do our best to triage incoming enhancement proposals quickly, with one of the following outcomes:

@@ -30,7 +39,8 @@ Depending on how many enhancement proposals we receive at given times, it may ta

Also, please make sure you have read our
[Toolchain Guide](toolchain-guide.md)
to understand our toolchain and our continuous integration processes. It contains some invaluable information to get started with the complex code base that makes up Argo CD.
to understand our toolchain and our continuous integration processes.
It contains some invaluable information to get started with the complex code base that makes up Argo CD.

## Quick start

@@ -45,68 +55,99 @@ If the issue is already attached to next
[version milestone](https://github.com/argoproj/argo-cd/milestones),
we have decided to also dedicate some of our time on reviews to PRs received for these issues.

We encourage our community to pick up issues that are labeled in this way *and* are attached to the next version's milestone, with a promise for them to get a proper review with the clear intention for the incoming PRs to get merged.
We encourage our community to pick up issues that are labeled in this way *and* are attached to the next version's
milestone, with a promise for them to get a proper review with the clear intention for the incoming PRs to get merged.

## Triage process

### Overview

Our triage process for enhancements proposals ensures that we take a look at all incoming enhancements to determine whether we will accept code submissions to implement them.
Our triage process for enhancements proposals ensures that we take a look at all incoming enhancements
to determine whether we will accept code submissions to implement them.

The process works as follows:

* New Enhancement Proposals raised on our GitHub issue tracker are moved to the _Incoming_ column of the project's board. These are the proposals that are in the queue for triage.
* New Enhancement Proposals raised on our GitHub issue tracker are moved to the _Incoming_ column of the project's board.
These are the proposals that are in the queue for triage.
* The _Active_ column holds the issues that are currently being triaged, or will be triaged next.
* The _Accepted_ column holds the issues that have been triaged and are considered good to be implemented (e.g. the project agreed that the feature would be great to have)
* The _Declined_ column holds the issues that were rejected during triage. The issue will be updated with information about why the proposal has been rejected.
* The _Needs discussion_ column holds the issues that were found to require additional information, or even a design document, during triage.
* The _Accepted_ column holds the issues that have been triaged and are considered good to be implemented
(e.g. the project agreed that the feature would be great to have)
* The _Declined_ column holds the issues that were rejected during triage.
The issue will be updated with information about why the proposal has been rejected.
* The _Needs discussion_ column holds the issues that were found to require additional information,
or even a design document, during triage.

### Triage cadence

Triage of enhancement proposals is performed transparently, offline using issue comments and online in our weekly contributor's meeting. _Everyone_ is invited to participate in triaging, the process is not limited to participation only by maintainers.
Triage of enhancement proposals is performed transparently, offline using issue comments and online in our weekly
contributor's meeting. _Everyone_ is invited to participate in triaging, the process is not limited
to participation only by maintainers.

Usually, we will triage enhancement proposals in a First-In-First-Out order, which mean that oldest proposals will be triaged first.
Usually, we will triage enhancement proposals in a First-In-First-Out order, which mean that oldest
proposals will be triaged first.

We aim to triage at least 10 proposals a week. Depending on our available time, we may be triaging a higher or lower number of proposals in any given week.
We aim to triage at least 10 proposals a week. Depending on our available time, we may be triaging a higher or
lower number of proposals in any given week.

## Proposal states

### Accepted proposals

When a proposal is considered _Accepted_, it was decided that this enhancement would be valuable to the community at large and fits into the overall strategic roadmap of the project.
When a proposal is considered _Accepted_, it was decided that this enhancement would be valuable to the community
at large and fits into the overall strategic roadmap of the project.

Implementation of the issue may be started, either by the proposal's creator or another community member (including maintainers of the project).
Implementation of the issue may be started, either by the proposal's creator or another community member
(including maintainers of the project).

The issue should be refined enough by now to contain any concerns and guidelines to be taken into consideration during implementation.
The issue should be refined enough by now to contain any concerns and guidelines to be taken into consideration
during implementation.

### Declined proposals

We don't decline proposals lightly, and we will do our best to give a proper reasoning why we think that the proposal does not fit with the future of the project. Reasons for declining proposals may be - amongst others - that the change would be breaking for many, or that it does not meet the strategic direction of the project. Usually, discussion will be facilitated with the enhancement's creator before declining a proposal.
We don't decline proposals lightly, and we will do our best to give a proper reasoning why we think that the proposal
does not fit with the future of the project. Reasons for declining proposals may be - amongst others - that the change
would be breaking for many, or that it does not meet the strategic direction of the project. Usually, discussion will
be facilitated with the enhancement's creator before declining a proposal.

Once a proposal is in _Declined_ state it's unlikely that we will accept code contributions for its implementation.

### Proposals that need discussion

Sometimes, we can't completely understand a proposal from its GitHub issue and require more information on the original intent or on more details about the implementation. If we are confronted with such an issue during the triage, we move this issue to the _Needs discussion_ column to indicate that we expect the issue's creator to supply more information on their idea. We may ask you to provide this information, either by adding that information to the issue itself or by joining one of our
[regular contributor's meeting](#regular-contributor-meeting)
Sometimes, we can't completely understand a proposal from its GitHub issue and require more
information on the original intent or on more details about the implementation. If we are confronted with such an
issue during the triage, we move this issue to the _Needs discussion_ column to indicate that we expect the issue's
creator to supply more information on their idea. We may ask you to provide this information, either by adding that
information to the issue itself or by joining one of our [regular contributor's meeting](#regular-contributor-meeting)
to discuss the proposal with us.

Also, issues that we find to require a more formal design document will be moved to this column.

## Design documents

For some enhancement proposals (especially those that will change behavior of Argo CD substantially, are attached with some caveats or where upgrade/downgrade paths are not clear), a more formal design document will be required in order to fully discuss and understand the enhancement in the broader community. This requirement is usually determined during triage. If you submitted an enhancement proposal, we may ask you to provide this more formal write down, along with some concerns or topics that need to be addressed.
For some enhancement proposals (especially those that will change behavior of Argo CD substantially,
are attached with some caveats or where upgrade/downgrade paths are not clear), a more formal design document will be
required in order to fully discuss and understand the enhancement in the broader community.
This requirement is usually determined during triage. If you submitted an enhancement proposal, we may ask you to
provide this more formal write down, along with some concerns or topics that need to be addressed.

Design documents are usually submitted as PR and use [this template](https://github.com/argoproj/argo-cd/blob/master/docs/proposals/001-proposal-template.md) as a guide what kind of information we're looking for. Discussion will take place in the review process. When a design document gets merged, we consider it as approved and code can be written and submitted to implement this specific design.
Design documents are usually submitted as PR and use
[this template](https://github.com/argoproj/argo-cd/blob/master/docs/proposals/001-proposal-template.md) as a guide
what kind of information we're looking for. Discussion will take place in the review process.
When a design document gets merged, we consider it as approved and code can be written and submitted to implement
this specific design.

## Regular contributor meeting

Our community regularly meets virtually to discuss issues, ideas and enhancements around Argo CD. We do invite you to join this virtual meetings if you want to bring up certain things (including your enhancement proposals), participate in our triaging or just want to get to know other contributors.
Our community regularly meets virtually to discuss issues, ideas and enhancements around Argo CD.
We do invite you to join this virtual meetings if you want to bring up certain things
(including your enhancement proposals), participate in our triaging or just want to get to know other contributors.

The current cadence of our meetings is weekly, every Thursday at 4:15pm UTC (8:15am Pacific, 11:15am Eastern, 5:15pm Central European, 9:45pm Indian). We use Zoom to conduct these meetings.
The current cadence of our meetings is weekly, every Thursday at 4:15pm UTC
(8:15am Pacific, 11:15am Eastern, 5:15pm Central European, 9:45pm Indian).
We use Zoom to conduct these meetings.

* [Agenda document (Google Docs, includes Zoom link)](https://docs.google.com/document/d/1xkoFkVviB70YBzSEa4bDnu-rUZ1sIFtwKKG1Uw8XsY8)

If you want to discuss something, we kindly ask you to put your item on the
[agenda](https://docs.google.com/document/d/1xkoFkVviB70YBzSEa4bDnu-rUZ1sIFtwKKG1Uw8XsY8)
for one of the upcoming meetings so that we can plan in the time for discussing about it.
for one of the upcoming meetings so that we can plan in the time for discussing it.
Loading