mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-03-05 16:08:49 +01:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7be094f38d | ||
|
|
db2869c866 | ||
|
|
2b6d55bfe5 | ||
|
|
e81ddb0855 | ||
|
|
8dcdbb588d | ||
|
|
1e7aab19aa | ||
|
|
ec6e05afca | ||
|
|
09ea76364c | ||
|
|
b795fcad3d | ||
|
|
896b143866 | ||
|
|
10051833a5 | ||
|
|
705ca3c95a | ||
|
|
fca7f58a93 | ||
|
|
85d1c0fac7 | ||
|
|
bb7ec0ff32 | ||
|
|
57f6703d08 | ||
|
|
f016977b5d |
14
.github/workflows/ci-build.yaml
vendored
14
.github/workflows/ci-build.yaml
vendored
@@ -51,7 +51,7 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ env.GOLANG_VERSION }}
|
||||
- name: Restore go build cache
|
||||
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
|
||||
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
|
||||
with:
|
||||
path: ~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
run: |
|
||||
echo "/usr/local/bin" >> $GITHUB_PATH
|
||||
- name: Restore go build cache
|
||||
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
|
||||
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
|
||||
with:
|
||||
path: ~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
|
||||
@@ -183,7 +183,7 @@ jobs:
|
||||
run: |
|
||||
echo "/usr/local/bin" >> $GITHUB_PATH
|
||||
- name: Restore go build cache
|
||||
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
|
||||
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
|
||||
with:
|
||||
path: ~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
|
||||
@@ -269,7 +269,7 @@ jobs:
|
||||
node-version: '12.18.4'
|
||||
- name: Restore node dependency cache
|
||||
id: cache-dependencies
|
||||
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
|
||||
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
|
||||
with:
|
||||
path: ui/node_modules
|
||||
key: ${{ runner.os }}-node-dep-v2-${{ hashFiles('**/yarn.lock') }}
|
||||
@@ -304,7 +304,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- name: Restore node dependency cache
|
||||
id: cache-dependencies
|
||||
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
|
||||
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
|
||||
with:
|
||||
path: ui/node_modules
|
||||
key: ${{ runner.os }}-node-dep-v2-${{ hashFiles('**/yarn.lock') }}
|
||||
@@ -398,7 +398,7 @@ jobs:
|
||||
sudo chown runner $HOME/.kube/config
|
||||
kubectl version
|
||||
- name: Restore go build cache
|
||||
uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
|
||||
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
|
||||
with:
|
||||
path: ~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
|
||||
@@ -426,7 +426,7 @@ jobs:
|
||||
run: |
|
||||
docker pull ghcr.io/dexidp/dex:v2.35.3
|
||||
docker pull argoproj/argo-cd-ci-builder:v1.0.0
|
||||
docker pull redis:7.0.7-alpine
|
||||
docker pull redis:7.0.8-alpine
|
||||
- name: Create target directory for binaries in the build-process
|
||||
run: |
|
||||
mkdir -p dist
|
||||
|
||||
2
.github/workflows/image.yaml
vendored
2
.github/workflows/image.yaml
vendored
@@ -69,7 +69,7 @@ jobs:
|
||||
|
||||
# sign container images
|
||||
- name: Install cosign
|
||||
uses: sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b # v2.8.1
|
||||
uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v3.0.1
|
||||
with:
|
||||
cosign-release: 'v1.13.1'
|
||||
|
||||
|
||||
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -219,7 +219,7 @@ jobs:
|
||||
if: ${{ env.DRY_RUN != 'true' }}
|
||||
|
||||
- name: Install cosign
|
||||
uses: sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b # v2.8.1
|
||||
uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v3.0.1
|
||||
with:
|
||||
cosign-release: 'v1.13.1'
|
||||
|
||||
|
||||
1
USERS.md
1
USERS.md
@@ -107,6 +107,7 @@ Currently, the following organizations are **officially** using Argo CD:
|
||||
1. [imaware](https://imaware.health)
|
||||
1. [Indeed](https://indeed.com)
|
||||
1. [Index Exchange](https://www.indexexchange.com/)
|
||||
1. [Info Support](https://www.infosupport.com/)
|
||||
1. [InsideBoard](https://www.insideboard.com)
|
||||
1. [Intuit](https://www.intuit.com/)
|
||||
1. [Joblift](https://joblift.com/)
|
||||
|
||||
17
controller/cache/cache.go
vendored
17
controller/cache/cache.go
vendored
@@ -25,6 +25,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
|
||||
"github.com/argoproj/argo-cd/v2/controller/metrics"
|
||||
@@ -394,6 +395,20 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e
|
||||
return nil, fmt.Errorf("error getting custom label: %w", err)
|
||||
}
|
||||
|
||||
clusterCacheConfig := cluster.RESTConfig()
|
||||
// Controller dynamically fetches all resource types available on the cluster
|
||||
// using a discovery API that may contain deprecated APIs.
|
||||
// This causes log flooding when managing a large number of clusters.
|
||||
// https://github.com/argoproj/argo-cd/issues/11973
|
||||
// However, we can safely suppress deprecation warnings
|
||||
// because we do not rely on resources with a particular API group or version.
|
||||
// https://kubernetes.io/blog/2020/09/03/warnings/#customize-client-handling
|
||||
//
|
||||
// Completely suppress warning logs only for log levels that are less than Debug.
|
||||
if log.GetLevel() < log.DebugLevel {
|
||||
clusterCacheConfig.WarningHandler = rest.NoWarnings{}
|
||||
}
|
||||
|
||||
clusterCacheOpts := []clustercache.UpdateSettingsFunc{
|
||||
clustercache.SetListSemaphore(semaphore.NewWeighted(clusterCacheListSemaphoreSize)),
|
||||
clustercache.SetListPageSize(clusterCacheListPageSize),
|
||||
@@ -425,7 +440,7 @@ func (c *liveStateCache) getCluster(server string) (clustercache.ClusterCache, e
|
||||
clustercache.SetRetryOptions(clusterCacheAttemptLimit, clusterCacheRetryUseBackoff, isRetryableError),
|
||||
}
|
||||
|
||||
clusterCache = clustercache.NewClusterCache(cluster.RESTConfig(), clusterCacheOpts...)
|
||||
clusterCache = clustercache.NewClusterCache(clusterCacheConfig, clusterCacheOpts...)
|
||||
|
||||
_ = clusterCache.OnResourceUpdated(func(newRes *clustercache.Resource, oldRes *clustercache.Resource, namespaceResources map[kube.ResourceKey]*clustercache.Resource) {
|
||||
toNotify := make(map[string]bool)
|
||||
|
||||
@@ -81,7 +81,7 @@ in your Argo CD installation namespace. You can simply retrieve this password
|
||||
using the `argocd` CLI:
|
||||
|
||||
```bash
|
||||
argocd admin initial-password
|
||||
argocd admin initial-password -n argocd
|
||||
```
|
||||
|
||||
!!! warning
|
||||
|
||||
@@ -114,9 +114,7 @@ spec:
|
||||
|
||||
# plugin specific config
|
||||
plugin:
|
||||
# NOTE: this field is deprecated in v2.5 and must be removed to use sidecar-based plugins.
|
||||
# Only set the plugin name if the plugin is defined in argocd-cm.
|
||||
# If the plugin is defined as a sidecar, omit the name. The plugin will be automatically matched with the
|
||||
# If the plugin is defined as a sidecar and name is not passed, the plugin will be automatically matched with the
|
||||
# Application according to the plugin's discovery rules.
|
||||
name: mypluginname
|
||||
# environment variables passed to the plugin
|
||||
|
||||
@@ -110,7 +110,7 @@ spec:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: '{{path.basename}}'
|
||||
```
|
||||
(*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/examples/applicationset/git-generator-directory/excludes).*)
|
||||
(*The full example can be found [here](https://github.com/argoproj/argo-cd/tree/master/applicationset/examples/git-generator-directory/excludes).*)
|
||||
|
||||
This example excludes the `exclude-helm-guestbook` directory from the list of directories scanned for this `ApplicationSet` resource.
|
||||
|
||||
|
||||
@@ -114,12 +114,13 @@ In order to prevent duplication of the custom health check for potentially multi
|
||||
|
||||
```yaml
|
||||
resource.customizations: |
|
||||
*.aws.crossplane.io/*:
|
||||
"*.aws.crossplane.io/*":
|
||||
health.lua: |
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
!!!important
|
||||
Please note the required quotes in the resource customization health section, if the wildcard starts with `*`.
|
||||
|
||||
The `obj` is a global variable which contains the resource. The script must return an object with status and optional message field.
|
||||
The custom health check might return one of the following health statuses:
|
||||
|
||||
@@ -4,7 +4,7 @@ Argo CD is largely stateless, all data is persisted as Kubernetes objects, which
|
||||
|
||||
A set of HA manifests are provided for users who wish to run Argo CD in a highly available manner. This runs more containers, and runs Redis in HA mode.
|
||||
|
||||
[Manifests ⧉](https://github.com/argoproj/argo-cd/tree/master/manifests)
|
||||
[HA Manifests ⧉](https://github.com/argoproj/argo-cd/tree/master/manifests#high-availability)
|
||||
|
||||
> **NOTE:** The HA installation will require at least three different nodes due to pod anti-affinity roles in the
|
||||
> specs. Additionally, IPv6 only clusters are not supported.
|
||||
@@ -188,4 +188,4 @@ spec:
|
||||
targetRevision: HEAD
|
||||
path: my-application
|
||||
# ...
|
||||
```
|
||||
```
|
||||
|
||||
@@ -74,7 +74,7 @@ kind: Kustomization
|
||||
|
||||
namespace: argocd
|
||||
resources:
|
||||
- https://raw.githubusercontent.com/argoproj/argo-cd/v2.0.4/manifests/ha/install.yaml
|
||||
- github.com/argoproj/argo-cd/manifests/ha?ref=v2.6.2
|
||||
```
|
||||
|
||||
## Helm
|
||||
|
||||
@@ -24,9 +24,10 @@ argocd app delete APPNAME
|
||||
|
||||
# Deletion Using `kubectl`
|
||||
|
||||
To perform a non-cascade delete:
|
||||
To perform a non-cascade delete, make sure the finalizer is unset and then delete the app:
|
||||
|
||||
```bash
|
||||
kubectl patch app APPNAME -p '{"metadata": {"finalizers": null}}' --type merge
|
||||
kubectl delete app APPNAME
|
||||
```
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ kind: Kustomization
|
||||
images:
|
||||
- name: quay.io/argoproj/argocd
|
||||
newName: quay.io/argoproj/argocd
|
||||
newTag: v2.6.3
|
||||
newTag: v2.6.4
|
||||
resources:
|
||||
- ./application-controller
|
||||
- ./dex
|
||||
|
||||
@@ -23,7 +23,7 @@ spec:
|
||||
serviceAccountName: argocd-redis
|
||||
containers:
|
||||
- name: redis
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: Always
|
||||
args:
|
||||
- "--save"
|
||||
|
||||
@@ -15557,7 +15557,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.progressive.syncs
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -15639,7 +15639,7 @@ spec:
|
||||
- ""
|
||||
- --appendonly
|
||||
- "no"
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: Always
|
||||
name: redis
|
||||
ports:
|
||||
@@ -15821,7 +15821,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -15873,7 +15873,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -16080,7 +16080,7 @@ spec:
|
||||
key: application.namespaces
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
|
||||
@@ -12,4 +12,4 @@ resources:
|
||||
images:
|
||||
- name: quay.io/argoproj/argocd
|
||||
newName: quay.io/argoproj/argocd
|
||||
newTag: v2.6.3
|
||||
newTag: v2.6.4
|
||||
|
||||
@@ -11,7 +11,7 @@ patchesStrategicMerge:
|
||||
images:
|
||||
- name: quay.io/argoproj/argocd
|
||||
newName: quay.io/argoproj/argocd
|
||||
newTag: v2.6.3
|
||||
newTag: v2.6.4
|
||||
resources:
|
||||
- ../../base/application-controller
|
||||
- ../../base/applicationset-controller
|
||||
|
||||
@@ -1071,7 +1071,7 @@ spec:
|
||||
topologyKey: kubernetes.io/hostname
|
||||
initContainers:
|
||||
- name: config-init
|
||||
image: haproxy:2.6.2-alpine
|
||||
image: haproxy:2.6.9-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
resources:
|
||||
{}
|
||||
@@ -1089,7 +1089,7 @@ spec:
|
||||
mountPath: /data
|
||||
containers:
|
||||
- name: haproxy
|
||||
image: haproxy:2.6.2-alpine
|
||||
image: haproxy:2.6.9-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
securityContext:
|
||||
null
|
||||
@@ -1179,7 +1179,7 @@ spec:
|
||||
automountServiceAccountToken: false
|
||||
initContainers:
|
||||
- name: config-init
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
resources:
|
||||
{}
|
||||
@@ -1206,7 +1206,7 @@ spec:
|
||||
|
||||
containers:
|
||||
- name: redis
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- redis-server
|
||||
@@ -1256,7 +1256,7 @@ spec:
|
||||
- /bin/sh
|
||||
- /readonly-config/trigger-failover-if-master.sh
|
||||
- name: sentinel
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- redis-sentinel
|
||||
@@ -1300,7 +1300,7 @@ spec:
|
||||
{}
|
||||
|
||||
- name: split-brain-fix
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- sh
|
||||
|
||||
@@ -11,14 +11,14 @@ redis-ha:
|
||||
IPv6:
|
||||
enabled: false
|
||||
image:
|
||||
tag: 2.6.2-alpine
|
||||
tag: 2.6.9-alpine
|
||||
containerSecurityContext: null
|
||||
timeout:
|
||||
server: 6m
|
||||
client: 6m
|
||||
checkInterval: 3s
|
||||
image:
|
||||
tag: 7.0.7-alpine
|
||||
tag: 7.0.8-alpine
|
||||
containerSecurityContext: null
|
||||
sentinel:
|
||||
bind: "0.0.0.0"
|
||||
|
||||
@@ -16758,7 +16758,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.progressive.syncs
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -16868,7 +16868,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /shared/argocd-dex
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: copyutil
|
||||
securityContext:
|
||||
@@ -16921,7 +16921,7 @@ spec:
|
||||
containers:
|
||||
- command:
|
||||
- argocd-notifications
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
@@ -16992,7 +16992,7 @@ spec:
|
||||
app.kubernetes.io/name: argocd-redis-ha-haproxy
|
||||
topologyKey: kubernetes.io/hostname
|
||||
containers:
|
||||
- image: haproxy:2.6.2-alpine
|
||||
- image: haproxy:2.6.9-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
lifecycle: {}
|
||||
livenessProbe:
|
||||
@@ -17028,7 +17028,7 @@ spec:
|
||||
- /readonly/haproxy_init.sh
|
||||
command:
|
||||
- sh
|
||||
image: haproxy:2.6.2-alpine
|
||||
image: haproxy:2.6.9-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: config-init
|
||||
securityContext:
|
||||
@@ -17224,7 +17224,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -17276,7 +17276,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -17555,7 +17555,7 @@ spec:
|
||||
key: server.enable.proxy.extension
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
@@ -17791,7 +17791,7 @@ spec:
|
||||
key: application.namespaces
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
@@ -17868,7 +17868,7 @@ spec:
|
||||
- /data/conf/redis.conf
|
||||
command:
|
||||
- redis-server
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
lifecycle:
|
||||
preStop:
|
||||
@@ -17921,7 +17921,7 @@ spec:
|
||||
- /data/conf/sentinel.conf
|
||||
command:
|
||||
- redis-sentinel
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
lifecycle: {}
|
||||
livenessProbe:
|
||||
@@ -17973,7 +17973,7 @@ spec:
|
||||
value: 40000915ab58c3fa8fd888fb8b24711944e6cbb4
|
||||
- name: SENTINEL_ID_2
|
||||
value: 2bbec7894d954a8af3bb54d13eaec53cb024e2ca
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: split-brain-fix
|
||||
resources: {}
|
||||
@@ -18002,7 +18002,7 @@ spec:
|
||||
value: 40000915ab58c3fa8fd888fb8b24711944e6cbb4
|
||||
- name: SENTINEL_ID_2
|
||||
value: 2bbec7894d954a8af3bb54d13eaec53cb024e2ca
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: config-init
|
||||
securityContext:
|
||||
|
||||
@@ -1562,7 +1562,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.progressive.syncs
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -1672,7 +1672,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /shared/argocd-dex
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: copyutil
|
||||
securityContext:
|
||||
@@ -1725,7 +1725,7 @@ spec:
|
||||
containers:
|
||||
- command:
|
||||
- argocd-notifications
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
@@ -1796,7 +1796,7 @@ spec:
|
||||
app.kubernetes.io/name: argocd-redis-ha-haproxy
|
||||
topologyKey: kubernetes.io/hostname
|
||||
containers:
|
||||
- image: haproxy:2.6.2-alpine
|
||||
- image: haproxy:2.6.9-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
lifecycle: {}
|
||||
livenessProbe:
|
||||
@@ -1832,7 +1832,7 @@ spec:
|
||||
- /readonly/haproxy_init.sh
|
||||
command:
|
||||
- sh
|
||||
image: haproxy:2.6.2-alpine
|
||||
image: haproxy:2.6.9-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: config-init
|
||||
securityContext:
|
||||
@@ -2028,7 +2028,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -2080,7 +2080,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -2359,7 +2359,7 @@ spec:
|
||||
key: server.enable.proxy.extension
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
@@ -2595,7 +2595,7 @@ spec:
|
||||
key: application.namespaces
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
@@ -2672,7 +2672,7 @@ spec:
|
||||
- /data/conf/redis.conf
|
||||
command:
|
||||
- redis-server
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
lifecycle:
|
||||
preStop:
|
||||
@@ -2725,7 +2725,7 @@ spec:
|
||||
- /data/conf/sentinel.conf
|
||||
command:
|
||||
- redis-sentinel
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
lifecycle: {}
|
||||
livenessProbe:
|
||||
@@ -2777,7 +2777,7 @@ spec:
|
||||
value: 40000915ab58c3fa8fd888fb8b24711944e6cbb4
|
||||
- name: SENTINEL_ID_2
|
||||
value: 2bbec7894d954a8af3bb54d13eaec53cb024e2ca
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: split-brain-fix
|
||||
resources: {}
|
||||
@@ -2806,7 +2806,7 @@ spec:
|
||||
value: 40000915ab58c3fa8fd888fb8b24711944e6cbb4
|
||||
- name: SENTINEL_ID_2
|
||||
value: 2bbec7894d954a8af3bb54d13eaec53cb024e2ca
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: config-init
|
||||
securityContext:
|
||||
|
||||
@@ -15877,7 +15877,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.progressive.syncs
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -15987,7 +15987,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /shared/argocd-dex
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: copyutil
|
||||
securityContext:
|
||||
@@ -16040,7 +16040,7 @@ spec:
|
||||
containers:
|
||||
- command:
|
||||
- argocd-notifications
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
@@ -16117,7 +16117,7 @@ spec:
|
||||
- ""
|
||||
- --appendonly
|
||||
- "no"
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: Always
|
||||
name: redis
|
||||
ports:
|
||||
@@ -16299,7 +16299,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -16351,7 +16351,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -16626,7 +16626,7 @@ spec:
|
||||
key: server.enable.proxy.extension
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
@@ -16860,7 +16860,7 @@ spec:
|
||||
key: application.namespaces
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
|
||||
@@ -681,7 +681,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.progressive.syncs
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -791,7 +791,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /shared/argocd-dex
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: copyutil
|
||||
securityContext:
|
||||
@@ -844,7 +844,7 @@ spec:
|
||||
containers:
|
||||
- command:
|
||||
- argocd-notifications
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
@@ -921,7 +921,7 @@ spec:
|
||||
- ""
|
||||
- --appendonly
|
||||
- "no"
|
||||
image: redis:7.0.7-alpine
|
||||
image: redis:7.0.8-alpine
|
||||
imagePullPolicy: Always
|
||||
name: redis
|
||||
ports:
|
||||
@@ -1103,7 +1103,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -1155,7 +1155,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -1430,7 +1430,7 @@ spec:
|
||||
key: server.enable.proxy.extension
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
@@ -1664,7 +1664,7 @@ spec:
|
||||
key: application.namespaces
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:v2.6.3
|
||||
image: quay.io/argoproj/argocd:v2.6.4
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
|
||||
@@ -202,7 +202,7 @@ func (repo *Repository) GetGitCreds(store git.CredsStore) git.Creds {
|
||||
return git.NewGitHubAppCreds(repo.GithubAppId, repo.GithubAppInstallationId, repo.GithubAppPrivateKey, repo.GitHubAppEnterpriseBaseURL, repo.Repo, repo.TLSClientCertData, repo.TLSClientCertKey, repo.IsInsecure(), repo.Proxy, store)
|
||||
}
|
||||
if repo.GCPServiceAccountKey != "" {
|
||||
return git.NewGoogleCloudCreds(repo.GCPServiceAccountKey)
|
||||
return git.NewGoogleCloudCreds(repo.GCPServiceAccountKey, store)
|
||||
}
|
||||
return git.NopCreds{}
|
||||
}
|
||||
|
||||
@@ -469,8 +469,9 @@ func (a *ArgoCDServer) Run(ctx context.Context, listeners *Listeners) {
|
||||
|
||||
// If not matched, we assume that its TLS.
|
||||
tlsl := tcpm.Match(cmux.Any())
|
||||
tlsConfig := tls.Config{
|
||||
Certificates: []tls.Certificate{*a.settings.Certificate},
|
||||
tlsConfig := tls.Config{}
|
||||
tlsConfig.GetCertificate = func(info *tls.ClientHelloInfo) (*tls.Certificate, error) {
|
||||
return a.settings.Certificate, nil
|
||||
}
|
||||
if a.TLSConfigCustomizer != nil {
|
||||
a.TLSConfigCustomizer(&tlsConfig)
|
||||
@@ -613,8 +614,8 @@ func (a *ArgoCDServer) watchSettings() {
|
||||
newCert, newCertKey = tlsutil.EncodeX509KeyPairString(*a.settings.Certificate)
|
||||
}
|
||||
if newCert != prevCert || newCertKey != prevCertKey {
|
||||
log.Infof("tls certificate modified. restarting")
|
||||
break
|
||||
log.Infof("tls certificate modified. reloading certificate")
|
||||
// No need to break out of this loop since TlsConfig.GetCertificate will automagically reload the cert.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM docker.io/library/redis:7.0.5 as redis
|
||||
FROM docker.io/library/redis:7.0.8-alpine as redis
|
||||
|
||||
# There are libraries we will want to copy from here in the final stage of the
|
||||
# build, but the COPY directive does not have a way to determine system
|
||||
|
||||
@@ -69,11 +69,13 @@ export const Banner = (props: React.Props<any>) => {
|
||||
chatBottomPosition = 85;
|
||||
}
|
||||
}
|
||||
try {
|
||||
const externalLink = new ExternalLink(chatUrl);
|
||||
chatUrl = externalLink.ref;
|
||||
} catch (InvalidExternalLinkError) {
|
||||
chatUrl = 'invalid-url';
|
||||
if (chatUrl) {
|
||||
try {
|
||||
const externalLink = new ExternalLink(chatUrl);
|
||||
chatUrl = externalLink.ref;
|
||||
} catch (InvalidExternalLinkError) {
|
||||
chatUrl = 'invalid-url';
|
||||
}
|
||||
}
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
||||
@@ -456,15 +456,16 @@ func (g GitHubAppCreds) GetClientCertKey() string {
|
||||
// GoogleCloudCreds to authenticate to Google Cloud Source repositories
|
||||
type GoogleCloudCreds struct {
|
||||
creds *google.Credentials
|
||||
store CredsStore
|
||||
}
|
||||
|
||||
func NewGoogleCloudCreds(jsonData string) GoogleCloudCreds {
|
||||
func NewGoogleCloudCreds(jsonData string, store CredsStore) GoogleCloudCreds {
|
||||
creds, err := google.CredentialsFromJSON(context.Background(), []byte(jsonData), "https://www.googleapis.com/auth/cloud-platform")
|
||||
if err != nil {
|
||||
// Invalid JSON
|
||||
log.Errorf("Failed reading credentials from JSON: %+v", err)
|
||||
}
|
||||
return GoogleCloudCreds{creds}
|
||||
return GoogleCloudCreds{creds, store}
|
||||
}
|
||||
|
||||
func (c GoogleCloudCreds) Environ() (io.Closer, []string, error) {
|
||||
@@ -477,9 +478,13 @@ func (c GoogleCloudCreds) Environ() (io.Closer, []string, error) {
|
||||
return NopCloser{}, nil, fmt.Errorf("failed to get access token from creds: %w", err)
|
||||
}
|
||||
|
||||
env := []string{fmt.Sprintf("GIT_ASKPASS=%s", "git-ask-pass.sh"), fmt.Sprintf("GIT_USERNAME=%s", username), fmt.Sprintf("GIT_PASSWORD=%s", token)}
|
||||
nonce := c.store.Add(username, token)
|
||||
env := getGitAskPassEnv(nonce)
|
||||
|
||||
return NopCloser{}, env, nil
|
||||
return argoioutils.NewCloser(func() error {
|
||||
c.store.Remove(nonce)
|
||||
return NopCloser{}.Close()
|
||||
}), env, nil
|
||||
}
|
||||
|
||||
func (c GoogleCloudCreds) getUsername() (string, error) {
|
||||
|
||||
@@ -12,11 +12,11 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/google"
|
||||
|
||||
"github.com/argoproj/argo-cd/v2/util/cert"
|
||||
"github.com/argoproj/argo-cd/v2/util/io"
|
||||
"golang.org/x/oauth2"
|
||||
"golang.org/x/oauth2/google"
|
||||
)
|
||||
|
||||
type cred struct {
|
||||
@@ -251,12 +251,14 @@ const invalidJSON = `{
|
||||
`
|
||||
|
||||
func TestNewGoogleCloudCreds(t *testing.T) {
|
||||
googleCloudCreds := NewGoogleCloudCreds(gcpServiceAccountKeyJSON)
|
||||
store := &memoryCredsStore{creds: make(map[string]cred)}
|
||||
googleCloudCreds := NewGoogleCloudCreds(gcpServiceAccountKeyJSON, store)
|
||||
assert.NotNil(t, googleCloudCreds)
|
||||
}
|
||||
|
||||
func TestNewGoogleCloudCreds_invalidJSON(t *testing.T) {
|
||||
googleCloudCreds := NewGoogleCloudCreds(invalidJSON)
|
||||
store := &memoryCredsStore{creds: make(map[string]cred)}
|
||||
googleCloudCreds := NewGoogleCloudCreds(invalidJSON, store)
|
||||
assert.Nil(t, googleCloudCreds.creds)
|
||||
|
||||
token, err := googleCloudCreds.getAccessToken()
|
||||
@@ -273,17 +275,25 @@ func TestNewGoogleCloudCreds_invalidJSON(t *testing.T) {
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestGoogleCloudCreds_Environ(t *testing.T) {
|
||||
func TestGoogleCloudCreds_Environ_cleanup(t *testing.T) {
|
||||
store := &memoryCredsStore{creds: make(map[string]cred)}
|
||||
staticToken := &oauth2.Token{AccessToken: "token"}
|
||||
googleCloudCreds := GoogleCloudCreds{&google.Credentials{
|
||||
ProjectID: "my-google-project",
|
||||
TokenSource: oauth2.StaticTokenSource(staticToken),
|
||||
JSON: []byte(gcpServiceAccountKeyJSON),
|
||||
}}
|
||||
}, store}
|
||||
|
||||
closer, env, err := googleCloudCreds.Environ()
|
||||
assert.NoError(t, err)
|
||||
defer func() { _ = closer.Close() }()
|
||||
|
||||
assert.Equal(t, []string{"GIT_ASKPASS=git-ask-pass.sh", "GIT_USERNAME=argocd-service-account@my-google-project.iam.gserviceaccount.com", "GIT_PASSWORD=token"}, env)
|
||||
var nonce string
|
||||
for _, envVar := range env {
|
||||
if strings.HasPrefix(envVar, ASKPASS_NONCE_ENV) {
|
||||
nonce = envVar[len(ASKPASS_NONCE_ENV)+1:]
|
||||
break
|
||||
}
|
||||
}
|
||||
assert.Contains(t, store.creds, nonce)
|
||||
io.Close(closer)
|
||||
assert.NotContains(t, store.creds, nonce)
|
||||
}
|
||||
|
||||
@@ -35,6 +35,20 @@ metadata:
|
||||
resourceVersion: "123"
|
||||
`
|
||||
|
||||
const ec2AWSCrossplaneObjJson = `
|
||||
apiVersion: ec2.aws.crossplane.io/v1alpha1
|
||||
kind: Instance
|
||||
metadata:
|
||||
name: sample-crosspalne-ec2-instance
|
||||
spec:
|
||||
forProvider:
|
||||
region: us-west-2
|
||||
instanceType: t2.micro
|
||||
keyName: my-crossplane-key-pair
|
||||
providerConfigRef:
|
||||
name: awsconfig
|
||||
`
|
||||
|
||||
const newHealthStatusFunction = `a = {}
|
||||
a.status = "Healthy"
|
||||
a.message ="NeedsToBeChanged"
|
||||
@@ -43,6 +57,14 @@ if obj.metadata.name == "helm-guestbook" then
|
||||
end
|
||||
return a`
|
||||
|
||||
const newWildcardHealthStatusFunction = `a = {}
|
||||
a.status = "Healthy"
|
||||
a.message ="NeedsToBeChanged"
|
||||
if obj.metadata.name == "sample-crosspalne-ec2-instance" then
|
||||
a.message = "testWildcardMessage"
|
||||
end
|
||||
return a`
|
||||
|
||||
func StrToUnstructured(jsonStr string) *unstructured.Unstructured {
|
||||
obj := make(map[string]interface{})
|
||||
err := yaml.Unmarshal([]byte(jsonStr), &obj)
|
||||
@@ -65,6 +87,19 @@ func TestExecuteNewHealthStatusFunction(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func TestExecuteWildcardHealthStatusFunction(t *testing.T) {
|
||||
testObj := StrToUnstructured(ec2AWSCrossplaneObjJson)
|
||||
vm := VM{}
|
||||
status, err := vm.ExecuteHealthLua(testObj, newWildcardHealthStatusFunction)
|
||||
assert.Nil(t, err)
|
||||
expectedHealthStatus := &health.HealthStatus{
|
||||
Status: "Healthy",
|
||||
Message: "testWildcardMessage",
|
||||
}
|
||||
assert.Equal(t, expectedHealthStatus, status)
|
||||
|
||||
}
|
||||
|
||||
const osLuaScript = `os.getenv("HOME")`
|
||||
|
||||
func TestFailExternalLibCall(t *testing.T) {
|
||||
@@ -160,6 +195,23 @@ func TestGetHealthScriptWithGroupWildcardOverride(t *testing.T) {
|
||||
assert.Equal(t, newHealthStatusFunction, script)
|
||||
}
|
||||
|
||||
func TestGetHealthScriptWithGroupAndKindWildcardOverride(t *testing.T) {
|
||||
testObj := StrToUnstructured(ec2AWSCrossplaneObjJson)
|
||||
vm := VM{
|
||||
ResourceOverrides: map[string]appv1.ResourceOverride{
|
||||
"*.aws.crossplane.io/*": {
|
||||
HealthLua: newHealthStatusFunction,
|
||||
UseOpenLibs: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
script, useOpenLibs, err := vm.GetHealthScript(testObj)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, false, useOpenLibs)
|
||||
assert.Equal(t, newHealthStatusFunction, script)
|
||||
}
|
||||
|
||||
func TestGetHealthScriptPredefined(t *testing.T) {
|
||||
testObj := StrToUnstructured(objJSON)
|
||||
vm := VM{}
|
||||
@@ -434,6 +486,11 @@ end
|
||||
hs.status = "Healthy"
|
||||
return hs`
|
||||
|
||||
const healthWildcardOverrideScript = `
|
||||
hs = {}
|
||||
hs.status = "Healthy"
|
||||
return hs`
|
||||
|
||||
getHealthOverride := func(openLibs bool) ResourceHealthOverrides {
|
||||
return ResourceHealthOverrides{
|
||||
"ServiceAccount": appv1.ResourceOverride{
|
||||
@@ -443,6 +500,12 @@ return hs`
|
||||
}
|
||||
}
|
||||
|
||||
getWildcardHealthOverride := ResourceHealthOverrides{
|
||||
"*.aws.crossplane.io/*": appv1.ResourceOverride{
|
||||
HealthLua: healthWildcardOverrideScript,
|
||||
},
|
||||
}
|
||||
|
||||
t.Run("Enable Lua standard lib", func(t *testing.T) {
|
||||
testObj := StrToUnstructured(testSA)
|
||||
overrides := getHealthOverride(true)
|
||||
@@ -464,4 +527,23 @@ return hs`
|
||||
assert.EqualError(t, err, expectedErr)
|
||||
assert.Nil(t, status)
|
||||
})
|
||||
|
||||
t.Run("Get resource health for wildcard override", func(t *testing.T) {
|
||||
testObj := StrToUnstructured(ec2AWSCrossplaneObjJson)
|
||||
overrides := getWildcardHealthOverride
|
||||
status, err := overrides.GetResourceHealth(testObj)
|
||||
assert.Nil(t, err)
|
||||
expectedStatus := &health.HealthStatus{
|
||||
Status: health.HealthStatusHealthy,
|
||||
}
|
||||
assert.Equal(t, expectedStatus, status)
|
||||
})
|
||||
|
||||
t.Run("Resource health for wildcard override not found", func(t *testing.T) {
|
||||
testObj := StrToUnstructured(testSA)
|
||||
overrides := getWildcardHealthOverride
|
||||
status, err := overrides.GetResourceHealth(testObj)
|
||||
assert.Nil(t, err)
|
||||
assert.Nil(t, status)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -308,6 +308,24 @@ func TestGetResourceOverrides(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func TestGetResourceOverridesHealthWithWildcard(t *testing.T) {
|
||||
data := map[string]string{
|
||||
"resource.customizations": `
|
||||
"*.aws.crossplane.io/*":
|
||||
health.lua: |
|
||||
foo`,
|
||||
}
|
||||
|
||||
t.Run("TestResourceHealthOverrideWithWildcard", func(t *testing.T) {
|
||||
_, settingsManager := fixtures(data)
|
||||
|
||||
overrides, err := settingsManager.GetResourceOverrides()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 2, len(overrides))
|
||||
assert.Equal(t, "foo", overrides["*.aws.crossplane.io/*"].HealthLua)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSettingsManager_GetResourceOverrides_with_empty_string(t *testing.T) {
|
||||
_, settingsManager := fixtures(map[string]string{
|
||||
resourceCustomizationsKey: "",
|
||||
|
||||
Reference in New Issue
Block a user