Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion integration-test/branch-12/target-1/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h1>Argo CD Diff Preview</h1>

<p>Summary:</p>
<pre>Modified (1):
± argocd-helm-chart (+2434|-62)</pre>
± argocd-helm-chart (+2437|-65)</pre>

<div class="diffs">
<details>
Expand Down Expand Up @@ -1016,6 +1016,35 @@ <h4 class="resource_header">StatefulSet: argocd/argocd-helm-chart-application-co
</table>
</div>

<h4 class="resource_header">ServiceMonitor: argocd/argocd-helm-chart-application-controller</h4>
<div class="diff_container">
<table>

<tr class="normal_line"><td><pre> app.kubernetes.io/part-of: argocd</pre></td></tr>
<tr class="removed_line"><td><pre>- app.kubernetes.io/version: v2.13.1</pre></td></tr>
<tr class="removed_line"><td><pre>- helm.sh/chart: argo-cd-7.7.7</pre></td></tr>
<tr class="added_line"><td><pre>+ app.kubernetes.io/version: v3.2.0</pre></td></tr>
<tr class="added_line"><td><pre>+ helm.sh/chart: argo-cd-9.1.4</pre></td></tr>
<tr class="normal_line"><td><pre> name: argocd-helm-chart-application-controller</pre></td></tr>
<tr class="normal_line"><td><pre> namespace: argocd</pre></td></tr>
<tr class="normal_line"><td><pre> spec:</pre></td></tr>
<tr class="normal_line"><td><pre> endpoints:</pre></td></tr>
<tr class="normal_line"><td><pre> - honorLabels: false</pre></td></tr>
<tr class="removed_line"><td><pre>- interval: 30s</pre></td></tr>
<tr class="added_line"><td><pre>+ interval: 15s</pre></td></tr>
<tr class="normal_line"><td><pre> path: /metrics</pre></td></tr>
<tr class="normal_line"><td><pre> port: http-metrics</pre></td></tr>
<tr class="normal_line"><td><pre> namespaceSelector:</pre></td></tr>
<tr class="normal_line"><td><pre> matchNames:</pre></td></tr>
<tr class="normal_line"><td><pre> - argocd</pre></td></tr>
<tr class="normal_line"><td><pre> selector:</pre></td></tr>
<tr class="normal_line"><td><pre> matchLabels:</pre></td></tr>
<tr class="normal_line"><td><pre> app.kubernetes.io/component: application-controller</pre></td></tr>
<tr class="normal_line"><td><pre> app.kubernetes.io/instance: argocd-helm-chart</pre></td></tr>
<tr class="normal_line"><td><pre> app.kubernetes.io/name: argocd-metrics</pre></td></tr>
</table>
</div>

<h4 class="resource_header">ClusterRole: argocd-helm-chart-server</h4>
<div class="diff_container">
<table>
Expand Down
40 changes: 27 additions & 13 deletions integration-test/branch-12/target-1/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Summary:
```yaml
Modified (1):
± argocd-helm-chart (+2434|-62)
± argocd-helm-chart (+2437|-65)
```

<details>
Expand Down Expand Up @@ -930,6 +930,31 @@ Modified (1):
path: ca.crt
optional: true
```
#### ServiceMonitor: argocd/argocd-helm-chart-application-controller
```diff
app.kubernetes.io/part-of: argocd
- app.kubernetes.io/version: v2.13.1
- helm.sh/chart: argo-cd-7.7.7
+ app.kubernetes.io/version: v3.2.0
+ helm.sh/chart: argo-cd-9.1.4
name: argocd-helm-chart-application-controller
namespace: argocd
spec:
endpoints:
- honorLabels: false
- interval: 30s
+ interval: 15s
path: /metrics
port: http-metrics
namespaceSelector:
matchNames:
- argocd
selector:
matchLabels:
app.kubernetes.io/component: application-controller
app.kubernetes.io/instance: argocd-helm-chart
app.kubernetes.io/name: argocd-metrics
```
#### ClusterRole: argocd-helm-chart-server
```diff
name: argocd-helm-chart-server
Expand Down Expand Up @@ -1621,18 +1646,7 @@ Modified (1):
description: Images is a list of Kustomize image override
specifications
items:
description: KustomizeImage represents a Kustomize image
definition in the format [old_image_name=]<image_name>:<image_tag>
type: string
type: array
kubeVersion:
description: |-
KubeVersion specifies the Kubernetes API version to pass to Helm when templating manifests. By default, Argo CD
uses the Kubernetes version of the target cluster.
type: string
+ labelIncludeTemplates:
+ description: LabelIncludeTemplates specifies whether to
+
description
```

🚨 Diff is too long
Expand Down
31 changes: 30 additions & 1 deletion integration-test/branch-12/target-2/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h1>Argo CD Diff Preview</h1>

<p>Summary:</p>
<pre>Modified (1):
± argocd-helm-chart (+212|-48)</pre>
± argocd-helm-chart (+215|-51)</pre>

<div class="diffs">
<details>
Expand Down Expand Up @@ -1016,6 +1016,35 @@ <h4 class="resource_header">StatefulSet: argocd/argocd-helm-chart-application-co
</table>
</div>

<h4 class="resource_header">ServiceMonitor: argocd/argocd-helm-chart-application-controller</h4>
<div class="diff_container">
<table>

<tr class="normal_line"><td><pre> app.kubernetes.io/part-of: argocd</pre></td></tr>
<tr class="removed_line"><td><pre>- app.kubernetes.io/version: v2.13.1</pre></td></tr>
<tr class="removed_line"><td><pre>- helm.sh/chart: argo-cd-7.7.7</pre></td></tr>
<tr class="added_line"><td><pre>+ app.kubernetes.io/version: v3.2.0</pre></td></tr>
<tr class="added_line"><td><pre>+ helm.sh/chart: argo-cd-9.1.4</pre></td></tr>
<tr class="normal_line"><td><pre> name: argocd-helm-chart-application-controller</pre></td></tr>
<tr class="normal_line"><td><pre> namespace: argocd</pre></td></tr>
<tr class="normal_line"><td><pre> spec:</pre></td></tr>
<tr class="normal_line"><td><pre> endpoints:</pre></td></tr>
<tr class="normal_line"><td><pre> - honorLabels: false</pre></td></tr>
<tr class="removed_line"><td><pre>- interval: 30s</pre></td></tr>
<tr class="added_line"><td><pre>+ interval: 15s</pre></td></tr>
<tr class="normal_line"><td><pre> path: /metrics</pre></td></tr>
<tr class="normal_line"><td><pre> port: http-metrics</pre></td></tr>
<tr class="normal_line"><td><pre> namespaceSelector:</pre></td></tr>
<tr class="normal_line"><td><pre> matchNames:</pre></td></tr>
<tr class="normal_line"><td><pre> - argocd</pre></td></tr>
<tr class="normal_line"><td><pre> selector:</pre></td></tr>
<tr class="normal_line"><td><pre> matchLabels:</pre></td></tr>
<tr class="normal_line"><td><pre> app.kubernetes.io/component: application-controller</pre></td></tr>
<tr class="normal_line"><td><pre> app.kubernetes.io/instance: argocd-helm-chart</pre></td></tr>
<tr class="normal_line"><td><pre> app.kubernetes.io/name: argocd-metrics</pre></td></tr>
</table>
</div>

<h4 class="resource_header">ClusterRole: argocd-helm-chart-server</h4>
<div class="diff_container">
<table>
Expand Down
27 changes: 26 additions & 1 deletion integration-test/branch-12/target-2/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Summary:
```yaml
Modified (1):
± argocd-helm-chart (+212|-48)
± argocd-helm-chart (+215|-51)
```

<details>
Expand Down Expand Up @@ -930,6 +930,31 @@ Modified (1):
path: ca.crt
optional: true
```
#### ServiceMonitor: argocd/argocd-helm-chart-application-controller
```diff
app.kubernetes.io/part-of: argocd
- app.kubernetes.io/version: v2.13.1
- helm.sh/chart: argo-cd-7.7.7
+ app.kubernetes.io/version: v3.2.0
+ helm.sh/chart: argo-cd-9.1.4
name: argocd-helm-chart-application-controller
namespace: argocd
spec:
endpoints:
- honorLabels: false
- interval: 30s
+ interval: 15s
path: /metrics
port: http-metrics
namespaceSelector:
matchNames:
- argocd
selector:
matchLabels:
app.kubernetes.io/component: application-controller
app.kubernetes.io/instance: argocd-helm-chart
app.kubernetes.io/name: argocd-metrics
```
#### ClusterRole: argocd-helm-chart-server
```diff
name: argocd-helm-chart-server
Expand Down
49 changes: 41 additions & 8 deletions integration-test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type TestCase struct {
RenderMethod string // "cli", "server-api", "repo-server-api", or "" to use global flag
DisableClusterRoles string // Use no-cluster-roles/values.yaml (sets createClusterRoles: false)
ArgocdConfigDir string // Custom argocd-config directory (relative to integration-test/); overrides auto-derived path
ArgocdConfigDirAPIMode string // Custom argocd-config directory for API render modes; falls back to ArgocdConfigDir when empty
ArgocdUIURL string // Argo CD URL for generating application links in diff output
TraverseAppOfApps string // If "true", enables recursive child app discovery (--traverse-app-of-apps)
RepoRegex string // If set, use --repo-regex instead of --repo
Expand Down Expand Up @@ -259,6 +260,8 @@ var testCases = []TestCase{
Suffix: "-1",
DiffIgnore: "annotations",
WatchIfNoWatchPatternFound: "false",
ArgocdConfigDir: "with-servicemonitor-crd",
ArgocdConfigDirAPIMode: "with-servicemonitor-crd-no-cluster-roles",
},
{
Name: "branch-12/target-2",
Expand All @@ -268,6 +271,8 @@ var testCases = []TestCase{
DiffIgnore: "annotations",
WatchIfNoWatchPatternFound: "false",
IgnoreResources: "*:CustomResourceDefinition:*,:ConfigMap:argocd-cm",
ArgocdConfigDir: "with-servicemonitor-crd",
ArgocdConfigDirAPIMode: "with-servicemonitor-crd-no-cluster-roles",
},
{
Name: "branch-13/target-1",
Expand Down Expand Up @@ -368,6 +373,23 @@ func isAPIMode(tc TestCase) bool {
return m == "server-api" || m == "repo-server-api"
}

func effectiveArgocdConfigDir(tc TestCase) string {
if isAPIMode(tc) && tc.ArgocdConfigDirAPIMode != "" {
return tc.ArgocdConfigDirAPIMode
}
return tc.ArgocdConfigDir
}

func effectiveClusterConfig(tc TestCase) string {
if argocdConfigDir := effectiveArgocdConfigDir(tc); argocdConfigDir != "" {
return argocdConfigDir
}
if tc.DisableClusterRoles == "true" || isAPIMode(tc) {
return "no-cluster-roles"
}
return "default"
}

// timePattern matches timing information in output that varies between runs
// Matches patterns like "1m10s]", "24s]", "110s]"
var timePattern = regexp.MustCompile(`\d+m?\d*s\]`)
Expand Down Expand Up @@ -420,6 +442,7 @@ func TestIntegration(t *testing.T) {

// Track how many tests since last cluster creation
testsSinceClusterCreation := 0
currentClusterConfig := ""

// Run each test case
for i, tc := range shuffledCases {
Expand All @@ -430,25 +453,35 @@ func TestIntegration(t *testing.T) {

// Check current cluster state
clusterExists := kindClusterExists()
requiredClusterConfig := effectiveClusterConfig(tc)

// Check for RBAC mismatch (only relevant if cluster exists)
// Check for cluster configuration mismatch (only relevant if cluster exists).
// An empty currentClusterConfig means this test process did not create the
// existing cluster, so the Argo CD values are unknown and must not be reused.
if clusterExists {
clusterHasRoles := clusterHasArgocdClusterRoles()
// Mismatch if: test wants roles disabled but cluster has them, OR
// test wants roles enabled but cluster doesn't have them
rbacMismatch := testNeedsRolesDisabled == clusterHasRoles

if rbacMismatch {
printToTTY("🔄 Deleting cluster due to RBAC configuration mismatch...\n")
configMismatch := currentClusterConfig != requiredClusterConfig

if rbacMismatch || configMismatch {
reason := "RBAC configuration mismatch"
if configMismatch {
reason = fmt.Sprintf("Argo CD config mismatch: current=%s, required=%s", currentClusterConfig, requiredClusterConfig)
}
printToTTY(fmt.Sprintf("🔄 Deleting cluster due to %s...\n", reason))
_ = deleteKindCluster()
clusterExists = false
currentClusterConfig = ""
}
}

// Create cluster if: every 15th test, no cluster exists, or test explicitly requires it
createCluster := testsSinceClusterCreation >= 15 || !clusterExists || tc.CreateCluster == "true"
if createCluster {
testsSinceClusterCreation = 0
currentClusterConfig = requiredClusterConfig
}

// Print separator to TTY for visibility between test runs
Expand Down Expand Up @@ -861,8 +894,8 @@ func runWithDocker(tc TestCase, createCluster bool, runDirs RunDirs) error {
// When using a custom ArgoCD config directory, mount the entire directory.
// Otherwise, when using API mode or DisableClusterRoles is set, mount only the values.yaml file
// (which sets createClusterRoles: false) into the default argocd-config path in the container.
if tc.ArgocdConfigDir != "" {
args = append(args, "-v", fmt.Sprintf("%s/integration-test/%s:/argocd-config", repoRoot, tc.ArgocdConfigDir))
if argocdConfigDir := effectiveArgocdConfigDir(tc); argocdConfigDir != "" {
args = append(args, "-v", fmt.Sprintf("%s/integration-test/%s:/argocd-config", repoRoot, argocdConfigDir))
} else if tc.DisableClusterRoles == "true" || isAPIMode(tc) {
args = append(args, "-v", fmt.Sprintf("%s/integration-test/no-cluster-roles/values.yaml:/argocd-config/values.yaml", repoRoot))
}
Expand Down Expand Up @@ -1051,8 +1084,8 @@ func buildArgs(tc TestCase, createCluster bool, runDirs RunDirs, repoRoot string
// pass --argocd-config-dir pointing at the no-cluster-roles directory (createClusterRoles: false).
// If ArgocdConfigDir is explicitly set, use that directory instead.
// This avoids mutating the shared argocd-config/values.yaml on disk.
if tc.ArgocdConfigDir != "" {
args = append(args, "--argocd-config-dir", filepath.Join(repoRoot, "integration-test", tc.ArgocdConfigDir))
if argocdConfigDir := effectiveArgocdConfigDir(tc); argocdConfigDir != "" {
args = append(args, "--argocd-config-dir", filepath.Join(repoRoot, "integration-test", argocdConfigDir))
} else if tc.DisableClusterRoles == "true" || isAPIMode(tc) {
args = append(args, "--argocd-config-dir", filepath.Join(repoRoot, "integration-test", "no-cluster-roles"))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Same as with-servicemonitor-crd, but installs Argo CD without cluster roles
# for API render modes.
createClusterRoles: false

extraObjects:
- apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: servicemonitors.monitoring.coreos.com
spec:
group: monitoring.coreos.com
scope: Namespaced
names:
plural: servicemonitors
singular: servicemonitor
kind: ServiceMonitor
shortNames:
- smon
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
26 changes: 26 additions & 0 deletions integration-test/with-servicemonitor-crd/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Install the ServiceMonitor CRD in the test cluster so Argo CD discovers
# monitoring.coreos.com/v1 and passes it to Helm as a cluster capability.
# This lets tests cover charts that gate ServiceMonitor templates with
# .Capabilities.APIVersions.Has "monitoring.coreos.com/v1".
extraObjects:
- apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: servicemonitors.monitoring.coreos.com
spec:
group: monitoring.coreos.com
scope: Namespaced
names:
plural: servicemonitors
singular: servicemonitor
kind: ServiceMonitor
shortNames:
- smon
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
Loading
Loading