Skip to content

Commit

Permalink
Merge branch 'master' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
pasha-codefresh authored May 30, 2024
2 parents 56b16d6 + 4d8436b commit 20b6f91
Show file tree
Hide file tree
Showing 96 changed files with 2,185 additions and 8,650 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/image-reuse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,23 @@ jobs:
echo 'EOF' >> $GITHUB_ENV
- name: Login to Quay.io
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: quay.io
username: ${{ secrets.quay_username }}
password: ${{ secrets.quay_password }}
if: ${{ inputs.quay_image_name && inputs.push }}

- name: Login to GitHub Container Registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ secrets.ghcr_username }}
password: ${{ secrets.ghcr_password }}
if: ${{ inputs.ghcr_image_name && inputs.push }}

- name: Login to dockerhub Container Registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_password }}
Expand Down
7 changes: 7 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ issues:
max-same-issues: 0
linters:
enable:
- errcheck
- gofmt
- gosimple
- govet
- ineffassign
- misspell
- staticcheck
- unused
run:
timeout: 50m
4 changes: 2 additions & 2 deletions applicationset/controllers/applicationset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ func cleanupDeletedApplicationStatuses(statusMap map[string]argov1alpha1.Resourc
}
}

// setApplicationSetApplicationStatus updates the ApplicatonSet's status field
// setApplicationSetApplicationStatus updates the ApplicationSet's status field
// with any new/changed Application statuses.
func (r *ApplicationSetReconciler) setAppSetApplicationStatus(ctx context.Context, logCtx *log.Entry, applicationSet *argov1alpha1.ApplicationSet, applicationStatuses []argov1alpha1.ApplicationSetApplicationStatus) error {
needToUpdateStatus := false
Expand Down Expand Up @@ -1632,7 +1632,7 @@ func shouldRequeueApplicationSet(appOld *argov1alpha1.Application, appNew *argov
// the applicationset controller owns the application spec, labels, annotations, and finalizers on the applications
// reflect.DeepEqual considers nil slices/maps not equal to empty slices/maps
// https://pkg.go.dev/reflect#DeepEqual
// ApplicationDestination has an unexported field so we can just use the == for comparsion
// ApplicationDestination has an unexported field so we can just use the == for comparison
if !cmp.Equal(appOld.Spec, appNew.Spec, cmpopts.EquateEmpty(), cmpopts.EquateComparable(argov1alpha1.ApplicationDestination{})) ||
!cmp.Equal(appOld.ObjectMeta.GetAnnotations(), appNew.ObjectMeta.GetAnnotations(), cmpopts.EquateEmpty()) ||
!cmp.Equal(appOld.ObjectMeta.GetLabels(), appNew.ObjectMeta.GetLabels(), cmpopts.EquateEmpty()) ||
Expand Down
10 changes: 5 additions & 5 deletions applicationset/controllers/applicationset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4113,7 +4113,7 @@ func TestBuildAppDependencyList(t *testing.T) {
}

appDependencyList, appStepMap, err := r.buildAppDependencyList(log.NewEntry(log.StandardLogger()), cc.appSet, cc.apps)
assert.Equal(t, err, nil, "expected no errors, but errors occured")
assert.Equal(t, err, nil, "expected no errors, but errors occurred")
assert.Equal(t, cc.expectedList, appDependencyList, "expected appDependencyList did not match actual")
assert.Equal(t, cc.expectedStepMap, appStepMap, "expected appStepMap did not match actual")
})
Expand Down Expand Up @@ -4707,7 +4707,7 @@ func TestBuildAppSyncMap(t *testing.T) {
}

appSyncMap, err := r.buildAppSyncMap(context.TODO(), cc.appSet, cc.appDependencyList, cc.appMap)
assert.Equal(t, err, nil, "expected no errors, but errors occured")
assert.Equal(t, err, nil, "expected no errors, but errors occurred")
assert.Equal(t, cc.expectedMap, appSyncMap, "expected appSyncMap did not match actual")
})
}
Expand Down Expand Up @@ -5373,7 +5373,7 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
appStatuses[i].LastTransitionTime = nil
}

assert.Equal(t, err, nil, "expected no errors, but errors occured")
assert.Equal(t, err, nil, "expected no errors, but errors occurred")
assert.Equal(t, cc.expectedAppStatus, appStatuses, "expected appStatuses did not match actual")
})
}
Expand Down Expand Up @@ -6127,7 +6127,7 @@ func TestUpdateApplicationSetApplicationStatusProgress(t *testing.T) {
appStatuses[i].LastTransitionTime = nil
}

assert.Equal(t, err, nil, "expected no errors, but errors occured")
assert.Equal(t, err, nil, "expected no errors, but errors occurred")
assert.Equal(t, cc.expectedAppStatus, appStatuses, "expected appStatuses did not match actual")
})
}
Expand Down Expand Up @@ -6340,7 +6340,7 @@ func TestUpdateResourceStatus(t *testing.T) {

err := r.updateResourcesStatus(context.TODO(), log.NewEntry(log.StandardLogger()), &cc.appSet, cc.apps)

assert.Equal(t, err, nil, "expected no errors, but errors occured")
assert.Equal(t, err, nil, "expected no errors, but errors occurred")
assert.Equal(t, cc.expectedResources, cc.appSet.Status.Resources, "expected resources did not match actual")
})
}
Expand Down
2 changes: 1 addition & 1 deletion assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6021,7 +6021,7 @@
},
"v1alpha1ApplicationSetCondition": {
"type": "object",
"title": "ApplicationSetCondition contains details about an applicationset condition, which is usally an error or warning",
"title": "ApplicationSetCondition contains details about an applicationset condition, which is usually an error or warning",
"properties": {
"lastTransitionTime": {
"$ref": "#/definitions/v1Time"
Expand Down
3 changes: 3 additions & 0 deletions cmd/argocd-repo-server/commands/argocd_repo_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func NewCommand() *cobra.Command {
helmManifestMaxExtractedSize string
helmRegistryMaxIndexSize string
disableManifestMaxExtractedSize bool
includeHiddenDirectories bool
)
var command = cobra.Command{
Use: cliName,
Expand Down Expand Up @@ -130,6 +131,7 @@ func NewCommand() *cobra.Command {
StreamedManifestMaxTarSize: streamedManifestMaxTarSizeQuantity.ToDec().Value(),
HelmManifestMaxExtractedSize: helmManifestMaxExtractedSizeQuantity.ToDec().Value(),
HelmRegistryMaxIndexSize: helmRegistryMaxIndexSizeQuantity.ToDec().Value(),
IncludeHiddenDirectories: includeHiddenDirectories,
}, askPassServer)
errors.CheckError(err)

Expand Down Expand Up @@ -215,6 +217,7 @@ func NewCommand() *cobra.Command {
command.Flags().StringVar(&helmManifestMaxExtractedSize, "helm-manifest-max-extracted-size", env.StringFromEnv("ARGOCD_REPO_SERVER_HELM_MANIFEST_MAX_EXTRACTED_SIZE", "1G"), "Maximum size of helm manifest archives when extracted")
command.Flags().StringVar(&helmRegistryMaxIndexSize, "helm-registry-max-index-size", env.StringFromEnv("ARGOCD_REPO_SERVER_HELM_MANIFEST_MAX_INDEX_SIZE", "1G"), "Maximum size of registry index file")
command.Flags().BoolVar(&disableManifestMaxExtractedSize, "disable-helm-manifest-max-extracted-size", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_DISABLE_HELM_MANIFEST_MAX_EXTRACTED_SIZE", false), "Disable maximum size of helm manifest archives when extracted")
command.Flags().BoolVar(&includeHiddenDirectories, "include-hidden-directories", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_INCLUDE_HIDDEN_DIRECTORIES", false), "Include hidden directories from Git")
tlsConfigCustomizerSrc = tls.AddTLSFlagsToCmd(&command)
cacheSrc = reposervercache.AddCacheFlagsToCmd(&command, cacheutil.Options{
OnClientCreated: func(client *redis.Client) {
Expand Down
18 changes: 9 additions & 9 deletions cmd/argocd/commands/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1357,47 +1357,47 @@ func TestFilterAppResources(t *testing.T) {
expectedResult []*v1alpha1.SyncOperationResource
}{
// --resource apps:ReplicaSet:replicaSet-name1 --resource *:Service:*
{testName: "Include ReplicaSet replicaSet-name1 resouce and all service resources",
{testName: "Include ReplicaSet replicaSet-name1 resource and all service resources",
selectedResources: []*v1alpha1.SyncOperationResource{&includeAllServiceResources, &includeReplicaSet1Resource},
expectedResult: []*v1alpha1.SyncOperationResource{&replicaSet1, &service1, &service2},
},
// --resource apps:ReplicaSet:replicaSet-name1 --resource !*:Service:*
{testName: "Include ReplicaSet replicaSet-name1 resouce and exclude all service resources",
{testName: "Include ReplicaSet replicaSet-name1 resource and exclude all service resources",
selectedResources: []*v1alpha1.SyncOperationResource{&excludeAllServiceResources, &includeReplicaSet1Resource},
expectedResult: []*v1alpha1.SyncOperationResource{&replicaSet1, &replicaSet2, &job, &deployment},
},
// --resource !apps:ReplicaSet:replicaSet-name2 --resource !*:Service:*
{testName: "Exclude ReplicaSet replicaSet-name2 resouce and all service resources",
{testName: "Exclude ReplicaSet replicaSet-name2 resource and all service resources",
selectedResources: []*v1alpha1.SyncOperationResource{&excludeReplicaSet2Resource, &excludeAllServiceResources},
expectedResult: []*v1alpha1.SyncOperationResource{&replicaSet1, &replicaSet2, &job, &service1, &service2, &deployment},
},
// --resource !apps:ReplicaSet:replicaSet-name2
{testName: "Exclude ReplicaSet replicaSet-name2 resouce",
{testName: "Exclude ReplicaSet replicaSet-name2 resource",
selectedResources: []*v1alpha1.SyncOperationResource{&excludeReplicaSet2Resource},
expectedResult: []*v1alpha1.SyncOperationResource{&replicaSet1, &job, &service1, &service2, &deployment},
},
// --resource apps:ReplicaSet:replicaSet-name1
{testName: "Include ReplicaSet replicaSet-name1 resouce",
{testName: "Include ReplicaSet replicaSet-name1 resource",
selectedResources: []*v1alpha1.SyncOperationResource{&includeReplicaSet1Resource},
expectedResult: []*v1alpha1.SyncOperationResource{&replicaSet1},
},
// --resource !*:Service:*
{testName: "Exclude Service resouces",
{testName: "Exclude Service resources",
selectedResources: []*v1alpha1.SyncOperationResource{&excludeAllServiceResources},
expectedResult: []*v1alpha1.SyncOperationResource{&replicaSet1, &replicaSet2, &job, &deployment},
},
// --resource *:Service:*
{testName: "Include Service resouces",
{testName: "Include Service resources",
selectedResources: []*v1alpha1.SyncOperationResource{&includeAllServiceResources},
expectedResult: []*v1alpha1.SyncOperationResource{&service1, &service2},
},
// --resource !*:*:*
{testName: "Exclude all resouces",
{testName: "Exclude all resources",
selectedResources: []*v1alpha1.SyncOperationResource{&excludeAllResources},
expectedResult: nil,
},
// --resource *:*:*
{testName: "Include all resouces",
{testName: "Include all resources",
selectedResources: []*v1alpha1.SyncOperationResource{&includeAllResources},
expectedResult: []*v1alpha1.SyncOperationResource{&replicaSet1, &replicaSet2, &job, &service1, &service2, &deployment},
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/argocd/commands/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func NewClusterListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Comman
# List Clusters in Default "Wide" Format
argocd cluster list
# List Cluster via specifing the server
# List Cluster via specifying the server
argocd cluster list --server <ARGOCD_SERVER_ADDRESS>
# List Clusters in JSON Format
Expand Down
2 changes: 1 addition & 1 deletion cmd/argocd/commands/projectwindows.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func NewProjectWindowsDisableManualSyncCommand(clientOpts *argocdclient.ClientOp
#Disable manual sync for a sync window for the Project
argocd proj windows disable-manual-sync PROJECT ID
#Disbaling manual sync for a windows set on the default project with Id 0
#Disabling manual sync for a windows set on the default project with Id 0
argocd proj windows disable-manual-sync default 0`,
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()
Expand Down
4 changes: 2 additions & 2 deletions cmpserver/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ func runCommand(ctx context.Context, command Command, path string, env []string)
if len(output) == 0 {
logCtx.Warn("Plugin command returned zero output")
} else {
// Log stderr even on successfull commands to help develop plugins
logCtx.Info("Plugin command successfull")
// Log stderr even on successful commands to help develop plugins
logCtx.Info("Plugin command successful")
}

return strings.TrimSuffix(output, "\n"), nil
Expand Down
6 changes: 3 additions & 3 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const (

// LegacyShardingAlgorithm is the default value for Sharding Algorithm it uses an `uid` based distribution (non-uniform)
LegacyShardingAlgorithm = "legacy"
// RoundRobinShardingAlgorithm is a flag value that can be opted for Sharding Algorithm it uses an equal distribution accross all shards
// RoundRobinShardingAlgorithm is a flag value that can be opted for Sharding Algorithm it uses an equal distribution across all shards
RoundRobinShardingAlgorithm = "round-robin"
// AppControllerHeartbeatUpdateRetryCount is the retry count for updating the Shard Mapping to the Shard Mapping ConfigMap used by Application Controller
AppControllerHeartbeatUpdateRetryCount = 3
Expand Down Expand Up @@ -206,7 +206,7 @@ const (
EnvVarTLSDataPath = "ARGOCD_TLS_DATA_PATH"
// EnvGitAttemptsCount specifies number of git remote operations attempts count
EnvGitAttemptsCount = "ARGOCD_GIT_ATTEMPTS_COUNT"
// EnvGitRetryMaxDuration specifices max duration of git remote operation retry
// EnvGitRetryMaxDuration specifies max duration of git remote operation retry
EnvGitRetryMaxDuration = "ARGOCD_GIT_RETRY_MAX_DURATION"
// EnvGitRetryDuration specifies duration of git remote operation retry
EnvGitRetryDuration = "ARGOCD_GIT_RETRY_DURATION"
Expand Down Expand Up @@ -353,7 +353,7 @@ func GetCMPChunkSize() int {
}

// GetCMPWorkDir will return the full path of the work directory used by the CMP server.
// This directory and all it's contents will be deleted durring CMP bootstrap.
// This directory and all it's contents will be deleted during CMP bootstrap.
func GetCMPWorkDir() string {
if workDir := os.Getenv(EnvCMPWorkDir); workDir != "" {
return filepath.Join(workDir, DefaultCMPWorkDirName)
Expand Down
2 changes: 1 addition & 1 deletion controller/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func setApplicationHealth(resources []managedResource, statuses []appv1.Resource
app.Status.ResourceHealthSource = appv1.ResourceHealthLocationAppTree
}
if savedErr != nil && errCount > 1 {
savedErr = fmt.Errorf("see applicaton-controller logs for %d other errors; most recent error was: %w", errCount-1, savedErr)
savedErr = fmt.Errorf("see application-controller logs for %d other errors; most recent error was: %w", errCount-1, savedErr)
}
return &appHealth, savedErr
}
2 changes: 1 addition & 1 deletion controller/sharding/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewClusterSharding(_ db.ArgoDB, shard, replicas int, shardingAlgorithm stri
return clusterSharding
}

// IsManagedCluster returns wheter or not the cluster should be processed by a given shard.
// IsManagedCluster returns whether or not the cluster should be processed by a given shard.
func (s *ClusterSharding) IsManagedCluster(c *v1alpha1.Cluster) bool {
s.lock.RLock()
defer s.lock.RUnlock()
Expand Down
6 changes: 3 additions & 3 deletions controller/sharding/sharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type shardApplicationControllerMapping struct {
}

// GetClusterFilter returns a ClusterFilterFunction which is a function taking a cluster as a parameter
// and returns wheter or not the cluster should be processed by a given shard. It calls the distributionFunction
// and returns whether or not the cluster should be processed by a given shard. It calls the distributionFunction
// to determine which shard will process the cluster, and if the given shard is equal to the calculated shard
// the function will return true.
func GetClusterFilter(db db.ArgoDB, distributionFunction DistributionFunction, replicas, shard int) ClusterFilterFunction {
Expand Down Expand Up @@ -128,13 +128,13 @@ func LegacyDistributionFunction(replicas int) DistributionFunction {
// for a given cluster the function will return the shard number based on the modulo of the cluster rank in
// the cluster's list sorted by uid on the shard number.
// This function ensures an homogenous distribution: each shards got assigned the same number of
// clusters +/-1 , but with the drawback of a reshuffling of clusters accross shards in case of some changes
// clusters +/-1 , but with the drawback of a reshuffling of clusters across shards in case of some changes
// in the cluster list

func RoundRobinDistributionFunction(clusters clusterAccessor, replicas int) DistributionFunction {
return func(c *v1alpha1.Cluster) int {
if replicas > 0 {
if c == nil { // in-cluster does not necessarly have a secret assigned. So we are receiving a nil cluster here.
if c == nil { // in-cluster does not necessary have a secret assigned. So we are receiving a nil cluster here.
return 0
}
// if Shard is manually set and the assigned value is lower than the number of replicas,
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/versions.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ div[data-md-component=announce]>div#announce-msg>a{
}

/* from https://assets.readthedocs.org/static/css/badge_only.css,
most styles have to be overriden here */
most styles have to be overridden here */
.rst-versions{
position: relative !important;
bottom: 0;
Expand Down
37 changes: 18 additions & 19 deletions docs/developer-guide/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,32 @@

https://github.com/argoproj/gitops-engine

### Pulling changes from `gitops-engine`
### Pulling changes from `gitops-engine`

After your GitOps Engine PR has been merged, ArgoCD needs to be updated to pull in the version of the GitOps engine that contains your change. Here are the steps:
After your GitOps Engine PR has been merged, ArgoCD needs to be updated to pull in the version of the GitOps engine that contains your change. Here are the steps:

* Retrieve the SHA hash for your commit. You will use this in the next step.
* From the `argo-cd` folder, run the following command
- Retrieve the SHA hash for your commit. You will use this in the next step.
- From the `argo-cd` folder, run the following command

`go get github.com/argoproj/gitops-engine@<git-commit-sha>`
`go get github.com/argoproj/gitops-engine@<git-commit-sha>`

If you get an error message `invalid version: unknown revision` then you got the wrong SHA hash
If you get an error message `invalid version: unknown revision` then you got the wrong SHA hash

* Run:
- Run:

`go mod tidy`
`go mod tidy`

* The following files are changed:
- The following files are changed:

- `go.mod`
- `go.sum`
- `go.mod`
- `go.sum`

* Create an ArgoCD PR with a `refactor:` type in its title for the two file changes.
- Create an ArgoCD PR with a `refactor:` type in its title for the two file changes.

### Tips:
* See https://github.com/argoproj/argo-cd/pull/4434 as an example
* The PR might require additional, dependent changes in ArgoCD that are directly impacted by the changes made in the engine.

- See https://github.com/argoproj/argo-cd/pull/4434 as an example
- The PR might require additional, dependent changes in ArgoCD that are directly impacted by the changes made in the engine.

## Argo UI Components

Expand All @@ -45,10 +46,8 @@ If you make changes to the Argo UI component, and your Argo CD changes depend on
1. Make changes to Argo UI and submit the PR request.
2. Also, prepare your Argo CD changes, but don't create the PR just yet.
3. **After** the Argo UI PR has been merged to master, then as part of your Argo CD changes:
- Run `yarn add git+https://github.com/argoproj/argo-ui.git` in the `ui/` directory, and then,
- Check in the regenerated yarn.lock file as part of your Argo CD commit
4. Create the Argo CD PR when you are ready. The PR build and test checks should pass.
- Run `yarn add git+https://github.com/argoproj/argo-ui.git` in the `ui/` directory, and then,
- Check in the regenerated yarn.lock file as part of your Argo CD commit
4. Create the Argo CD PR when you are ready. The PR build and test checks should pass.

If your Argo UI change is a 'stand-alone' fix, and you simply want Argo CD to pull in your change, then simply create an Argo CD PR with the yarn.lock file change.


2 changes: 1 addition & 1 deletion docs/developer-guide/extensions/proxy-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Is the address where the extension backend must be available.

If provided, the headers list will be added on all outgoing requests
for this service config. Existing headers in the incoming request with
the same name will be overriden by the one in this list. Reserved header
the same name will be overridden by the one in this list. Reserved header
names will be ignored (see the [headers](#incoming-request-headers) below).

#### `extensions.backend.services.headers.name` (*string*)
Expand Down
Loading

0 comments on commit 20b6f91

Please sign in to comment.