question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instruct url info to be put into configmap

See original GitHub issue

Overview

When following a gitops-model, it is beneficial to get a deterministic URL for endpoints. Although we cannot control the service endpoint names in EnMasse (2 address spaces could end up creating conflicting ones), it would be useful if a tenant can instruct a configmap to be created with the endpoint information (url, ports, CA).

Design

The AddressSpace resource would be extended to support the following syntax:

apiVersion: enmasse.io/v1beta1
kind: AddressSpace
metadata:
  name: myspace
spec:
  endpoints:
  - name: messaging
    service: messaging
    exports/bindings:
      - kind: ConfigMap
        name: myconfig // Requires the 'system:serviceaccount:enmasse-infra:address-space-controller' service account RBAC rule to be created by application owner.
        namespace: mynamespace // Defaults to namespace of address space
      - kind: Secret
        name: mysecret
      - kind: Service
        name: myservice

The Secret/ConfigMap will contain the the following fields:

data:
  service.host: messaging-....svc
  service.port.amqp: 5672
  service.port.amqps: 5671
  // Following is only populated if endpoint is exposed
  external.host: ...
  external.port.amqps: 443

Service format:

kind: Service
...
spec:
  type: ExternalName
  # Points to the existing service in the enmasse-infra namespace
  externalName: messaging-....enmasse-infra.svc.cluster.local
  ports:
  - port: 5672
  - port: 5671

Tasklist

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
lulfcommented, Mar 20, 2019

@k-wall ConfigMaps, Secrets and Services are objects that better integrates with Kubernetes compared to an AddressSpace, and partially because we don’t want applications to dictate the service names inside enmasse-infra (since there are multiple applications that could conflict). Therefore, an application would have to read the address space object to know the actual endpoint url.

For instance, lets say you have an application repo with all YAML for address spaces and addresses. Now, in order for the application code to have zero knowledge of Kubernetes and its API (which it would need to retrieve the address space resource), it can instead depend on environment variables that can reference fields in a configmap or a secret.

An application will then consist of:

  • a deployment manifest for the application itself where the env for the container references a configmap ‘foo’
  • an RBAC rule to allow EnMasse to manipulate the configmap in the applications namespace
  • an address space manifest with the export to configmap ‘foo’

The application code can then only depend on environment variables to retrieve the information about endpoints.

Similarly, the service case is similar, where the application depends on a service with a known name ‘mymessaging’ and configures the address space export to create it. The application code can then just connect to ‘mymessaging’ without knowing the actual service url.

1reaction
lulfcommented, Mar 20, 2019

@k-wall Good question. I think doing a replace would be a convenient behavior, and allow us to reoncile the config should something change, i.e. in an upgrade scenario where we added another port for instance. I don’t expect this would happen frequently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure a Pod to Use a ConfigMap
You can use kubectl create configmap to create a ConfigMap from an individual file, or from multiple files. You can pass in the...
Read more >
Ultimate Guide to ConfigMaps in Kubernetes - Matthew Palmer
With this guide, tutorial, and examples, you'll learn how to use ConfigMaps in Kubernetes. We'll teach you how to create ConfigMaps.
Read more >
Kubernetes ConfigMap: Creating, Viewing, Consuming & ...
Learn how to work with ConfigMaps, API objects that let you store Kubernetes data as key-value pairs and access it from within your...
Read more >
Kubernetes ConfigMaps and Configuration Best Practices
ConfigMaps are ideal for most situations where you want to supply environment-specific configuration values to your pods. They store key-value ...
Read more >
Creating and using config maps - Working with pods | Nodes
If you create a config map from a file, you can include files containing non-UTF8 data that are placed in this field without...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found