Skip to main content
Question

[Flux CD]Exporting metadata fails - Invalid token reference error


We use GitOps with FluxCD... 

I added new Profiles and Policies as *.yaml into k10. They all got accepted/validated, but as soon as the policy runs they all fail with the error message “exporting metadata failed”. 

I found this post which is related i think. Exporting metadata fails - Invalid token reference error | Veeam Community Resource Hub

Since we use FluxCd and it doesnt offer the “ignoreDifferences:” feature is there another solution to this problem?

 

error:
    cause: '{"cause":{"cause":{"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:796","function":"kasten.io/k10/kio/exec/phases/phase.getMigrationString","linenumber":796,"message":"Invalid
      token
      reference"},"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:772","function":"kasten.io/k10/kio/exec/phases/phase.getMigrationData","linenumber":772,"message":"Failed
      to get migration
      string"},"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:100","function":"kasten.io/k10/kio/exec/phases/phase.(*migrateSendPhase).Run","linenumber":100,"message":"Failed
      to get migration data"}'
    message: Job failed to be executed
  exceptions:
    - cause: '{"cause":{"cause":{"cause":{"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:796","function":"kasten.io/k10/kio/exec/phases/phase.getMigrationString","linenumber":796,"message":"Invalid
        token
        reference"},"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:772","function":"kasten.io/k10/kio/exec/phases/phase.getMigrationData","linenumber":772,"message":"Failed
        to get migration
        string"},"file":"kasten.io/k10/kio/exec/phases/phase/migrate_cleanup.go:61","function":"kasten.io/k10/kio/exec/phases/phase.(*migrateCleanupPhase).run","linenumber":61,"message":"Failed
        to get migration data"},"fields":[],"message":"Failed to cleanup
        collections"}'
      message: Failure in collections cleanup phase. Collections may be orphaned.
    - cause: '{"cause":{"cause":{"cause":{"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:796","function":"kasten.io/k10/kio/exec/phases/phase.getMigrationString","linenumber":796,"message":"Invalid
        token
        reference"},"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:772","function":"kasten.io/k10/kio/exec/phases/phase.getMigrationData","linenumber":772,"message":"Failed
        to get migration
        string"},"file":"kasten.io/k10/kio/exec/phases/phase/migrate_cleanup.go:61","function":"kasten.io/k10/kio/exec/phases/phase.(*migrateCleanupPhase).run","linenumber":61,"message":"Failed
        to get migration data"},"fields":[],"message":"Failed to cleanup
        collections"}'
      message: Failure in collections cleanup phase. Collections may be orphaned.
    - cause: '{"cause":{"cause":{"cause":{"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:796","function":"kasten.io/k10/kio/exec/phases/phase.getMigrationString","linenumber":796,"message":"Invalid
        token
        reference"},"file":"kasten.io/k10/kio/exec/phases/phase/migrate.go:772","function":"kasten.io/k10/kio/exec/phases/phase.getMigrationData","linenumber":772,"message":"Failed
        to get migration
        string"},"file":"kasten.io/k10/kio/exec/phases/phase/migrate_cleanup.go:61","function":"kasten.io/k10/kio/exec/phases/phase.(*migrateCleanupPhase).run","linenumber":61,"message":"Failed
        to get migration data"},"fields":[],"message":"Failed to cleanup
        collections"}'
      message: Failure in collections cleanup phase. Collections may be orphaned.

 

4 comments

Chris.Childerhose
Forum|alt.badge.img+21

Geoff Burke
Forum|alt.badge.img+22
  • Veeam Legend, Veeam Vanguard
  • 1318 comments
  • April 27, 2023

Hagag
Forum|alt.badge.img+2
  • Experienced User
  • 154 comments
  • April 28, 2023

@markbon I think Flux CD also has a similar feature called ignore that allows you to ignore certain differences between the desired and observed state of the policy resource during a sync operation.

you can specify a JSONPath expression in the annotations section of the manifest for the resource. using fluxcd.io/ignore:



The Jason PathExpression:  → .spec.actions[].exportParameters



the 2nd option is to ignore syncing the policy resources by using FluxCD --ignore flag.
 


  • Author
  • Comes here often
  • 5 comments
  • April 28, 2023

@Hagag Thx for your reply. I just checked the fluxcd docs again and all i found is spec.ignore to ignore files in the deplyoment folder…

apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: webapp
  namespace: apps
spec:
  interval: 1m0s # check for new commits every minute and apply changes
  url: https://github.com/org/webapp # clone over HTTPS
  secretRef: # use token auth
    name: webapp-git-token # Flux user PAT (read-only access)
  ref:
    branch: main
  ignore: |
    # exclude all
    /*
    # include deploy dir
    !/deploy    

Maybe you where refering more to something likte this? FAQ | Flux (fluxcd.io)

kustomize.toolkit.fluxcd.io/reconcile: disabled
or
kustomize.toolkit.fluxcd.io/ssa: merge

I just tried i but i still get the same error.

I couldnt find a way to exclude specific expression/field. But if anyone knows better you are welcome 😁

oh and its fluxV2 btw…

 


Comment