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

Weight Round Robin (3/4) - Endpoint #914

Merged
merged 1 commit into from
Jul 12, 2022
Merged

Conversation

kuritka
Copy link
Collaborator

@kuritka kuritka commented Jun 22, 2022

related to #50

⚠️ spec.strategy.weight defines balancing for whole DNSEndpoint (GSLB). To define weight per DNSEndpoint.spec.endpoints[...], the spec.endpoint[].name would be defined in GSLB.spec.weight.

implemented code that adds labels to the local dnsEndpoint.

  • covered by unit-tests
  • the labels are as follows:
kind: GSLB
spec:
  ingress:
    rules:
      - host: roundrobin.cloud.example.com
        http: 
          paths:
            - path: /
              backend:
                service:
                  name: frontend-app 
                  port:
                    name: http
spec:
  strategy: roundRobin
    weight:
      eu: 35%
      us: 50%
      za: 15%

has local DNS endpoint like this:

apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
  name: app_host
  annotations: k8gb.absa.oss/dnstype: local
spec:
  endpoints:
  - dnsName: app.bar.com
    labels:
      strategy: roundRobin
      weight-eu-0-35: 10.10.0.1
      weight-eu-1-35: 10.10.0.2
      weight-us-0-50: 10.0.0.1
      weight-us-1-50: 10.0.0.2
      weight-za-0-15: 10.22.0.1
      weight-za-1-15: 10.22.0.2
      weight-za-2-15: 10.22.1.1
    recordTTL: 180
    recordType: A
    Targets:
      - 10.10.0.1
      - 10.10.0.2
      - 10.0.0.1
      - 10.0.0.2
      - 10.22.0.1
      - 10.22.0.2
      - 10.22.1.1

Signed-off-by: kuritka kuritka@gmail.com

controllers/dnsupdate.go Outdated Show resolved Hide resolved
@kuritka kuritka marked this pull request as draft June 23, 2022 10:17
@kuritka kuritka marked this pull request as ready for review June 27, 2022 10:24
@kuritka kuritka requested a review from k0da June 27, 2022 12:14
@kuritka kuritka changed the title Weight Round Robin (3/4) - annotations Weight Round Robin (3/4) - Labels Jun 29, 2022
@kuritka kuritka changed the title Weight Round Robin (3/4) - Labels Weight Round Robin (3/4) - Endpoint Jun 29, 2022
@kuritka kuritka force-pushed the wrr-3-annotation-merge branch 4 times, most recently from ca196cf to cf9808b Compare June 30, 2022 11:57
related to #50

implemented code that adds  labels to the local dnsEndpoint.

 - covered by unit-tests
 - the labels are as follows:
```yaml
kind: GSLB
spec:
  ingress:
    rules:
      - host: roundrobin.cloud.example.com
        http: # This section mirrors the same structure as that of an Ingress resource and will be used verbatim when creating the corresponding Ingress resource that will match the GSLB host
          paths:
            - path: /
              backend:
                service:
                  name: existing-app # Gslb should reflect NotFound status
                  port:
                    name: http
spec:
  strategy: roundRobin
    weight:
      eu: 35%
      us: 50%
      za: 15%
```

has local DNS endpoint like this:

```yaml
apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
  name: app_host
  annotations: k8gb.absa.oss/dnstype: local
spec:
  endpoints:
  - dnsName: app.bar.com
    labels:
      weight-eu-0-35: 10.10.0.1
      weight-eu-1-35: 10.10.0.2
      weight-us-0-50: 10.0.0.1
      weight-us-1-50: 10.0.0.2
      weight-za-0-15: 10.22.0.1
      weight-za-1-15: 10.22.0.2
      weight-za-2-15: 10.22.1.1
    recordTTL: 180
    recordType: A
    Targets:
      - 10.10.0.1
      - 10.10.0.2
      - 10.0.0.1
      - 10.0.0.2
      - 10.22.0.1
      - 10.22.0.2
      - 10.22.1.1
```
Signed-off-by: kuritka <kuritka@gmail.com>
kuritka added a commit that referenced this pull request Jul 1, 2022
Please review after #914 merged

I had to prepare one extra terratest to verify that #914 is creating labels correctly.
The terratests that control the weight will come later. Together with the test I extended
the utils with DNSEndpoint class, which returns information about DNS endpoint.

Signed-off-by: kuritka <kuritka@gmail.com>
kuritka added a commit that referenced this pull request Jul 1, 2022
Please review after #914 merged

I had to prepare one extra terratest to verify that #914 is creating labels correctly.
The terratests that control the weight will come later. Together with the test I extended
the utils with DNSEndpoint class, which returns information about DNS endpoint.

Signed-off-by: kuritka <kuritka@gmail.com>
Copy link
Collaborator

@k0da k0da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@kuritka kuritka merged commit e1af815 into master Jul 12, 2022
@kuritka kuritka deleted the wrr-3-annotation-merge branch July 12, 2022 09:45
kuritka added a commit that referenced this pull request Jul 12, 2022
I had to prepare one extra terratest to verify that #914 is creating labels correctly.
The terratests that control the weight will come later. Together with the test I extended the utils
with DNSEndpoint class, which returns information about DNS endpoint.

Signed-off-by: kuritka <kuritka@gmail.com>
kuritka added a commit that referenced this pull request Jul 25, 2022
I had to prepare one extra terratest to verify that #914 is creating labels correctly.
The terratests that control the weight will come later. Together with the test I extended the utils
with DNSEndpoint class, which returns information about DNS endpoint.

Signed-off-by: kuritka <kuritka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants