1
0
mirror of synced 2026-02-06 19:05:55 +00:00

Add flux tree command

The `flux tree kustomization` command prints the resources reconciled by the given Kustomization.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan
2021-10-23 11:04:31 +03:00
parent f2475988bd
commit 80ef184b60
8 changed files with 483 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ .fluxns }}
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: flux-system
namespace: {{ .fluxns }}
spec:
path: ./clusters/production
sourceRef:
kind: GitRepository
name: flux-system
interval: 5m
prune: true
status:
conditions:
- lastTransitionTime: "2021-08-01T04:52:56Z"
message: 'Applied revision: main/696f056df216eea4f9401adbee0ff744d4df390f'
reason: ReconciliationSucceeded
status: "True"
type: Ready
inventory:
entries:
- id: _{{ .fluxns }}__Namespace
v: v1
- id: {{ .fluxns }}_helm-controller_apps_Deployment
v: v1
- id: {{ .fluxns }}_kustomize-controller_apps_Deployment
v: v1
- id: {{ .fluxns }}_notification-controller_apps_Deployment
v: v1
- id: {{ .fluxns }}_source-controller_apps_Deployment
v: v1
- id: {{ .fluxns }}_infrastructure_kustomize.toolkit.fluxcd.io_Kustomization
v: v1beta2
- id: {{ .fluxns }}_flux-system_source.toolkit.fluxcd.io_GitRepository
v: v1beta1
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: infrastructure
namespace: {{ .fluxns }}
spec:
path: ./infrastructure/production
sourceRef:
kind: GitRepository
name: flux-system
interval: 5m
prune: true
status:
conditions:
- lastTransitionTime: "2021-08-01T04:52:56Z"
message: 'Applied revision: main/696f056df216eea4f9401adbee0ff744d4df390f'
reason: ReconciliationSucceeded
status: "True"
type: Ready
inventory:
entries:
- id: _cert-manager__Namespace
v: v1
- id: cert-manager_cert-manager_source.toolkit.fluxcd.io_HelmRepository
v: v1beta1
- id: cert-manager_cert-manager_helm.toolkit.fluxcd.io_HelmRelease
v: v2beta1
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: empty
namespace: {{ .fluxns }}
spec:
path: ./apps/todo
sourceRef:
kind: GitRepository
name: flux-system
interval: 5m
prune: true
status:
conditions:
- lastTransitionTime: "2021-08-01T04:52:56Z"
message: 'Applied revision: main/696f056df216eea4f9401adbee0ff744d4df390f'
reason: ReconciliationSucceeded
status: "True"
type: Ready

View File

@@ -0,0 +1,6 @@
Kustomization/{{ .fluxns }}/flux-system
├── Kustomization/{{ .fluxns }}/infrastructure
│ ├── HelmRepository/cert-manager/cert-manager
│ └── HelmRelease/cert-manager/cert-manager
└── GitRepository/{{ .fluxns }}/flux-system

View File

@@ -0,0 +1,2 @@
Kustomization/{{ .fluxns }}/empty

12
cmd/flux/testdata/tree/tree.golden vendored Normal file
View File

@@ -0,0 +1,12 @@
Kustomization/{{ .fluxns }}/flux-system
├── Namespace/{{ .fluxns }}
├── Deployment/{{ .fluxns }}/helm-controller
├── Deployment/{{ .fluxns }}/kustomize-controller
├── Deployment/{{ .fluxns }}/notification-controller
├── Deployment/{{ .fluxns }}/source-controller
├── Kustomization/{{ .fluxns }}/infrastructure
│ ├── Namespace/cert-manager
│ ├── HelmRepository/cert-manager/cert-manager
│ └── HelmRelease/cert-manager/cert-manager
└── GitRepository/{{ .fluxns }}/flux-system