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

[Merged by Bors] - Initial listener-operator implementation #1

Closed
wants to merge 102 commits into from
Closed

Conversation

nightkr
Copy link
Member

@nightkr nightkr commented Aug 23, 2022

This implements the basic concept, but is sitll missing a fair bit of documentation. The CRDs should also be moved into operator-rs since some operators will depend on them.

Essentially, this provides two new CRDs and a CSI driver:

---
apiVersion: lb.stackable.tech/v1alpha1
kind: LoadBalancer
metadata:
  name: example-public-lb
  namespace: default
spec:
  className: public
  podSelector:
    statefulset.kubernetes.io/pod-name: example-public-pod
  ports:
  - name: http
    port: 80
    protocol: TCP
status:
  ingressAddresses:
  - address: 172.18.0.3
    ports:
      http: 80
---
apiVersion: lb.stackable.tech/v1alpha1
kind: LoadBalancerClass
metadata:
  name: public
spec:
  serviceType: LoadBalancer

LoadBalancerClass defines the policy for how a specific "kind of service" (for example: public with dynamic discovery, vpc-internal with static discovery) should be deployed on a given network. LoadBalancer then links deploys a Service (or potentially something else in the future, where relevant) according to these rules, and gives back (via the status) a list of addresses that can be used to access the service, including whatever port remappings may be required.

The CSI driver can also be used to project this address information into the pod itself:

---
apiVersion: v1
kind: Pod
metadata:
  name: example-public-pod
spec:
  volumes:
    - name: lb
      ephemeral:
        volumeClaimTemplate:
          metadata:
            annotations:
              lb.stackable.tech/lb-name: example-public-lb
          spec:
            storageClassName: lb.stackable.tech
            accessModes:
              - ReadWriteMany
            resources:
              requests:
                storage: "1"
  containers:
    - name: nginx
      image: nginx
      volumeMounts:
        - name: lb
          mountPath: /lb

The CSI driver can also be configured to automatically create a LB based on the Pod's settings:

---
apiVersion: v1
kind: Pod
metadata:
  name: example-public-pod
spec:
  volumes:
    - name: lb
      ephemeral:
        volumeClaimTemplate:
          metadata:
            annotations:
              lb.stackable.tech/lb-class: public
          spec:
            storageClassName: lb.stackable.tech
            accessModes:
              - ReadWriteMany
            resources:
              requests:
                storage: "1"
  containers:
    - name: nginx
      image: nginx
      volumeMounts:
        - name: lb
          mountPath: /lb
      ports:
        - name: http
          containerPort: 80

Finally, the CSI driver also configures stickiness when used with persistent PVCs (such as manually provisioned ones, or ones created via StatefulSet.spec.volumeClaimTemplates), if it would be useful for the given LoadBalancerClass.

@nightkr nightkr self-assigned this Aug 23, 2022
@nightkr nightkr requested review from fhennig and a team August 23, 2022 14:50
@nightkr
Copy link
Member Author

nightkr commented Aug 24, 2022

I've tried to document basic operation now. Would appreciate if someone could check that it more or less makes sense...

Not at all sold on the CRD naming, since we end up with LoadBalancer uses LoadBalancerClass with type: LoadBalancer, creates a Service with type: LoadBalancer. I talked to @fhennig about renaming it to L4Ingress/Layer4Ingress, but that also feels pretty awkward.

A few other considered but discarded options....

  • Service - conflicts with K8s-native Service
  • Ingress - conflicts with K8s-native HTTP-level Ingress
  • Gateway - conflicts with both Istio's Gateway (basically an Ingress controller) and K8s' new Gateway API
  • Router implies that we're configuring a layer 3 router
  • Route/IngressRoute - Sounds more like a single-destination rule (which is a use-case that we support, but not the only one), Træfik also has their own IngressRoute CRD

@nightkr
Copy link
Member Author

nightkr commented Sep 28, 2022

bors r+

@nightkr
Copy link
Member Author

nightkr commented Sep 28, 2022

bors ping

@bors
Copy link

bors bot commented Sep 28, 2022

pong

@nightkr
Copy link
Member Author

nightkr commented Sep 28, 2022

bors r+

@bors
Copy link

bors bot commented Sep 28, 2022

👎 Rejected by code reviews

@nightkr nightkr dismissed fhennig’s stale review September 28, 2022 13:39

Comments addressed, torch handed over to Sigi

@nightkr
Copy link
Member Author

nightkr commented Sep 28, 2022

bors r+

bors bot pushed a commit that referenced this pull request Sep 28, 2022
This implements the basic concept, but is sitll missing a fair bit of documentation. The CRDs should also be moved into operator-rs since some operators will depend on them.

Essentially, this provides two new CRDs and a CSI driver:

```yaml
---
apiVersion: lb.stackable.tech/v1alpha1
kind: LoadBalancer
metadata:
  name: example-public-lb
  namespace: default
spec:
  className: public
  podSelector:
    statefulset.kubernetes.io/pod-name: example-public-pod
  ports:
  - name: http
    port: 80
    protocol: TCP
status:
  ingressAddresses:
  - address: 172.18.0.3
    ports:
      http: 80
---
apiVersion: lb.stackable.tech/v1alpha1
kind: LoadBalancerClass
metadata:
  name: public
spec:
  serviceType: LoadBalancer
```

`LoadBalancerClass` defines the policy for how a specific "kind of service" (for example: public with dynamic discovery, vpc-internal with static discovery) should be deployed on a given network. `LoadBalancer` then links deploys a `Service` (or potentially something else in the future, where relevant) according to these rules, and gives back (via the `status`) a list of addresses that can be used to access the service, including whatever port remappings may be required.

The CSI driver can also be used to project this address information into the pod itself:

```yaml
---
apiVersion: v1
kind: Pod
metadata:
  name: example-public-pod
spec:
  volumes:
    - name: lb
      ephemeral:
        volumeClaimTemplate:
          metadata:
            annotations:
              lb.stackable.tech/lb-name: example-public-lb
          spec:
            storageClassName: lb.stackable.tech
            accessModes:
              - ReadWriteMany
            resources:
              requests:
                storage: "1"
  containers:
    - name: nginx
      image: nginx
      volumeMounts:
        - name: lb
          mountPath: /lb
```

The CSI driver can also be configured to automatically create a LB based on the `Pod`'s settings:

```yaml
---
apiVersion: v1
kind: Pod
metadata:
  name: example-public-pod
spec:
  volumes:
    - name: lb
      ephemeral:
        volumeClaimTemplate:
          metadata:
            annotations:
              lb.stackable.tech/lb-class: public
          spec:
            storageClassName: lb.stackable.tech
            accessModes:
              - ReadWriteMany
            resources:
              requests:
                storage: "1"
  containers:
    - name: nginx
      image: nginx
      volumeMounts:
        - name: lb
          mountPath: /lb
      ports:
        - name: http
          containerPort: 80
```

Finally, the CSI driver also configures stickiness when used with persistent PVCs (such as manually provisioned ones, or ones created via `StatefulSet.spec.volumeClaimTemplates`), if it would be useful for the given `LoadBalancerClass`.
@bors
Copy link

bors bot commented Sep 28, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Initial listener-operator implementation [Merged by Bors] - Initial listener-operator implementation Sep 28, 2022
@bors bors bot closed this Sep 28, 2022
@bors bors bot deleted the poc branch September 28, 2022 13:51
@lfrancke lfrancke added release-note Denotes a PR that will be considered when it comes time to generate release notes. release/2022-11 labels Sep 29, 2022
@lfrancke lfrancke requested review from lfrancke and removed request for lfrancke September 30, 2022 08:15
@lfrancke lfrancke self-assigned this Sep 30, 2022
@lfrancke
Copy link
Member

I'll need some help on this one.
Do we need to add this to the feature tracker?
It feels like the answer is "yes" but I struggle to come up with a concise name.
It can also be multiple features...

@teozkr @soenkeliebau

@nightkr
Copy link
Member Author

nightkr commented Sep 30, 2022

Sort of... I'd say something like "enable configurable listeners" (not happy about this name either) is a feature worth tracking per product operator.

@lfrancke
Copy link
Member

Especially for Kafka where listener has another but similar meaning...

@nightkr
Copy link
Member Author

nightkr commented Sep 30, 2022

Myeah. "Stackable listeners are used to expose Kafka listeners", but I agree that they need to be distinguished in the feature tracker...

@soenkeliebau
Copy link
Member

Maybe something along the lines of "Centrally managed access patterns/methods/..."

Listener is a more technical way of phrasing this I guess, what we actually mean is how stuff can be accessed, no?

@lfrancke
Copy link
Member

lfrancke commented Oct 4, 2022

I'll let it simmer for a few days. I'm not really happy yet but I'll pick something. Thanks for the input.

@soenkeliebau
Copy link
Member

Hm... apparantly my comment from this morning never made it here..

I was thinking we don't need to add it to the feature tracker right now, as this PR didn't include the functionality in any operator, it only created the necessary scaffolding that we need in place for this.
So we can punt on the naming until the first operator PR comes around :)

@lfrancke
Copy link
Member

Excellent. Let future us deal with that problem then. Happy to move it to done in that case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/2022-11 release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants