Skip to content

Commit

Permalink
Initial listener-operator implementation (#1)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
nightkr committed Sep 28, 2022
1 parent 6c72318 commit 4749b73
Show file tree
Hide file tree
Showing 99 changed files with 7,352 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
debug/
target/
**/*.rs.bk

.idea/
*.iws

image.tar

# We do NOT want to ignore .git because we use the `built` crate to gather the current git commit hash at built time
# This means we need the .git directory in our Docker image, it will be thrown away and won't be included in the final image
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
ignore = E111,E501,E114
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: "🐛 Bug Report"
description: "If something isn't working as expected 🤔."
labels: ["type/bug"]
body:
- type: markdown
attributes:
value: Thanks for taking the time to file a bug report! Please fill out this form as completely as possible.

- type: input
attributes:
label: Affected version
description: Which version do you see this bug in?

- type: textarea
attributes:
label: Current and expected behavior
description: A clear and concise description of what the operator is doing and what you would expect.
validations:
required: true

- type: textarea
attributes:
label: Possible solution
description: "If you have suggestions on a fix for the bug."

- type: textarea
attributes:
label: Additional context
description: "Add any other context about the problem here. Or a screenshot if applicable."

- type: textarea
attributes:
label: Environment
description: |
What type of kubernetes cluster you are running aginst (k3s/eks/aks/gke/other) and any other information about your environment?
placeholder: |
Examples:
Output of `kubectl version --short`
- type: dropdown
attributes:
label: Would you like to work on fixing this bug?
description: |
**NOTE**: Let us know if you would like to submit a PR for this. We are more than happy to help you through the process.
options:
- "yes"
- "no"
- "maybe"
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
blank_issues_enabled: true
contact_links:
- name: Feature request
about: 🚀 Suggest an idea for this project
url: https://github.com/stackabletech/listener-operator/discussions/new?category=ideas
- name: 🙋🏾 Question
about: Use this to ask a question about this project
url: https://github.com/stackabletech/listener-operator/discussions/new?category=q-a
- name: Other issue
about: Open an issue that doesn't fit any other category
url: https://github.com/stackabletech/listener-operator/issues/new
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/new_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: New Version
about: Request support for a new product version
title: "[NEW VERSION]"
labels: ''
assignees: ''

---

**Which new version of Stackable Listener Operator should we support?**

Please specify the version, version range or version numbers to support, please also add these to the issue title

**Additional information**

If possible, provide a link to release notes/changelog

**Changes required**

Are there any upstream changes that we need to support?
e.g. new features, changed features, deprecated features etc.



**Implementation checklist**

Please don't change anything in this list.
Not all of these steps are necessary for all versions.

- [ ] Update the Docker image
- [ ] Update documentation to include supported version(s)
- [ ] Update operator to support the new version (if needed)
- [ ] Update integration tests to test use the new versions (in addition or replacing old versions
- [ ] Update examples to use new versions
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# Description

*Please add a description here. This will become the commit message of the merge request later.*

<!-- Commit message above. Everything below is not added to the message. Do not change this line! -->

## Review Checklist

- [ ] Code contains useful comments
- [ ] CRD change approved (or not applicable)
- [ ] (Integration-)Test cases added (or not applicable)
- [ ] Documentation added (or not applicable)
- [ ] Changelog updated (or not applicable)
- [ ] Cargo.toml only contains references to git tags (not specific commits or branches)
- [ ] Helm chart can be installed and deployed operator works (or not applicable)

Once the review is done, comment `bors r+` (or `bors merge`) to merge. [Further information](https://bors.tech/documentation/getting-started/#reviewing-pull-requests)
Loading

0 comments on commit 4749b73

Please sign in to comment.