Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controller crash when patching YAMLs with non-ASCII characters #140

Closed
ywyt738 opened this issue Mar 30, 2021 · 9 comments · Fixed by #182
Closed

controller crash when patching YAMLs with non-ASCII characters #140

ywyt738 opened this issue Mar 30, 2021 · 9 comments · Fixed by #182
Labels
blocked/upstream Blocked by an upstream dependency or issue bug Something isn't working

Comments

@ywyt738
Copy link

ywyt738 commented Mar 30, 2021

image-automation-controller version 0.6.1 and 0.7.0 also have this issue.
image-automation-controller crashed when the ImageUpdateAutomation is created.

apiVersion: image.toolkit.fluxcd.io/v1alpha1
kind: ImageUpdateAutomation
metadata:
  name: imageupdate
spec:
  checkout:
    branch: master
    gitRepositoryRef:
      name: default
  commit:
    authorEmail: [email protected]
    authorName: fluxcdbot
    messageTemplate: |
      [ci skip]Automated image update

      Automation name: {{ .AutomationObject }}

      Files:
      {{ range $filename, $_ := .Updated.Files -}}
      - {{ $filename }}
      {{ end -}}

      Objects:
      {{ range $resource, $_ := .Updated.Objects -}}
      - {{ $resource.Kind }} {{ $resource.Name }}
      {{ end -}}

      Images:
      {{ range .Updated.Images -}}
      - {{.}}
      {{ end -}}
  interval: 1m0s
  update:
    strategy: Setters

The image-automation-controller log

{"level":"info","ts":"2021-03-30T06:18:16.540Z","logger":"controller-runtime.metrics","msg":"metrics server is starting to listen","addr":":8080"}
{"level":"info","ts":"2021-03-30T06:18:16.541Z","logger":"setup","msg":"starting manager"}
I0330 06:18:16.542567       7 leaderelection.go:243] attempting to acquire leader lease flux-system/79628f79.fluxcd.io...
{"level":"info","ts":"2021-03-30T06:18:16.543Z","logger":"controller-runtime.manager","msg":"starting metrics server","path":"/metrics"}
I0330 06:18:32.118539       7 leaderelection.go:253] successfully acquired lease flux-system/79628f79.fluxcd.io
{"level":"info","ts":"2021-03-30T06:18:32.118Z","logger":"controller-runtime.manager.controller.imageupdateautomation","msg":"Starting EventSource","reconciler group":"image.toolkit.fluxcd.io","reconciler kind":"ImageUpdateAutomation","source":"kind source: /, Kind="}
{"level":"info","ts":"2021-03-30T06:18:32.118Z","logger":"controller-runtime.manager.controller.imageupdateautomation","msg":"Starting EventSource","reconciler group":"image.toolkit.fluxcd.io","reconciler kind":"ImageUpdateAutomation","source":"kind source: /, Kind="}
{"level":"info","ts":"2021-03-30T06:18:32.219Z","logger":"controller-runtime.manager.controller.imageupdateautomation","msg":"Starting Controller","reconciler group":"image.toolkit.fluxcd.io","reconciler kind":"ImageUpdateAutomation"}
{"level":"info","ts":"2021-03-30T06:18:32.219Z","logger":"controller-runtime.manager.controller.imageupdateautomation","msg":"Starting workers","reconciler group":"image.toolkit.fluxcd.io","reconciler kind":"ImageUpdateAutomation","worker count":1}



E0330 06:20:30.946110       7 runtime.go:78] Observed a panic: runtime.boundsError{x:22, y:21, signed:true, code:0x0} (runtime error: index out of range [22] with length 21)
goroutine 315 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic(0x1b6bc80, 0xc00081dfe0)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/runtime/runtime.go:74 +0x95
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/runtime/runtime.go:48 +0x89
panic(0x1b6bc80, 0xc00081dfe0)
        /usr/local/go/src/runtime/panic.go:969 +0x1b9
gopkg.in/yaml%2ev3.handleErr(0xc000ab9c40)
        /go/pkg/mod/gopkg.in/[email protected]/yaml.go:276 +0x85
panic(0x1b6bc80, 0xc00081dfe0)
        /usr/local/go/src/runtime/panic.go:969 +0x1b9
gopkg.in/yaml%2ev3.write(0xc000124a80, 0xc00081dfc0, 0x15, 0x20, 0xc000ab50e0, 0x122d301)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:90 +0x245
gopkg.in/yaml%2ev3.yaml_emitter_write_comment(0xc000124a80, 0xc00081dfc0, 0x15, 0x20, 0x1)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:1978 +0x1ae
gopkg.in/yaml%2ev3.yaml_emitter_process_line_comment(0xc000124a80, 0xc001132820)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:1128 +0x6a
gopkg.in/yaml%2ev3.yaml_emitter_emit_block_mapping_value(0xc000124a80, 0xc001132820, 0x1, 0xc000ab51c8)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:817 +0xec
gopkg.in/yaml%2ev3.yaml_emitter_state_machine(0xc000124a80, 0xc001132820, 0xc000ab5201)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:303 +0x445
gopkg.in/yaml%2ev3.yaml_emitter_emit(0xc000124a80, 0xc000124cc0, 0xc000e10c70)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:153 +0x14f
gopkg.in/yaml%2ev3.(*encoder).emit(0xc000124a80)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:81 +0x39
gopkg.in/yaml%2ev3.(*encoder).emitScalar(0xc000124a80, 0xc000917190, 0x9, 0x0, 0x0, 0x0, 0x0, 0xc000586a02, 0x2b175d8, 0x0, ...)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:417 +0x31a
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a91360, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:559 +0x136f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a912c0, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:508 +0xb25
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a91220, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:478 +0x5fc
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8f900, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8f860, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:478 +0x5fc
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8f720, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8f220, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8e960, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc0007ebf40, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc0007ebe00, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:463 +0x245
gopkg.in/yaml%2ev3.(*encoder).nodev(0xc000124a80, 0x1ad66a0, 0xc0007ebe00, 0x16)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:421 +0x79
gopkg.in/yaml%2ev3.(*encoder).marshalDoc(0xc000124a80, 0x0, 0x0, 0x1ad66a0, 0xc0007ebe00, 0x16)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:101 +0x23a
gopkg.in/yaml%2ev3.(*Encoder).Encode(0xc0003ab4c8, 0x1ad66a0, 0xc0007ebe00, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/yaml.go:251 +0xea
sigs.k8s.io/kustomize/kyaml/yaml.String(0xc0007ebe00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/yaml/types.go:215 +0x1b3
sigs.k8s.io/kustomize/kyaml/yaml.(*RNode).String(...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/yaml/rnode.go:496
sigs.k8s.io/kustomize/kyaml/kio.ByteWriter.encode(0x1e90b00, 0xc0003ab498, 0x0, 0xc000586380, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/byteio_writer.go:130 +0x2b8
sigs.k8s.io/kustomize/kyaml/kio.ByteWriter.Write(0x1e90b00, 0xc0003ab498, 0x0, 0xc000586380, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/byteio_writer.go:87 +0xdec
sigs.k8s.io/kustomize/kyaml/kio.LocalPackageWriter.Write.func1(0xc0003ab498, 0xc000aba328, 0xc000e92b40, 0xc000aba228, 0xc00117e238, 0x0, 0x0)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/pkgio_writer.go:102 +0x16a
sigs.k8s.io/kustomize/kyaml/kio.LocalPackageWriter.Write(0x0, 0x0, 0xc000b00f00, 0x1f, 0x0, 0xc000586380, 0x1, 0x1, 0xc000967b80, 0x9, ...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/pkgio_writer.go:106 +0x8c6
sigs.k8s.io/kustomize/kyaml/kio.Pipeline.ExecuteWithCallback(0xc000aba7e8, 0x1, 0x1, 0xc000aba7c8, 0x1, 0x1, 0xc000aba7d8, 0x1, 0x1, 0x0, ...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/kio.go:131 +0x244
sigs.k8s.io/kustomize/kyaml/kio.Pipeline.Execute(...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/kio.go:93
github.com/fluxcd/image-automation-controller/pkg/update.UpdateWithSetters(0xc000b00f00, 0x1f, 0xc000b00f00, 0x1f, 0xc00046a480, 0x3, 0x3, 0x1, 0x0, 0x0)
        /workspace/pkg/update/setters.go:176 +0x46c
github.com/fluxcd/image-automation-controller/controllers.updateAccordingToSetters(...)
        /workspace/controllers/imageupdateautomation_controller.go:600
github.com/fluxcd/image-automation-controller/controllers.(*ImageUpdateAutomationReconciler).Reconcile(0xc0008cf400, 0x1ed3e60, 0xc000b066c0, 0xc000cd69f0, 0x8, 0xc000cd69d8, 0x8, 0xc000b06600, 0x0, 0x0, ...)
        /workspace/controllers/imageupdateautomation_controller.go:209 +0x11fb
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0008cde00, 0x1ed3da0, 0xc0008fb240, 0x1ab7880, 0xc0011995a0)
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:298 +0x317
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0008cde00, 0x1ed3da0, 0xc0008fb240, 0x0)
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:253 +0x205
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.2(0x1ed3da0, 0xc0008fb240)
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:216 +0x4a
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1()
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185 +0x37
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000358f50)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155 +0x5f
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc00117ff50, 0x1e90240, 0xc000537ec0, 0xc0008fb201, 0xc0005115c0)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156 +0xad
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc000358f50, 0x3b9aca00, 0x0, 0x1, 0xc0005115c0)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133 +0x98
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext(0x1ed3da0, 0xc0008fb240, 0xc0005dbfe0, 0x3b9aca00, 0x0, 0xc00031df01)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185 +0xa6
k8s.io/apimachinery/pkg/util/wait.UntilWithContext(0x1ed3da0, 0xc0008fb240, 0xc0005dbfe0, 0x3b9aca00)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:99 +0x57
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:213 +0x45e
panic: runtime error: index out of range [22] with length 21 [recovered]
        panic: runtime error: index out of range [22] with length 21 [recovered]
        panic: runtime error: index out of range [22] with length 21

goroutine 315 [running]:
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/runtime/runtime.go:55 +0x10c
panic(0x1b6bc80, 0xc00081dfe0)
        /usr/local/go/src/runtime/panic.go:969 +0x1b9
gopkg.in/yaml%2ev3.handleErr(0xc000ab9c40)
        /go/pkg/mod/gopkg.in/[email protected]/yaml.go:276 +0x85
panic(0x1b6bc80, 0xc00081dfe0)
        /usr/local/go/src/runtime/panic.go:969 +0x1b9
gopkg.in/yaml%2ev3.write(0xc000124a80, 0xc00081dfc0, 0x15, 0x20, 0xc000ab50e0, 0x122d301)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:90 +0x245
gopkg.in/yaml%2ev3.yaml_emitter_write_comment(0xc000124a80, 0xc00081dfc0, 0x15, 0x20, 0x1)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:1978 +0x1ae
gopkg.in/yaml%2ev3.yaml_emitter_process_line_comment(0xc000124a80, 0xc001132820)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:1128 +0x6a
gopkg.in/yaml%2ev3.yaml_emitter_emit_block_mapping_value(0xc000124a80, 0xc001132820, 0x1, 0xc000ab51c8)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:817 +0xec
gopkg.in/yaml%2ev3.yaml_emitter_state_machine(0xc000124a80, 0xc001132820, 0xc000ab5201)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:303 +0x445
gopkg.in/yaml%2ev3.yaml_emitter_emit(0xc000124a80, 0xc000124cc0, 0xc000e10c70)
        /go/pkg/mod/gopkg.in/[email protected]/emitterc.go:153 +0x14f
gopkg.in/yaml%2ev3.(*encoder).emit(0xc000124a80)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:81 +0x39
gopkg.in/yaml%2ev3.(*encoder).emitScalar(0xc000124a80, 0xc000917190, 0x9, 0x0, 0x0, 0x0, 0x0, 0xc000586a02, 0x2b175d8, 0x0, ...)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:417 +0x31a
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a91360, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:559 +0x136f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a912c0, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:508 +0xb25
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a91220, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:478 +0x5fc
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8f900, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8f860, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:478 +0x5fc
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8f720, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8f220, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc000a8e960, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc0007ebf40, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:512 +0xa6f
gopkg.in/yaml%2ev3.(*encoder).node(0xc000124a80, 0xc0007ebe00, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:463 +0x245
gopkg.in/yaml%2ev3.(*encoder).nodev(0xc000124a80, 0x1ad66a0, 0xc0007ebe00, 0x16)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:421 +0x79
gopkg.in/yaml%2ev3.(*encoder).marshalDoc(0xc000124a80, 0x0, 0x0, 0x1ad66a0, 0xc0007ebe00, 0x16)
        /go/pkg/mod/gopkg.in/[email protected]/encode.go:101 +0x23a
gopkg.in/yaml%2ev3.(*Encoder).Encode(0xc0003ab4c8, 0x1ad66a0, 0xc0007ebe00, 0x0, 0x0)
        /go/pkg/mod/gopkg.in/[email protected]/yaml.go:251 +0xea
sigs.k8s.io/kustomize/kyaml/yaml.String(0xc0007ebe00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/yaml/types.go:215 +0x1b3
sigs.k8s.io/kustomize/kyaml/yaml.(*RNode).String(...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/yaml/rnode.go:496
sigs.k8s.io/kustomize/kyaml/kio.ByteWriter.encode(0x1e90b00, 0xc0003ab498, 0x0, 0xc000586380, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/byteio_writer.go:130 +0x2b8
sigs.k8s.io/kustomize/kyaml/kio.ByteWriter.Write(0x1e90b00, 0xc0003ab498, 0x0, 0xc000586380, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/byteio_writer.go:87 +0xdec
sigs.k8s.io/kustomize/kyaml/kio.LocalPackageWriter.Write.func1(0xc0003ab498, 0xc000aba328, 0xc000e92b40, 0xc000aba228, 0xc00117e238, 0x0, 0x0)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/pkgio_writer.go:102 +0x16a
sigs.k8s.io/kustomize/kyaml/kio.LocalPackageWriter.Write(0x0, 0x0, 0xc000b00f00, 0x1f, 0x0, 0xc000586380, 0x1, 0x1, 0xc000967b80, 0x9, ...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/pkgio_writer.go:106 +0x8c6
sigs.k8s.io/kustomize/kyaml/kio.Pipeline.ExecuteWithCallback(0xc000aba7e8, 0x1, 0x1, 0xc000aba7c8, 0x1, 0x1, 0xc000aba7d8, 0x1, 0x1, 0x0, ...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/kio.go:131 +0x244
sigs.k8s.io/kustomize/kyaml/kio.Pipeline.Execute(...)
        /go/pkg/mod/sigs.k8s.io/kustomize/[email protected]/kio/kio.go:93
github.com/fluxcd/image-automation-controller/pkg/update.UpdateWithSetters(0xc000b00f00, 0x1f, 0xc000b00f00, 0x1f, 0xc00046a480, 0x3, 0x3, 0x1, 0x0, 0x0)
        /workspace/pkg/update/setters.go:176 +0x46c
github.com/fluxcd/image-automation-controller/controllers.updateAccordingToSetters(...)
        /workspace/controllers/imageupdateautomation_controller.go:600
github.com/fluxcd/image-automation-controller/controllers.(*ImageUpdateAutomationReconciler).Reconcile(0xc0008cf400, 0x1ed3e60, 0xc000b066c0, 0xc000cd69f0, 0x8, 0xc000cd69d8, 0x8, 0xc000b06600, 0x0, 0x0, ...)
        /workspace/controllers/imageupdateautomation_controller.go:209 +0x11fb
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0008cde00, 0x1ed3da0, 0xc0008fb240, 0x1ab7880, 0xc0011995a0)
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:298 +0x317
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0008cde00, 0x1ed3da0, 0xc0008fb240, 0x0)
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:253 +0x205
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.2(0x1ed3da0, 0xc0008fb240)
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:216 +0x4a
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1()
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185 +0x37
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000358f50)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155 +0x5f
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc00117ff50, 0x1e90240, 0xc000537ec0, 0xc0008fb201, 0xc0005115c0)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156 +0xad
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc000358f50, 0x3b9aca00, 0x0, 0x1, 0xc0005115c0)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133 +0x98
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext(0x1ed3da0, 0xc0008fb240, 0xc0005dbfe0, 0x3b9aca00, 0x0, 0xc00031df01)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185 +0xa6
k8s.io/apimachinery/pkg/util/wait.UntilWithContext(0x1ed3da0, 0xc0008fb240, 0xc0005dbfe0, 0x3b9aca00)
        /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:99 +0x57
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:213 +0x45e
@stefanprodan stefanprodan added the bug Something isn't working label Mar 30, 2021
@stefanprodan
Copy link
Member

Can you post here the YAML with the policy comments please?

@ywyt738
Copy link
Author

ywyt738 commented Mar 30, 2021

---
apiVersion: image.toolkit.fluxcd.io/v1alpha1
kind: ImagePolicy
metadata:
  name: l2l-core
spec:
  imageRepositoryRef:
    name: l2l-core
  filterTags:
    pattern: '^sc\.(?P<ver>.*)'
    extract: '$ver'
  policy:
    semver:
      range: '>1.0.0'
---
apiVersion: image.toolkit.fluxcd.io/v1alpha1
kind: ImagePolicy
metadata:
  name: l2l-activity
spec:
  imageRepositoryRef:
    name: l2l-activity
  filterTags:
    pattern: '^prod\.(?P<ver>.*)'
    extract: '$ver'
  policy:
    semver:
      range: '>1.0.0'
---
apiVersion: image.toolkit.fluxcd.io/v1alpha1
kind: ImagePolicy
metadata:
  name: l2l-activity-h5
spec:
  imageRepositoryRef:
    name: l2l-activity-h5
  filterTags:
    pattern: '^prod\.(?P<ver>.*)'
    extract: '$ver'
  policy:
    semver:
      range: '>1.0.0'

@stefanprodan
Copy link
Member

@ywyt738 can you post also the YAML files where the policy setters are used? e.g. # {"$imagepolicy": "<policy-namespace>:<policy-name>"}

@ywyt738
Copy link
Author

ywyt738 commented Mar 30, 2021

kind: Deployment
metadata:
  labels:
    io.kompose.service: l2l-core
  name: l2l-core
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: l2l-core
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        io.kompose.service: l2l-core
    spec:
      containers:
          image: registry.xxx.com/l2l/l2l-core:sc.1.0.1  # {"$imagepolicy": "default:l2l-core"}
          imagePullPolicy: IfNotPresent
          name: l2l-core
          resources:
            limits:
              memory: 1600Mi
            requests:
              memory: 1000Mi
          ports:
            - containerPort: 8060
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      terminationGracePeriodSeconds: 30

@ywyt738
Copy link
Author

ywyt738 commented Apr 6, 2021

@stefanprodan Do you have workaround?

@hiddeco
Copy link
Member

hiddeco commented Apr 6, 2021

Seems to be related to kubernetes-sigs/kustomize#3605

@stefanprodan
Copy link
Member

stefanprodan commented Apr 6, 2021

@ywyt738 can you remove any non-ASCII characters from your YAMLs and see if that fixes it?

@stefanprodan stefanprodan added the blocked/upstream Blocked by an upstream dependency or issue label Apr 6, 2021
@squaremo
Copy link
Member

squaremo commented Apr 6, 2021

A bit more info: the stack trace shows it's a bug in yaml.v3, and our best guess is the unicode-handling bug linked above. I don't see any non-ASCII in the examples, but perhaps it was lost in editing.

@ywyt738
Copy link
Author

ywyt738 commented Apr 7, 2021

@stefanprodan Thank you very much indeed.
Yeah, It's fixed after I removed all non-ASCII characters including comment.

@stefanprodan stefanprodan changed the title controller crash controller crash when patching YAMLs with non-ASCII characters Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/upstream Blocked by an upstream dependency or issue bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants