LM Config Reloader (Optional)

Overview

  • LM-K8s-Webhook uses 2 important configurations, one is Additional attribute config and other one is lm-k8s-webhook-mutating-webhook-configuration which is of kind MutatingWebhookConfiguration which basically contains the information about how the mutating webhook should be configured.
  • You can have these two configuration files in your Github repo and once you update these configurations on Github, lm-config-reloader will fetch the updated configurations and update the configurations in the container.

Configurations

By default, lm-config-reloader is disabled. You need to follow following steps to configure lm-config-reloader:

  • As a part of MutatingWebhookConfiguration i.e. lm-k8s-webhook-mutating-webhook-configuration, as of now you can only update the ObjectSelector and NamespaceSelector using LM-K8s-Reloader. You can refer to the file content that is shown below and create your own MutatingWebhookConfiguration file by replacing the ObjectSelector and NamespaceSelector with your selectors and push it to the Github repo.
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
  name: lm-k8s-webhook-mutating-webhook-configuration
webhooks:
- name: lm-k8s-webhook-svc.lm-k8s-webhook.svc.cluster.local
  objectSelector:
  matchLabels:
    lm-k8s-webhook: enabled
  namespaceSelector:
    matchExpressions:
    - key: environment
      operator: In
      values:
      - dev
  • For the additional attribute config file, you can refer to Additional attribute config section. Once config is ready, push this file to your Github repo.
  • Get the lm-config-reloader configuration file from here and update this config file to include the details of your Github repo where configurations are placed.
  • You need to pass this config file while deploying the LM-K8s-Webhook. You can refer to the example 6 from example section.