mirror of https://github.com/fluxcd/flux2.git
Fix `flux trace` for HRs from `OCIRepository`s
Before:
```
$ flux -n default trace pod default-podinfo-585856f49c-4jl4m
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x10618da70]
goroutine 1 [running]:
main.traceHelm({0x106dd7b28, 0x14000201490}, {0x12f34c0d8, 0x14000783100}, {{0x1400071e130?, 0x1061e7795?}, {0x1400071e109?, 0x1000d9c84?}}, 0x140006a6030)
/home/runner/work/flux2/flux2/cmd/flux/trace.go:404 +0x2f0
main.traceObject({0x106dd7b28, 0x14000201490}, {0x12f34c0d8, 0x14000783100}, 0x140006a6030)
/home/runner/work/flux2/flux2/cmd/flux/trace.go:134 +0x11c
main.traceObjects({0x106dd7b28, 0x14000201490}, {0x12f34c0d8, 0x14000783100}, {0x140006a6040, 0x1, 0x0?})
/home/runner/work/flux2/flux2/cmd/flux/trace.go:112 +0x74
main.traceCmdRun(0x14000592800?, {0x140003aea80, 0x2, 0x4})
/home/runner/work/flux2/flux2/cmd/flux/trace.go:107 +0x180
github.com/spf13/cobra.(*Command).execute(0x108341980, {0x140003aea40, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x108329280)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
main.main()
/home/runner/work/flux2/flux2/cmd/flux/main.go:189 +0x78
```
After:
```
$ ~/dev/flux/flux2/bin/flux -n default trace pod default-podinfo-585856f49c-4jl4m
Object: Pod/default-podinfo-585856f49c-4jl4m
Namespace: default
Status: Managed by Flux
---
HelmRelease: podinfo
Namespace: flux-system
Target: default
Revision: 6.8.0+2360bdf32ddc
Status: Last reconciled at 2025-05-14 16:10:37 +0200 CEST
Message: Helm install succeeded for release default/default-podinfo.v1 with chart podinfo@6.8.0+2360bdf32ddc
---
OCIRepository: podinfo
Namespace: flux-system
URL: oci://ghcr.io/stefanprodan/charts/podinfo
Tag: 6.8.0
Revision: 6.8.0@sha256:2360bdf32ddc50c05f8e128118173343b0a012a338daf145b16e0da9c80081a4
Status: Last reconciled at 2025-05-14 16:09:17 +0200 CEST
Message: stored artifact for digest '6.8.0@sha256:2360bdf32ddc50c05f8e128118173343b0a012a338daf145b16e0da9c80081a4'
```
Signed-off-by: Max Jonas Werner <max@coppersoft.com>
pull/5349/head
parent
8928ac7d39
commit
3e80c5809e
@ -0,0 +1,18 @@
|
||||
|
||||
Object: deployment/podinfo
|
||||
Namespace: {{ .ns }}
|
||||
Status: Managed by Flux
|
||||
---
|
||||
HelmRelease: podinfo
|
||||
Namespace: {{ .ns }}
|
||||
Revision: 6.3.5
|
||||
Status: Last reconciled at {{ .helmReleaseLastReconcile }}
|
||||
Message: Release reconciliation succeeded
|
||||
---
|
||||
OCIRepository: podinfo-charts
|
||||
Namespace: {{ .fluxns }}
|
||||
URL: oci://ghcr.io/stefanprodan/charts/podinfo
|
||||
Tag: 6.8.0
|
||||
Revision: sha256:dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3
|
||||
Status: Last reconciled at {{ .ociRepositoryLastReconcile }}
|
||||
Message: stored artifact for digest 'sha256:dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3'
|
||||
@ -0,0 +1,86 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ .fluxns }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ .ns }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: podinfo
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
helm.toolkit.fluxcd.io/name: podinfo
|
||||
helm.toolkit.fluxcd.io/namespace: {{ .ns }}
|
||||
name: podinfo
|
||||
namespace: {{ .ns }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: podinfo
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: podinfo
|
||||
spec:
|
||||
containers:
|
||||
- name: hello
|
||||
command: [ "echo hello world" ]
|
||||
image: busybox
|
||||
---
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: podinfo
|
||||
namespace: {{ .ns }}
|
||||
spec:
|
||||
chartRef:
|
||||
kind: OCIRepository
|
||||
name: podinfo-charts
|
||||
namespace: {{ .fluxns }}
|
||||
interval: 5m
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-07-16T15:42:20Z"
|
||||
message: Release reconciliation succeeded
|
||||
reason: ReconciliationSucceeded
|
||||
status: "True"
|
||||
type: Ready
|
||||
lastAttemptedRevision: 6.3.5
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
kind: OCIRepository
|
||||
metadata:
|
||||
labels:
|
||||
kustomize.toolkit.fluxcd.io/name: flux-system
|
||||
kustomize.toolkit.fluxcd.io/namespace: {{ .fluxns }}
|
||||
name: podinfo-charts
|
||||
namespace: {{ .fluxns }}
|
||||
spec:
|
||||
interval: 10m0s
|
||||
provider: generic
|
||||
ref:
|
||||
tag: 6.8.0
|
||||
timeout: 60s
|
||||
url: oci://ghcr.io/stefanprodan/charts/podinfo
|
||||
status:
|
||||
artifact:
|
||||
lastUpdateTime: "2022-08-10T10:07:59Z"
|
||||
metadata:
|
||||
org.opencontainers.image.revision: 6.1.6@sha1:450796ddb2ab6724ee1cc32a4be56da032d1cca0
|
||||
org.opencontainers.image.source: https://github.com/stefanprodan/podinfo.git
|
||||
path: "example"
|
||||
revision: sha256:dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3
|
||||
url: "example"
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-07-20T00:48:16Z"
|
||||
message: "stored artifact for digest 'sha256:dbdb109711ffb3be77504d2670dbe13c24dd63d8d7f1fb489d350e5bfe930dd3'"
|
||||
reason: Succeed
|
||||
status: "True"
|
||||
type: Ready
|
||||
Loading…
Reference in New Issue