Skip to content

Commit 5e6a122

Browse files
Merge branch 'argoproj:master' into master
2 parents a972604 + 988d760 commit 5e6a122

File tree

21 files changed

+285
-29
lines changed

21 files changed

+285
-29
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ serve-docs:
509509
.PHONY: lint-docs
510510
lint-docs:
511511
# https://github.com/dkhamsing/awesome_bot
512-
find docs -name '*.md' -exec grep -l http {} + | xargs docker run --rm -v $(PWD):/mnt:ro dkhamsing/awesome_bot -t 3 --allow-dupe --allow-redirect --white-list `cat docs/url-allow-list | grep -v "#" | tr "\n" ','` --skip-save-results --
512+
find docs -name '*.md' -exec grep -l http {} + | xargs docker run --rm -v $(PWD):/mnt:ro dkhamsing/awesome_bot -t 3 --allow-dupe --allow-redirect --allow-timeout --allow-ssl --allow 502,500,429,400 --white-list `cat docs/url-allow-list | grep -v "#" | tr "\n" ','` --skip-save-results --
513513

514514
# Verify that kubectl can connect to your K8s cluster from Docker
515515
.PHONY: verify-kube-connect

controller/appcontroller.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,19 @@ func (ctrl *ApplicationController) handleObjectUpdated(managedByApp map[string]b
319319
if isManagedResource {
320320
level = CompareWithRecent
321321
}
322+
323+
// Additional check for debug level so we don't need to evaluate the
324+
// format string in case of non-debug scenarios
325+
if log.GetLevel() >= log.DebugLevel {
326+
var resKey string
327+
if ref.Namespace != "" {
328+
resKey = ref.Namespace + "/" + ref.Name
329+
} else {
330+
resKey = "(cluster-scoped)/" + ref.Name
331+
}
332+
log.Debugf("Refreshing app %s for change in cluster of object %s of type %s/%s", appName, resKey, ref.APIVersion, ref.Kind)
333+
}
334+
322335
ctrl.requestAppRefresh(appName, &level, nil)
323336
}
324337
}

controller/cache/info.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,20 @@ func populateNodeInfo(un *unstructured.Unstructured, res *ResourceInfo) {
3030
switch gvk.Kind {
3131
case kube.PodKind:
3232
populatePodInfo(un, res)
33-
return
3433
case kube.ServiceKind:
3534
populateServiceInfo(un, res)
36-
return
3735
case "Node":
3836
populateHostNodeInfo(un, res)
39-
return
4037
}
4138
case "extensions", "networking.k8s.io":
4239
switch gvk.Kind {
4340
case kube.IngressKind:
4441
populateIngressInfo(un, res)
45-
return
4642
}
4743
case "networking.istio.io":
4844
switch gvk.Kind {
4945
case "VirtualService":
5046
populateIstioVirtualServiceInfo(un, res)
51-
return
5247
}
5348
}
5449

controller/cache/info_test.go

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,25 @@ var (
4343
ingress:
4444
- hostname: localhost`)
4545

46+
testLinkAnnotatedService = strToUnstructured(`
47+
apiVersion: v1
48+
kind: Service
49+
metadata:
50+
name: helm-guestbook
51+
namespace: default
52+
resourceVersion: "123"
53+
uid: "4"
54+
annotations:
55+
link.argocd.argoproj.io/external-link: http://my-grafana.com/pre-generated-link
56+
spec:
57+
selector:
58+
app: guestbook
59+
type: LoadBalancer
60+
status:
61+
loadBalancer:
62+
ingress:
63+
- hostname: localhost`)
64+
4665
testIngress = strToUnstructured(`
4766
apiVersion: extensions/v1beta1
4867
kind: Ingress
@@ -74,6 +93,39 @@ var (
7493
ingress:
7594
- ip: 107.178.210.11`)
7695

96+
testLinkAnnotatedIngress = strToUnstructured(`
97+
apiVersion: extensions/v1beta1
98+
kind: Ingress
99+
metadata:
100+
name: helm-guestbook
101+
namespace: default
102+
uid: "4"
103+
annotations:
104+
link.argocd.argoproj.io/external-link: http://my-grafana.com/ingress-link
105+
spec:
106+
backend:
107+
serviceName: not-found-service
108+
servicePort: 443
109+
rules:
110+
- host: helm-guestbook.com
111+
http:
112+
paths:
113+
- backend:
114+
serviceName: helm-guestbook
115+
servicePort: 443
116+
path: /
117+
- backend:
118+
serviceName: helm-guestbook
119+
servicePort: https
120+
path: /
121+
tls:
122+
- host: helm-guestbook.com
123+
secretName: my-tls-secret
124+
status:
125+
loadBalancer:
126+
ingress:
127+
- ip: 107.178.210.11`)
128+
77129
testIngressWildCardPath = strToUnstructured(`
78130
apiVersion: extensions/v1beta1
79131
kind: Ingress
@@ -268,6 +320,17 @@ func TestGetServiceInfo(t *testing.T) {
268320
}, info.NetworkingInfo)
269321
}
270322

323+
func TestGetLinkAnnotatedServiceInfo(t *testing.T) {
324+
info := &ResourceInfo{}
325+
populateNodeInfo(testLinkAnnotatedService, info)
326+
assert.Equal(t, 0, len(info.Info))
327+
assert.Equal(t, &v1alpha1.ResourceNetworkingInfo{
328+
TargetLabels: map[string]string{"app": "guestbook"},
329+
Ingress: []v1.LoadBalancerIngress{{Hostname: "localhost"}},
330+
ExternalURLs: []string{"http://my-grafana.com/pre-generated-link"},
331+
}, info.NetworkingInfo)
332+
}
333+
271334
func TestGetIstioVirtualServiceInfo(t *testing.T) {
272335
info := &ResourceInfo{}
273336
populateNodeInfo(testIstioVirtualService, info)
@@ -323,6 +386,30 @@ func TestGetIngressInfo(t *testing.T) {
323386
}
324387
}
325388

389+
func TestGetLinkAnnotatedIngressInfo(t *testing.T) {
390+
info := &ResourceInfo{}
391+
populateNodeInfo(testLinkAnnotatedIngress, info)
392+
assert.Equal(t, 0, len(info.Info))
393+
sort.Slice(info.NetworkingInfo.TargetRefs, func(i, j int) bool {
394+
return strings.Compare(info.NetworkingInfo.TargetRefs[j].Name, info.NetworkingInfo.TargetRefs[i].Name) < 0
395+
})
396+
assert.Equal(t, &v1alpha1.ResourceNetworkingInfo{
397+
Ingress: []v1.LoadBalancerIngress{{IP: "107.178.210.11"}},
398+
TargetRefs: []v1alpha1.ResourceRef{{
399+
Namespace: "default",
400+
Group: "",
401+
Kind: kube.ServiceKind,
402+
Name: "not-found-service",
403+
}, {
404+
Namespace: "default",
405+
Group: "",
406+
Kind: kube.ServiceKind,
407+
Name: "helm-guestbook",
408+
}},
409+
ExternalURLs: []string{"https://helm-guestbook.com/", "http://my-grafana.com/ingress-link"},
410+
}, info.NetworkingInfo)
411+
}
412+
326413
func TestGetIngressInfoWildCardPath(t *testing.T) {
327414
info := &ResourceInfo{}
328415
populateNodeInfo(testIngressWildCardPath, info)

docs/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ An example repository containing a guestbook application is available at
133133
Create the example guestbook application with the following command:
134134

135135
```bash
136-
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default`
136+
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default
137137
```
138138

139139
### Creating Apps Via UI

docs/operator-manual/high_availability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ and might fail. To avoid failed syncs use `ARGOCD_GIT_ATTEMPTS_COUNT` environmen
3232

3333
* `argocd-repo-server` Every 3m (by default) Argo CD checks for changes to the app manifests. Argo CD assumes by default that manifests only change when the repo changes, so it caches generated manifests (for 24h by default). With Kustomize remote bases, or Helm patch releases, the manifests can change even though the repo has not changed. By reducing the cache time, you can get the changes without waiting for 24h. Use `--repo-cache-expiration duration`, and we'd suggest in low volume environments you try '1h'. Bear in mind this will negate the benefit of caching if set too low.
3434

35-
* `argocd-repo-server` fork exec config management tools such as `helm` or `kustomize` and enforces 90 seconds timeout. The timeout can be increased using `ARGOCD_EXEC_TIMEOUT` env variable.
35+
* `argocd-repo-server` fork exec config management tools such as `helm` or `kustomize` and enforces 90 seconds timeout. The timeout can be increased using `ARGOCD_EXEC_TIMEOUT` env variable. The value should be in Go time duration string format, for example, `2m30s`.
3636

3737
**metrics:**
3838

docs/url-allow-list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ ghe.example.com
6767
github.com/yourghuser/argo-cd
6868
github.com/argoproj/argo-cd/releases/download/
6969
https://github.com/hayorov/helm-gcs.git;
70+
grafana.apps.argoproj.io

docs/user-guide/sync-options.md

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Sync Options
22

3+
ArgoCD allows users to customize some aspects of how it syncs the desired state in the target cluster. Some Sync Options can defined as annotations in a specific resource. Most of the Sync Options are configured in the Application resource `spec.syncPolicy.syncOptions` attribute.
4+
5+
Bellow you can find details about each available Sync Option:
6+
37
## No Prune Resources
48

59
>v1.1
@@ -71,8 +75,11 @@ You can add this option by following ways
7175
Example:
7276

7377
```yaml
74-
syncPolicy:
75-
syncOptions:
78+
apiVersion: argoproj.io/v1alpha1
79+
kind: Application
80+
spec:
81+
syncPolicy:
82+
syncOptions:
7683
- ApplyOutOfSyncOnly=true
7784
```
7885

@@ -91,8 +98,12 @@ using `PrunePropagationPolicy` sync option. Supported policies are background, f
9198
More information about those policies could be found [here](https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#controlling-how-the-garbage-collector-deletes-dependents).
9299

93100
```yaml
94-
syncOptions:
95-
- PrunePropagationPolicy=foreground
101+
apiVersion: argoproj.io/v1alpha1
102+
kind: Application
103+
spec:
104+
syncPolicy:
105+
syncOptions:
106+
- PrunePropagationPolicy=foreground
96107
```
97108

98109
## Prune Last
@@ -101,8 +112,12 @@ This feature is to allow the ability for resource pruning to happen as a final,
101112
after the other resources have been deployed and become healthy, and after all other waves completed successfully.
102113

103114
```yaml
104-
syncOptions:
105-
- PruneLast=true
115+
apiVersion: argoproj.io/v1alpha1
116+
kind: Application
117+
spec:
118+
syncPolicy:
119+
syncOptions:
120+
- PruneLast=true
106121
```
107122

108123
This can also be configured at individual resource level.
@@ -121,8 +136,12 @@ might use `Replace=true` sync option:
121136

122137

123138
```yaml
124-
syncOptions:
125-
- Replace=true
139+
apiVersion: argoproj.io/v1alpha1
140+
kind: Application
141+
spec:
142+
syncPolicy:
143+
syncOptions:
144+
- Replace=true
126145
```
127146

128147
If the `Replace=true` sync option is set the ArgoCD will use `kubectl replace` or `kubectl create` command to apply changes.
@@ -136,12 +155,35 @@ metadata:
136155

137156
## Fail the sync if a shared resource is found
138157

139-
By default, ArgoCD will apply all manifests found in the git path configured in the Application regardless if the resources
140-
defined in the yamls are already applied by another Application. If the `FailOnSharedResource` sync option is set, ArgoCD will
141-
fail the sync whenever it finds a resource in the current Application that is already applied in the cluster by another Application.
158+
By default, ArgoCD will apply all manifests found in the git path configured in the Application regardless if the resources defined in the yamls are already applied by another Application. If the `FailOnSharedResource` sync option is set, ArgoCD will fail the sync whenever it finds a resource in the current Application that is already applied in the cluster by another Application.
159+
160+
```yaml
161+
apiVersion: argoproj.io/v1alpha1
162+
kind: Application
163+
spec:
164+
syncPolicy:
165+
syncOptions:
166+
- FailOnSharedResource=true
167+
```
168+
169+
## Respect ignore difference configs
170+
171+
This sync option is used to enable ArgoCD to consider the configurations made in the `spec.ignoreDifferences` attribute also during the sync stage. By default, ArgoCD uses the `ignoreDifferences` config just for computing the diff between the live and desired state which defines if the application is synced or not. However during the sync stage, the desired state is applied as-is. The patch is calculated using a 3-way-merge between the live state the desired state and the `last-applied-configuration` annotation. This sometimes leads to an undesired results. This behavior can be changed by setting the `RespectIgnoreDifferences=true` sync option like in the example bellow:
142172

143173
```yaml
144-
syncOptions:
145-
- FailOnSharedResource=true
174+
apiVersion: argoproj.io/v1alpha1
175+
kind: Application
176+
spec:
177+
178+
ignoreDifferences:
179+
- group: "apps"
180+
kind: "Deployment"
181+
jsonPointers:
182+
- /spec/replicas
183+
184+
syncPolicy:
185+
syncOptions:
186+
- RespectIgnoreDifferences=true
146187
```
147188

189+
The example above shows how an ArgoCD Application can be configured so it will ignore the `spec.replicas` field from the desired state (git) during the sync stage. This is achieve by calculating and pre-patching the desired state before applying it in the cluster. Note that the `RespectIgnoreDifferences` sync option is only effective when the resource is already created in the cluster. If the Application is being created and no live state exists, the desired state is applied as-is.

pkg/apiclient/application/application.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resource_customizations/minio.min.io/Tenant/health.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ if obj.status ~= nil then
2121
health_status.message = obj.status.currentState
2222
return health_status
2323
end
24+
if obj.status.currentState == "Restarting MinIO" then
25+
health_status.status = "Progressing"
26+
health_status.message = obj.status.currentState
27+
return health_status
28+
end
2429
if obj.status.currentState == "Statefulset not controlled by operator" then
2530
health_status.status = "Degraded"
2631
health_status.message = obj.status.currentState

0 commit comments

Comments
 (0)