mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
fix: enable misspell linter (#18412)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
parent
8a28279921
commit
9fe1dbfcad
37 changed files with 74 additions and 67 deletions
|
|
@ -5,6 +5,13 @@ issues:
|
|||
max-same-issues: 0
|
||||
linters:
|
||||
enable:
|
||||
- errcheck
|
||||
- gofmt
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- misspell
|
||||
- staticcheck
|
||||
- unused
|
||||
run:
|
||||
timeout: 50m
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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()) ||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
})
|
||||
|
|
@ -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")
|
||||
})
|
||||
}
|
||||
|
|
@ -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")
|
||||
})
|
||||
}
|
||||
|
|
@ -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")
|
||||
})
|
||||
}
|
||||
|
|
@ -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")
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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"
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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*)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ data:
|
|||
controller.resource.health.persist: "true"
|
||||
# Cache expiration default (default 24h0m0s)
|
||||
controller.default.cache.expiration: "24h0m0s"
|
||||
# Sharding algorithm used to balance clusters accross application controller shards (default "legacy")
|
||||
# Sharding algorithm used to balance clusters across application controller shards (default "legacy")
|
||||
controller.sharding.algorithm: legacy
|
||||
# Number of allowed concurrent kubectl fork/execs. Any value less than 1 means no limit.
|
||||
controller.kubectl.parallelism.limit: "20"
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ spec:
|
|||
```
|
||||
* In order to manually set the cluster's shard number, specify the optional `shard` property when creating a cluster. If not specified, it will be calculated on the fly by the application controller.
|
||||
|
||||
* The shard distribution algorithm of the `argocd-application-controller` can be set by using the `--sharding-method` parameter. Supported sharding methods are : [legacy (default), round-robin]. `legacy` mode uses an `uid` based distribution (non-uniform). `round-robin` uses an equal distribution across all shards. The `--sharding-method` parameter can also be overriden by setting the key `controller.sharding.algorithm` in the `argocd-cmd-params-cm` `configMap` (preferably) or by setting the `ARGOCD_CONTROLLER_SHARDING_ALGORITHM` environment variable and by specifiying the same possible values.
|
||||
* The shard distribution algorithm of the `argocd-application-controller` can be set by using the `--sharding-method` parameter. Supported sharding methods are : [legacy (default), round-robin]. `legacy` mode uses an `uid` based distribution (non-uniform). `round-robin` uses an equal distribution across all shards. The `--sharding-method` parameter can also be overridden by setting the key `controller.sharding.algorithm` in the `argocd-cmd-params-cm` `configMap` (preferably) or by setting the `ARGOCD_CONTROLLER_SHARDING_ALGORITHM` environment variable and by specifiying the same possible values.
|
||||
|
||||
!!! warning "Alpha Feature"
|
||||
The `round-robin` shard distribution algorithm is an experimental feature. Reshuffling is known to occur in certain scenarios with cluster removal. If the cluster at rank-0 is removed, reshuffling all clusters across shards will occur and may temporarily have negative performance impacts.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ managed (i.e. reconciled from Git). The default label used is the well-known
|
|||
label `app.kubernetes.io/instance`.
|
||||
|
||||
This proposal suggests to introduce the `trackingMethod` setting that allows
|
||||
controlling how applicaton resources are identified and allows switching to
|
||||
controlling how application resources are identified and allows switching to
|
||||
using the annotation instead of `app.kubernetes.io/instance` label.
|
||||
|
||||
## Motivation
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ argocd cluster list [flags]
|
|||
# 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
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ argocd proj windows disable-manual-sync PROJECT ID [flags]
|
|||
#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
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -763,7 +763,7 @@ type ApplicationSetStatus struct {
|
|||
Resources []ResourceStatus `json:"resources,omitempty" protobuf:"bytes,3,opt,name=resources"`
|
||||
}
|
||||
|
||||
// ApplicationSetCondition contains details about an applicationset condition, which is usally an error or warning
|
||||
// ApplicationSetCondition contains details about an applicationset condition, which is usually an error or warning
|
||||
type ApplicationSetCondition struct {
|
||||
// Type is an applicationset condition type
|
||||
Type ApplicationSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type"`
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ message ApplicationSetApplicationStatus {
|
|||
optional string step = 5;
|
||||
}
|
||||
|
||||
// ApplicationSetCondition contains details about an applicationset condition, which is usally an error or warning
|
||||
// ApplicationSetCondition contains details about an applicationset condition, which is usually an error or warning
|
||||
message ApplicationSetCondition {
|
||||
// Type is an applicationset condition type
|
||||
optional string type = 1;
|
||||
|
|
|
|||
|
|
@ -867,7 +867,7 @@ func schema_pkg_apis_application_v1alpha1_ApplicationSetCondition(ref common.Ref
|
|||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "ApplicationSetCondition contains details about an applicationset condition, which is usally an error or warning",
|
||||
Description: "ApplicationSetCondition contains details about an applicationset condition, which is usually an error or warning",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"type": {
|
||||
|
|
|
|||
|
|
@ -2197,7 +2197,7 @@ func populatePluginAppDetails(ctx context.Context, res *apiclient.RepoAppDetails
|
|||
|
||||
announcement, err := parametersAnnouncementStream.CloseAndRecv()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get parameter anouncement: %w", err)
|
||||
return fmt.Errorf("failed to get parameter announcement: %w", err)
|
||||
}
|
||||
|
||||
res.Plugin = &apiclient.PluginAppSpec{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const (
|
|||
// that the Argo CD application is associated with. This header
|
||||
// will be populated by the extension proxy and passed to the
|
||||
// configured backend service. If this header is passed by
|
||||
// the client, its value will be overriden by the extension
|
||||
// the client, its value will be overridden by the extension
|
||||
// handler.
|
||||
//
|
||||
// Example:
|
||||
|
|
@ -61,7 +61,7 @@ const (
|
|||
// that the Argo CD application is associated with. This header
|
||||
// will be populated by the extension proxy and passed to the
|
||||
// configured backend service. If this header is passed by
|
||||
// the client, its value will be overriden by the extension
|
||||
// the client, its value will be overridden by the extension
|
||||
// handler.
|
||||
HeaderArgoCDTargetClusterName = "Argocd-Target-Cluster-Name"
|
||||
)
|
||||
|
|
@ -719,7 +719,7 @@ func registerMetrics(extName string, metrics httpsnoop.Metrics, extensionMetrics
|
|||
}
|
||||
}
|
||||
|
||||
// prepareRequest is reponsible for cleaning the incoming request URL removing
|
||||
// prepareRequest is responsible for cleaning the incoming request URL removing
|
||||
// the Argo CD extension API section from it. It will set the cluster destination name
|
||||
// and cluster destination server in the headers as it is defined in the given app.
|
||||
func prepareRequest(r *http.Request, extName string, app *v1alpha1.Application) {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func TestNamespace() string {
|
|||
return GetEnvWithDefault("ARGOCD_E2E_NAMESPACE", ArgoCDNamespace)
|
||||
}
|
||||
|
||||
// GetE2EFixtureK8sClient initializes the Kubernetes clients (if needed), and returns the most recently initalized value.
|
||||
// GetE2EFixtureK8sClient initializes the Kubernetes clients (if needed), and returns the most recently initialized value.
|
||||
// Note: this requires a local Kubernetes configuration (for example, while running the E2E tests).
|
||||
func GetE2EFixtureK8sClient() *E2EFixtureK8sClient {
|
||||
// Initialize the Kubernetes clients only on first use
|
||||
|
|
|
|||
|
|
@ -568,7 +568,7 @@ func EnsureCleanState(t *testing.T, opts ...TestOption) {
|
|||
opt := newTestOption(opts...)
|
||||
// In large scenarios, we can skip tests that already run
|
||||
SkipIfAlreadyRun(t)
|
||||
// Register this test after it has been run & was successfull
|
||||
// Register this test after it has been run & was successful
|
||||
t.Cleanup(func() {
|
||||
RecordTestRun(t)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ func cmpSupports(ctx context.Context, pluginSockFilePath, appPath, repoPath, fil
|
|||
log.WithFields(log.Fields{
|
||||
common.SecurityField: common.SecurityLow,
|
||||
common.SecurityCWEField: common.SecurityCWEMissingReleaseOfFileDescriptor,
|
||||
}).Debugf("Reponse from socket file %s does not support %v", fileName, repoPath)
|
||||
}).Debugf("Response from socket file %s does not support %v", fileName, repoPath)
|
||||
io.Close(conn)
|
||||
return nil, nil, false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult bool
|
||||
}{
|
||||
//--resource apps:ReplicaSet:backend --resource *:Service:*
|
||||
{testName: "Include ReplicaSet backend resouce and all service resources",
|
||||
{testName: "Include ReplicaSet backend resource and all service resources",
|
||||
name: "backend",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "apps", Kind: "ReplicaSet"},
|
||||
|
|
@ -120,7 +120,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: true,
|
||||
},
|
||||
//--resource apps:ReplicaSet:backend --resource *:Service:*
|
||||
{testName: "Include ReplicaSet backend resouce and all service resources",
|
||||
{testName: "Include ReplicaSet backend resource and all service resources",
|
||||
name: "main-page-down",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "batch", Kind: "Job"},
|
||||
|
|
@ -128,7 +128,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: false,
|
||||
},
|
||||
//--resource apps:ReplicaSet:backend --resource !*:Service:*
|
||||
{testName: "Include ReplicaSet backend resouce and exclude all service resources",
|
||||
{testName: "Include ReplicaSet backend resource and exclude all service resources",
|
||||
name: "main-page-down",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "batch", Kind: "Job"},
|
||||
|
|
@ -136,7 +136,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: true,
|
||||
},
|
||||
// --resource !apps:ReplicaSet:backend --resource !*:Service:*
|
||||
{testName: "Exclude ReplicaSet backend resouce and all service resources",
|
||||
{testName: "Exclude ReplicaSet backend resource and all service resources",
|
||||
name: "main-page-down",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "batch", Kind: "Job"},
|
||||
|
|
@ -144,7 +144,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: true,
|
||||
},
|
||||
// --resource !apps:ReplicaSet:backend
|
||||
{testName: "Exclude ReplicaSet backend resouce",
|
||||
{testName: "Exclude ReplicaSet backend resource",
|
||||
name: "backend",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "apps", Kind: "ReplicaSet"},
|
||||
|
|
@ -152,7 +152,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: false,
|
||||
},
|
||||
// --resource apps:ReplicaSet:backend
|
||||
{testName: "Include ReplicaSet backend resouce",
|
||||
{testName: "Include ReplicaSet backend resource",
|
||||
name: "backend",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "apps", Kind: "ReplicaSet"},
|
||||
|
|
@ -160,7 +160,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: true,
|
||||
},
|
||||
// --resource !*:Service:*
|
||||
{testName: "Exclude Service resouces",
|
||||
{testName: "Exclude Service resources",
|
||||
name: "backend",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "", Kind: "Service"},
|
||||
|
|
@ -168,7 +168,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: false,
|
||||
},
|
||||
// --resource *:Service:*
|
||||
{testName: "Include Service resouces",
|
||||
{testName: "Include Service resources",
|
||||
name: "backend",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "", Kind: "Service"},
|
||||
|
|
@ -176,7 +176,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: true,
|
||||
},
|
||||
// --resource !*:*:*
|
||||
{testName: "Exclude all resouces",
|
||||
{testName: "Exclude all resources",
|
||||
name: "backend",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "", Kind: "Service"},
|
||||
|
|
@ -184,7 +184,7 @@ func TestIncludeResource(t *testing.T) {
|
|||
expectedResult: false,
|
||||
},
|
||||
// --resource *:*:*
|
||||
{testName: "Include all resouces",
|
||||
{testName: "Include all resources",
|
||||
name: "backend",
|
||||
namespace: "default",
|
||||
gvk: schema.GroupVersionKind{Group: "", Kind: "Service"},
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ type typedResults struct {
|
|||
}
|
||||
|
||||
// newTypedResults will convert live and config into a TypedValue using the given pt
|
||||
// and compare them. Returns a typedResults with the coverted types and the comparison.
|
||||
// and compare them. Returns a typedResults with the converted types and the comparison.
|
||||
// If pt is nil, will use the DeducedParseableType.
|
||||
func newTypedResults(live, config *unstructured.Unstructured, pt *typed.ParseableType) (*typedResults, error) {
|
||||
typedLive, err := pt.FromUnstructured(live.Object)
|
||||
|
|
|
|||
2
util/cache/inmemory.go
vendored
2
util/cache/inmemory.go
vendored
|
|
@ -20,7 +20,7 @@ func init() {
|
|||
gob.Register([]interface{}{})
|
||||
}
|
||||
|
||||
// compile-time validation of adherance of the CacheClient contract
|
||||
// compile-time validation of adherence of the CacheClient contract
|
||||
var _ CacheClient = &InMemoryCache{}
|
||||
|
||||
type InMemoryCache struct {
|
||||
|
|
|
|||
2
util/cache/redis.go
vendored
2
util/cache/redis.go
vendored
|
|
@ -42,7 +42,7 @@ func NewRedisCache(client *redis.Client, expiration time.Duration, compressionTy
|
|||
}
|
||||
}
|
||||
|
||||
// compile-time validation of adherance of the CacheClient contract
|
||||
// compile-time validation of adherence of the CacheClient contract
|
||||
var _ CacheClient = &redisCache{}
|
||||
|
||||
type redisCache struct {
|
||||
|
|
|
|||
6
util/env/env.go
vendored
6
util/env/env.go
vendored
|
|
@ -168,7 +168,7 @@ func StringFromEnv(env string, defaultValue string, opts ...StringFromEnvOpts) s
|
|||
}
|
||||
|
||||
// StringsFromEnv parses given value from the environment as a list of strings,
|
||||
// using seperator as the delimeter, and returns them as a slice. The strings
|
||||
// using separator as the delimeter, and returns them as a slice. The strings
|
||||
// in the returned slice will have leading and trailing white space removed.
|
||||
func StringsFromEnv(env string, defaultValue []string, separator string) []string {
|
||||
if str := os.Getenv(env); str != "" {
|
||||
|
|
@ -198,7 +198,7 @@ func ParseBoolFromEnv(envVar string, defaultValue bool) bool {
|
|||
|
||||
// ParseStringToStringVar parses given value from the environment as a map of string.
|
||||
// Returns default value if envVar is not set.
|
||||
func ParseStringToStringFromEnv(envVar string, defaultValue map[string]string, seperator string) map[string]string {
|
||||
func ParseStringToStringFromEnv(envVar string, defaultValue map[string]string, separator string) map[string]string {
|
||||
str := os.Getenv(envVar)
|
||||
str = strings.TrimSpace(str)
|
||||
if str == "" {
|
||||
|
|
@ -206,7 +206,7 @@ func ParseStringToStringFromEnv(envVar string, defaultValue map[string]string, s
|
|||
}
|
||||
|
||||
parsed := make(map[string]string)
|
||||
for _, pair := range strings.Split(str, seperator) {
|
||||
for _, pair := range strings.Split(str, separator) {
|
||||
keyvalue := strings.Split(pair, "=")
|
||||
if len(keyvalue) != 2 {
|
||||
log.Warnf("Invalid key-value pair when parsing environment '%s' as a string map", str)
|
||||
|
|
|
|||
2
util/env/env_test.go
vendored
2
util/env/env_test.go
vendored
|
|
@ -238,7 +238,7 @@ func TestParseStringToStringFromEnv(t *testing.T) {
|
|||
{"success, two keys, no value", "key1=,key2=", map[string]string{"key1": "", "key2": ""}, def, ","},
|
||||
{"success, two keys, no value, with spaces", "key1 = , key2 = ", map[string]string{"key1": "", "key2": ""}, def, ","},
|
||||
{"success, two pairs", "key1=value1,key2=value2", map[string]string{"key1": "value1", "key2": "value2"}, def, ","},
|
||||
{"success, two pairs with semicolon as seperator", "key1=value1;key2=value2", map[string]string{"key1": "value1", "key2": "value2"}, def, ";"},
|
||||
{"success, two pairs with semicolon as separator", "key1=value1;key2=value2", map[string]string{"key1": "value1", "key2": "value2"}, def, ";"},
|
||||
{"success, two pairs with spaces", "key1 = value1, key2 = value2", map[string]string{"key1": "value1", "key2": "value2"}, def, ","},
|
||||
{"failure, one key", "key1", map[string]string{}, def, ","},
|
||||
{"failure, duplicate keys", "key1=value1,key1=value2", map[string]string{}, def, ","},
|
||||
|
|
|
|||
|
|
@ -674,7 +674,7 @@ func ParseGitCommitVerification(signature string) PGPVerifyResult {
|
|||
}
|
||||
|
||||
if parseOk && linesParsed < MaxVerificationLinesToParse {
|
||||
// Operation successfull - return result
|
||||
// Operation successful - return result
|
||||
return result
|
||||
} else if linesParsed >= MaxVerificationLinesToParse {
|
||||
// Too many output lines, return error
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ func TestUntgz(t *testing.T) {
|
|||
assert.Contains(t, names, "applicationset/readme-symlink")
|
||||
assert.Equal(t, filepath.Join(destDir, "README.md"), names["applicationset/readme-symlink"])
|
||||
})
|
||||
t.Run("will protect agains symlink exploit", func(t *testing.T) {
|
||||
t.Run("will protect against symlink exploit", func(t *testing.T) {
|
||||
// given
|
||||
tmpDir := createTmpDir(t)
|
||||
defer deleteTmpDir(t, tmpDir)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func resolveSymbolicLinkRecursive(path string, maxDepth int) (string, error) {
|
|||
if ok {
|
||||
return path, nil
|
||||
}
|
||||
// Other error has occured
|
||||
// Other error has occurred
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ func CreateServerTLSConfig(tlsCertPath, tlsKeyPath string, hosts []string) (*tls
|
|||
log.Infof("Loading TLS configuration from cert=%s and key=%s", tlsCertPath, tlsKeyPath)
|
||||
c, err := tls.LoadX509KeyPair(tlsCertPath, tlsKeyPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to initalize TLS configuration with cert=%s and key=%s: %v", tlsCertPath, tlsKeyPath, err)
|
||||
return nil, fmt.Errorf("Unable to initialize TLS configuration with cert=%s and key=%s: %v", tlsCertPath, tlsKeyPath, err)
|
||||
}
|
||||
cert = &c
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue