这是indexloc提供的服务,不要输入任何密码
Skip to content

Cannot create HumioParsers with humio-operator version >=0.22.0 using LogScale version <1.129.0 #861

@aidanestes

Description

@aidanestes

Bug description

The Operator/LogScale/Kubernetes Version Matrix document says I can use LogScale version >=1.118.x with humio-operator version >=0.22.0.

To reproduce this bug

  • Use LogScale version <1.129.0 with humio-operator version >=0.22.0.
    • I used LogScale 1.118.4 with humio-operator 0.22.0 in this exact case.
  • Create a HumioParser custom resource:
    apiVersion: core.humio.com/v1alpha1
    kind: HumioParser
    metadata:
      name: my-parser
      namespace: my-namespace
    spec:
      managedClusterName: my-humio
      name: my-parser
      parserScript: 'parseJson() | parseTimestamp(field=@timestamp)'
      repositoryName: my-repository
  • Get the HumioParser: kubectl -n my-namespace get humioparser/my-parser, note the status is NotFound.
  • Look at humio-operator error logs, see the following:
{"level":"error","ts":"2024-10-07T22:30:43.121925445Z","caller":"controller/controller.go:324","func":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler","msg":"Reconciler error","Operator.Commit":"f5cfc9a3dc2de07c6d30749eb381c7fe58d6c74b","Operator.Date":"2024-06-25T20:14:44+00:00","Operator.Version":"0.22.0","controller":"humioparser","controllerGroup":"core.humio.com","controllerKind":"HumioParser","HumioParser":{"name":"cloudops-parser","namespace":"cloudops"},"namespace":"cloudops","name":"cloudops-parser","reconcileID":"414846b5-a93a-4bc7-9596-6d36af8e4789","error":"could not create parser: non-200 OK status code: 400 Bad Request body: \"{\\\"errors\\\":[{\\\"message\\\":\\\"Cannot query field 'script' on type 'Parser'. (line 1, column 325):\\\\nmutation($force:Boolean!$name:String!$repositoryName:String!$sourceCode:String!$tagFields:[String!]!$testData:[String!]!){createParser(input: { name: $name, repositoryName: $repositoryName, testData: $testData, tagFields: $tagFields, sourceCode: $sourceCode, force: $force}){parser{id,name,displayName,description,isBuiltIn,script,fieldsToTag,fieldsToBeRemovedBeforeParsing,testCases{event{rawString},outputAssertions{outputEventIndex,assertions{fieldsNotPresent,fieldsHaveValues{fieldName,expectedValue}}}}}}}\\\\n                                                                                                                                                                                                                                                                                                                                    ^\\\",\\\"locations\\\":[{\\\"column\\\":325,\\\"line\\\":1}],\\\"isHumioUpdating\\\":false},{\\\"message\\\":\\\"Cannot query field 'fieldsToTag' on type 'Parser'. (line 1, column 332):\\\\nmutation($force:Boolean!$name:String!$repositoryName:String!$sourceCode:String!$tagFields:[String!]!$testData:[String!]!){createParser(input: { name: $name, repositoryName: $repositoryName, testData: $testData, tagFields: $tagFields, sourceCode: $sourceCode, force: $force}){parser{id,name,displayName,description,isBuiltIn,script,fieldsToTag,fieldsToBeRemovedBeforeParsing,testCases{event{rawString},outputAssertions{outputEventIndex,assertions{fieldsNotPresent,fieldsHaveValues{fieldName,expectedValue}}}}}}}\\\\n                                                                                                                                                                                                                                                                                                                                           ^\\\",\\\"locations\\\":[{\\\"column\\\":332,\\\"line\\\":1}],\\\"isHumioUpdating\\\":false},{\\\"message\\\":\\\"Cannot query field 'outputAssertions' on type 'ParserTestCase'. (line 1, column 402):\\\\nmutation($force:Boolean!$name:String!$repositoryName:String!$sourceCode:String!$tagFields:[String!]!$testData:[String!]!){createParser(input: { name: $name, repositoryName: $repositoryName, testData: $testData, tagFields: $tagFields, sourceCode: $sourceCode, force: $force}){parser{id,name,displayName,description,isBuiltIn,script,fieldsToTag,fieldsToBeRemovedBeforeParsing,testCases{event{rawString},outputAssertions{outputEventIndex,assertions{fieldsNotPresent,fieldsHaveValues{fieldName,expectedValue}}}}}}}\\\\n                                                                                                                                                                                                                                                                                                                                                                                                                 ^\\\",\\\"locations\\\":[{\\\"column\\\":402,\\\"line\\\":1}],\\\"isHumioUpdating\\\":false}]}\"","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:324\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:226"}

To workaround the issue

Upgrade to LogScale version >=1.129.0 and restart the humio-operator. Bask in the glory of the fix.

Why is this happening?

Because the Parser data type has breaking changes introduced in LogScale release v1.129.0:

  • testData field is deprecated and replaced by testCases
  • sourceCode field is deprecated and replaced by script
  • tagFields field is deprecated and replaced by fieldsToTag

And, as seen in the error logs above, the GraphQL request created by humio-operator to create the parser is trying to parse testCases, script, and tagFields from the Parser datatype returned by the createParser() mutation, but in LogScale version<1.129.0 these changes to the Parser datatype haven't happened yet...

Recommended fix

Update the version matrix in the release notes to indicate that humio-operator version >=0.22.0 requires LogScale version >=1.129.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions