allenporter / flux-local

flux-local is a set of tools and libraries for managing a local flux gitops repository focused on validation steps to help improve quality of commits, PRs, and general local testing.
https://allenporter.github.io/flux-local/
Apache License 2.0
155 stars 22 forks source link

Parse postBuild references in the Kustomization #625

Closed allenporter closed 7 months ago

allenporter commented 7 months ago

617

codecov-commenter commented 7 months ago

Codecov Report

Attention: Patch coverage is 95.26316% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 93.44%. Comparing base (f17968d) to head (b051f79).

Files Patch % Lines
flux_local/values.py 96.87% 4 Missing :warning:
flux_local/manifest.py 88.00% 3 Missing :warning:
flux_local/git_repo.py 94.11% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #625 +/- ## ========================================== - Coverage 93.50% 93.44% -0.06% ========================================== Files 19 20 +1 Lines 2001 2120 +119 ========================================== + Hits 1871 1981 +110 - Misses 130 139 +9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 7 months ago
--- tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system Kustomization: flux-system/apps

+++ tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system Kustomization: flux-system/apps

@@ -12,12 +12,15 @@

   - name: infra-configs
   interval: 10m0s
   path: ./tests/testdata/cluster/apps/prod
   postBuild:
     substitute:
       cluster_env: production
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-config
   prune: true
   sourceRef:
     kind: GitRepository
     name: flux-system
   timeout: 5m0s
   wait: true
--- tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system ConfigMap: flux-system/cluster-config

+++ tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system ConfigMap: flux-system/cluster-config

@@ -0,0 +1,12 @@

+---
+apiVersion: v1
+data:
+  cluster_label: example-value
+kind: ConfigMap
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: flux-system
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: cluster-config
+  namespace: flux-system
+
--- tests/testdata/cluster/apps/prod Kustomization: flux-system/apps HelmRelease: podinfo/podinfo

+++ tests/testdata/cluster/apps/prod Kustomization: flux-system/apps HelmRelease: podinfo/podinfo

@@ -20,12 +20,14 @@

     remediation:
       retries: 3
   interval: 50m
   releaseName: podinfo
   values:
     ingress:
+      additionalLabels:
+        cluster_label: example-value
       className: nginx
       enabled: true
       hosts:
       - host: podinfo.production
         paths:
         - path: /
github-actions[bot] commented 7 months ago
--- tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system Kustomization: flux-system/apps

+++ tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system Kustomization: flux-system/apps

@@ -12,12 +12,15 @@

   - name: infra-configs
   interval: 10m0s
   path: ./tests/testdata/cluster/apps/prod
   postBuild:
     substitute:
       cluster_env: production
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-config
   prune: true
   sourceRef:
     kind: GitRepository
     name: flux-system
   timeout: 5m0s
   wait: true
--- tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system ConfigMap: flux-system/cluster-config

+++ tests/testdata/cluster/clusters/prod Kustomization: flux-system/flux-system ConfigMap: flux-system/cluster-config

@@ -0,0 +1,12 @@

+---
+apiVersion: v1
+data:
+  cluster_label: example-value
+kind: ConfigMap
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: flux-system
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: cluster-config
+  namespace: flux-system
+
--- tests/testdata/cluster/apps/prod Kustomization: flux-system/apps HelmRelease: podinfo/podinfo

+++ tests/testdata/cluster/apps/prod Kustomization: flux-system/apps HelmRelease: podinfo/podinfo

@@ -20,12 +20,14 @@

     remediation:
       retries: 3
   interval: 50m
   releaseName: podinfo
   values:
     ingress:
+      additionalLabels:
+        cluster_label: example-value
       className: nginx
       enabled: true
       hosts:
       - host: podinfo.production
         paths:
         - path: /