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

Configmap for defaults #306

Closed
josephburnett opened this issue Mar 6, 2019 · 1 comment
Closed

Configmap for defaults #306

josephburnett opened this issue Mar 6, 2019 · 1 comment

Comments

@josephburnett
Copy link

Expected Behavior

I would like to be able to use a config map when setting defaults in the webhook.

Actual Behavior

However, because the webhook is common and abstracted, I cannot construct one and get it through to the defaulting function. E.g. I would like to pass in a config map watcher here and have that config map passed to the SetDefaults function here.

Additional Info

I used a package scoped var to work around this limitation in knative/serving#3103.

@mattmoor
Copy link
Member

mattmoor commented Mar 8, 2019

I think what I'd like to see here is changing these interfaces to pass a context.Context argument, and using the work by @dprotaso to attach some of these configs to it.

mattmoor added a commit to mattmoor/pkg that referenced this issue Mar 20, 2019
mattmoor added a commit to mattmoor/pkg that referenced this issue Mar 27, 2019
… context.

Clients of webhook can now decorate the request context with additional metadata
via:
```
  ac := &AdmissionController{
    ... // As before
    WithContext: func(ctx context.Context) context.Context {
      // logic to attach stuff to ctx
    }
  }
```

This metadata can then be accessed off of the context in methods like
`SetDefaults` and `Validate` on types registered as webhook handlers.

Fixes: knative#306
mattmoor added a commit to mattmoor/pkg that referenced this issue Mar 27, 2019
… context.

Clients of webhook can now decorate the request context with additional metadata
via:
```
  ac := &AdmissionController{
    ... // As before
    WithContext: func(ctx context.Context) context.Context {
      // logic to attach stuff to ctx
    }
  }
```

This metadata can then be accessed off of the context in methods like
`SetDefaults` and `Validate` on types registered as webhook handlers.

Fixes: knative#306
knative-prow-robot pushed a commit that referenced this issue Mar 27, 2019
… context. (#342)

Clients of webhook can now decorate the request context with additional metadata
via:
```
  ac := &AdmissionController{
    ... // As before
    WithContext: func(ctx context.Context) context.Context {
      // logic to attach stuff to ctx
    }
  }
```

This metadata can then be accessed off of the context in methods like
`SetDefaults` and `Validate` on types registered as webhook handlers.

Fixes: #306
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants