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

The configuration is invalid and could not be loaded. #273

Closed
skamelone opened this issue Oct 10, 2019 · 2 comments
Closed

The configuration is invalid and could not be loaded. #273

skamelone opened this issue Oct 10, 2019 · 2 comments

Comments

@skamelone
Copy link

skamelone commented Oct 10, 2019

Config.yaml is not valid

Oathkeeper version: v0.19.1

Here's my ConfigMap used in my oathKeeper Deployment object:

apiVersion: v1
kind: ConfigMap
metadata:
  name: oathkeeper-config
data:
  config.yaml: |
    serve:
      proxy:
        port: 4455 # run the proxy at port 4455
      api:
        port: 4456 # run the api at port 4456

    access_rules:
      repositories:
        - file:///rules.json

    mutators:
      header:
        enabled: true
      noop:
        enabled: true
      id_token:
        enabled: true
        config:
          issuer_url: http://localhost:4455/
          jwks_url: file:///jwks.json

    authorizers:
      allow:
        enabled: true
      deny:
        enabled: true

    authenticators:
      anonymous:
        enabled: true
        subject: guest
  jwks.json: |
    {
      "keys": [
        {
			...
        }
      ]
    }
  dev-rules.json: |
    [
		...
    ]
  staging-rules.json: |
    [
		...
    ]
apiVersion: apps/v1
kind: Deployment
metadata:
    name: oathkeeper
spec:
    replicas: 3
    selector:
        matchLabels:
            component: oathkeeper
    template:
        metadata:
            labels:
                component: oathkeeper
        spec:
            containers:
                - name: oathkeeper
                  image: oryd/oathkeeper:v0.19.1
                  command: ["oathkeeper", "--config", "/config.yaml", "serve"]
                  imagePullPolicy: Always
                  ports:
                    - containerPort: 4455
                      name: oathproxy
                    - containerPort: 4456
                      name: oathapi
                  resources:
                    limits:
                      cpu: "0.1"
                      memory: 100Mi
                  volumeMounts:
                    - name: oathkeeper-config
                      mountPath: /config.yaml
                      subPath: config.yaml
                    - name: oathkeeper-config
                      mountPath: /jwks.json
                      subPath: jwks.json
                    - name: oathkeeper-config
                      mountPath: /rules.json
                      subPath: dev-rules.json
            volumes:
              - name: oathkeeper-config
                configMap:
                    name: oathkeeper-config

When I install oathkeeper, here are the logs I get from crashing oathkeeper pods:

time="2019-10-10T18:50:36Z" level=info msg="Config file loaded successfully." path=/config.yaml
time="2019-10-10T18:50:36Z" level=fatal msg="The configuration is invalid and could not be loaded." error="must validate at least one schema (anyOf)" validation_error[0]="mutators.header: Must validate at least one schema (anyOf)" validation_error[1]="mutators.header.config: config is required"

It's probably my mistake but I can't figure out what's wrong with my conf. I haven't found any solution in the documentation as well.

@kubadz
Copy link
Contributor

kubadz commented Oct 11, 2019

You have to add config to header mutator with a fallback header to oathkeeper-config.
for example:

    mutators:
      header:
        enabled: true
        config:
          headers:
            foo: bar

In the UPGRADE.md you can read:

The global config will always be used as a fallback when no access rule specific configuration is set.

@aeneasr
Copy link
Member

aeneasr commented Oct 11, 2019

You can find an example here: https://www.ory.sh/docs/oathkeeper/configuration

Make sure to use "config" keys as @kubadz pointed out.

@aeneasr aeneasr closed this as completed Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants