endpoint-auth-service

by FIWARE Foundation

Helm chartv0.2.0App 0.4.4

A Helm chart for running the endpoint-auth-service on kubernetes.

About this chart

endpoint-auth-service

A Helm chart for running the endpoint-auth-service on kubernetes.

Maintainers

NameEmailUrl
wistefan[email protected]

Additional Information

The chart contains the endpoint-auth-service and components to add the sidecar proxy to target services.

Components

The chart deploys the following components:

  • the endpoint-configuartion-service - configuration under the key "configService"
  • (optional) the configmap-updater - automatically updates the configmap to be used by the proxy
  • (optional) the sidecar-injector - automatically injects the sidecar-proxy, configuration under the key "sidecarInjector"
  • (optional) the ishare-auth-provider - configuration under the key "ishare"

Sidecar-injection

The chart provides the capability to automatically inject the sidecar-proxy into pods. It makes use of Mutating Admission Webhooks. The webhook gets executed on pod-creation and injects the sidecar, its init-containers and the volumes into the pod.

The injected elements are:

  • the (container) envoy-proxy
  • the (container) resource-updater to trigger config reloads for envoy
  • the (initContainer) init-iptables to redirect traffic to the proxy
  • the (initContaienr) resource-updater to fill the initial-config-folder
  • the (volume) envoy-configmap that mounts the config-map generated by the endpoint-configuration-service
  • the (volume) envoy-config-folder that is shared between envoy and the resource-updater

Since the injection-service does require certificate authentication, you have two options:

  1. (Recommended) Hand it over to cert-manager

If you have cert-manager installed, you can let it handle the certificate generation. The easiest way is to use a self-signed issuer:

  apiVersion: cert-manager.io/v1
  kind: ClusterIssuer
  metadata:
    name: self-signed
  spec:
    selfSigned: {}

And reference it in the values.yaml at sidecarInjector.certificate.issuer and set the sidecarInjector.certificate.type: cert-manager. cert-mananger will then generate a sufficient certificate and inject it into the MutatingWebhookConfiguration.

  1. Generate a certificate and provide it as value

Use any tool available to generate a certificate(make sure to provide a SAN) and insert it at sidecarInjector.certificate.cert and sidecarInjector.certificate.key and set the type to sidecarInjector.certificate.type: inline


To select the pods that should get injected, they need to be annotated. The annotation-namespace can be configured via sidecarInjector.annotationNamespace. In addition to the namespace, request has to be added and the configuration-key envoy-sidecar needs to be set as its value.

An example would look like:

  apiVersion: apps/v1
  kind: Deployment
    metadata:
      name: echo-server
  template:
    metadata:
      annotations:
        sidecar.k8s.fiware.org/request: "envoy-sidecar"
    spec:
      containers:
        - image: k8s.gcr.io/echoserver:1.4    

In order to allow proper namespace restrictions, the webhook can be restricted to certain namespaces with the configuration under the key sidecarInjector.restrictNamespace.

With this example configuration:

    sidecarInjector:
      restrictNamespace:
        enabled: true
        label: sidecar-injection
        value: enabled

only pods in namespaces labeled with sidecar-injection=enabled will get injected. The label can be applied via kubectl label namespace my-namespace sidecar-injection=enabled

Service Mesh compatibility

In its current version, the injected proxy will most probably(except some edge-cases) break any integration of the injected pod with a service-mesh like istio or linkerd, since they use similar iptables to redirect traffic to their own proxies. If the injected init-container sets up the iptables to forward every outgoing traffic the sidecar-proxy, this will be disturbed. It's planned to offer native support for at least istio in the future(contributions for any mesh are welcome), but for now only workarounds might be a possibility.

A potential workaround might be to setup the iptables, so that the traffic from the sidecar proxy does not directly get returned, but instead is also redirected to the mesh-proxy. Check the init-iptables container for that.

Source Code

Values

KeyTypeDefaultDescription
authProvider.addressstring"ishare-auth"address to the auth-service
authProvider.portint8080port of the auth-service
configService.additionalAnnotationsobject{}additional annotations for the deployment, if required
configService.additionalLabelsobject{}additional labels for the deployment, if required
configService.additonalEnvVarslist[]a list of additional env vars to be set, check the endpoint-configuration-service documentation for all available options
configService.affinityobject{}affinity template ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
configService.autoscaling.enabledboolfalse
configService.autoscaling.maxReplicasint10maximum number of running pods
configService.autoscaling.metricslist[]metrics to react on
configService.autoscaling.minReplicasint1minimum number of running pods
configService.configmapUpdater.enabledbooltrueshould the updater be deployed?
configService.configmapUpdater.image.pullPolicystring"IfNotPresent"specification of the image pull policy
configService.configmapUpdater.image.repositorystring"quay.io/fiware/envoy-configmap-updater"configmap updater image name ref: https://quay.io/repository/fiware/envoy-configmap-updater
configService.configmapUpdater.image.tagstring"0.4.3"tag of the image to be used
configService.db.passwordstring"pass"password for connecting the database
configService.db.urlstring"jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"host of the database to be used - be aware, defaults to an in-memory db
configService.db.userstring"ecs"user for connecting the database
configService.fullnameOverridestring""option to override the fullname config in the _helpers.tpl
configService.healthPortint9090port to request health information at
configService.image.pullPolicystring"IfNotPresent"specification of the image pull policy
configService.image.repositorystring"quay.io/fiware/endpoint-configuration-service"endpoint-configuration-service image name ref: https://quay.io/repository/fiware/endpoint-configuration-service
configService.image.tagstring"0.4.3"tag of the image to be used
configService.ingress.annotationsobject{}annotations to be added to the ingress
configService.ingress.enabledboolfalseshould there be an ingress to connect configService with the public internet
configService.ingress.hostslist[]all hosts to be provided
configService.ingress.tlslist[]configure the ingress' tls
configService.livenessProbe.failureThresholdint3
configService.livenessProbe.initialDelaySecondsint30
configService.livenessProbe.periodSecondsint10
configService.livenessProbe.successThresholdint1
configService.livenessProbe.timeoutSecondsint30
configService.meshExtension.authProviderNamestring`"outbound80
configService.meshExtension.enabledboolfalse
configService.meshExtension.workloadSelector.namestring"app"
configService.meshExtension.workloadSelector.valuestring"app"
configService.meshExtensionUpdater.enabledboolfalse
configService.meshExtensionUpdater.image.pullPolicystring"IfNotPresent"specification of the image pull policy
configService.meshExtensionUpdater.image.repositorystring"quay.io/fiware/mesh-extension-updater"image name ref: https://quay.io/repository/fiware/mesh-extension-updater
configService.meshExtensionUpdater.image.tagstring"0.4.3"tag of the image to be used
configService.nameOverridestring""option to override the name config in the _helpers.tpl
configService.nodeSelectorobject{}selector template ref: https://kubernetes.io/docs/user-guide/node-selection/
configService.portint8080port that the endpoint-configuration-service container uses
configService.priorityClassNamestring""priority class to be assigned to the pods ref: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
configService.prometheus.enabledbooltrueshould prometheus scrape be enabled
configService.prometheus.pathstring"/prometheus"path for prometheus scrape
configService.prometheus.portint9090port prometheus scrape is available at
configService.readinessProbe.failureThresholdint3
configService.readinessProbe.initialDelaySecondsint31
configService.readinessProbe.periodSecondsint10
configService.readinessProbe.successThresholdint1
configService.readinessProbe.timeoutSecondsint30
configService.replicaCountint1initial number of target replications, can be different if autoscaling is enabled
configService.resourcesobject{}
configService.revisionHistoryLimitint3number of old replicas to be retained
configService.route.annotationsobject{}annotations to be added to the route
configService.route.enabledboolfalse
configService.route.tlsobject{}tls configuration for the route
configService.service.annotationsobject{}addtional annotations, if required
configService.service.portint8080port to be used by the service
configService.service.typestring"ClusterIP"service type
configService.serviceAccountobject{"create":false}if a configService configService service account should be used, it can be configured here ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
configService.serviceAccount.createboolfalsespecifies if the account should be created
configService.tolerationslist[]tolerations template ref: ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
configService.topologySpreadConstraintslist[]topology spread constraints template ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
configService.updateStrategy.rollingUpdateobject{"maxSurge":1,"maxUnavailable":0}new pods will be added gradually
configService.updateStrategy.rollingUpdate.maxSurgeint1number of pods that can be created above the desired amount while updating
configService.updateStrategy.rollingUpdate.maxUnavailableint0number of pods that can be unavailable while updating
configService.updateStrategy.typestring"RollingUpdate"type of the update
fullnameOverridestring""option to override the fullname config in the _helpers.tpl
ishare.additionalAnnotationsobject{}additional annotations for the deployment, if required
ishare.additionalLabelsobject{}additional labels for the deployment, if required
ishare.affinityobject{}affinity template ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
ishare.autoscaling.enabledboolfalse
ishare.autoscaling.maxReplicasint10maximum number of running pods
ishare.autoscaling.metricslist[]metrics to react on
ishare.autoscaling.minReplicasint1minimum number of running pods
ishare.enabledbooltrueshould the ishare-auth-provider be enabled?
ishare.fullnameOverridestring""option to override the fullname config in the _helpers.tpl
ishare.image.pullPolicystring"IfNotPresent"specification of the image pull policy
ishare.image.repositorystring"quay.io/fiware/ishare-auth-provider"endpoint-configuration-service image name ref: https://quay.io/repository/fiware/ishare-auth-provider
ishare.image.tagstring"0.4.3"tag of the image to be used
ishare.ingress.annotationsobject{}annotations to be added

Deploy endpoint-auth-service with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has endpoint-auth-service on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartendpoint-auth-service is pinned at v0.2.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply