Skip to content

Commit

Permalink
Merge pull request #1 from jmcgrath207/release
Browse files Browse the repository at this point in the history
Release v0.1.0
  • Loading branch information
jmcgrath207 authored Jun 26, 2023
2 parents 70532a1 + 189ca7a commit 9a268cd
Show file tree
Hide file tree
Showing 11 changed files with 204 additions and 23 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: ci

on:
pull_request:
push:
branches:
- master
Expand All @@ -17,7 +16,7 @@ jobs:
with:
go-version: '1.19'
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.4.0
uses: helm/kind-action@v1.7.0
with:
install_only: true
- uses: azure/setup-helm@v3
Expand Down
49 changes: 47 additions & 2 deletions Header.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,54 @@

Par is a DNS operator that allows you to control deployment DNS queries by labels without cluster administrative changes (ex. [Istio sidecar](https://istio.io/latest/docs/setup/platform-setup/prerequisites/#:~:text=Istio%20proxy%20sidecar%20container) )

It accomplished this by changing the DNS policy of a deployment to point to the Operator IP address then associating a client ID to pod ip addresses. This allows you to control the scope DNS response to a deployment's label.


![plot](./asssets/par.drawio.png)
[Records Custom Resource Example](./tests/resources/test_dns_v1alpha1_records.yaml)



### Forward Type

### Manager
This type will update deployment pod template DNS configuration to the Operator's IP address and all DNS queries will be forwarded to the Operator. Once a DNS request is received, it will check the Records Custom Resource if a entry exist. If no entry is found it will default to the cluster's DNS.

Only the Records Custom Resource is needed for this configuration.

### Proxy

The same initial setup happens as the Manager forward type, expect for that any DNS A Record Query will always return the proxy IP address. This will then force pod traffic through the proxy and from there the proxy will preform a DNS lookup from the Operator. In theory, any forward proxy can be used with this method.


#### Setup

The proxy deployment will need this label
```yaml
par.dev/proxy: "true"
```
and for the proxy configmap this label.
```yaml
par.dev/proxy-config: "true"
```
Inside the configmap will you need to add a go template tag `.dnsResolver` with the backticks like below. This is so the Operator can render the Operator address in the configmap and forward DNS queries to the Operator.

```yaml
serverBlock: |-
server {
listen 8080;
## Installation
location / {
resolver {{ `{{ .dnsResolver }}` }};
proxy_pass http://$http_host$request_uri;
proxy_ssl_server_name on;
}
}
```

Provide instructions on how to install and set up your project. Be sure to include any dependencies or prerequisites needed.
[example nginx configuration](tests/resources/test_proxy.yaml)

Then deploy your Records custom resource.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,6 @@ deploy_e2e_debug: init envtest ginkgo
deploy_local: init
./scripts/deploy.sh

deploy_e2e: init
deploy_e2e: init envtest ginkgo
ENV='e2e' ./scripts/deploy.sh

86 changes: 80 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,99 @@

Par is a DNS operator that allows you to control deployment DNS queries by labels without cluster administrative changes (ex. [Istio sidecar](https://istio.io/latest/docs/setup/platform-setup/prerequisites/#:~:text=Istio%20proxy%20sidecar%20container) )

It accomplished this by changing the DNS policy of a deployment to point to the Operator IP address then associating a client ID to pod ip addresses. This allows you to control the scope DNS response to a deployment's label.


![plot](./asssets/par.drawio.png)
[Records Custom Resource Example](./tests/resources/test_dns_v1alpha1_records.yaml)



### Forward Type

### Manager
This type will update deployment pod template DNS configuration to the Operator's IP address and all DNS queries will be forwarded to the Operator. Once a DNS request is received, it will check the Records Custom Resource if a entry exist. If no entry is found it will default to the cluster's DNS.

Only the Records Custom Resource is needed for this configuration.

### Proxy

The same initial setup happens as the Manager forward type, expect for that any DNS A Record Query will always return the proxy IP address. This will then force pod traffic through the proxy and from there the proxy will preform a DNS lookup from the Operator. In theory, any forward proxy can be used with this method.


#### Setup

## Installation
The proxy deployment will need this label
```yaml
par.dev/proxy: "true"
```
Provide instructions on how to install and set up your project. Be sure to include any dependencies or prerequisites needed.
and for the proxy configmap this label.
```yaml
par.dev/proxy-config: "true"
```
Inside the configmap will you need to add a go template tag `.dnsResolver` with the backticks like below. This is so the Operator can render the Operator address in the configmap and forward DNS queries to the Operator.

```yaml
serverBlock: |-
server {
listen 8080;
location / {
resolver {{ `{{ .dnsResolver }}` }};
proxy_pass http://$http_host$request_uri;
proxy_ssl_server_name on;
}
}
```

[example nginx configuration](tests/resources/test_proxy.yaml)

Then deploy your Records custom resource. ## Helm Install

```bash
helm repo add par https://jmcgrath207.github.io/par/chart
helm install par par/Par
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| image.repository | string | `"local.io/library/par"` | |
| image.tag | string | `"debug-latest"` | |
| image.repository | string | `"ghcr.io/jmcgrath207/par"` | |
| image.tag | string | `"v0.1.0"` | |
| kubernetesClusterDomain | string | `"cluster.local"` | |
| metrics | bool | `false` | |
| requests.cpu | string | `"256m"` | |
| requests.memory | string | `"128Mi"` | |
| resources.limits.cpu | string | `"1"` | |
| resources.limits.memory | string | `"512Mi"` | |
| resources.limits.cpu | string | `"500m"` | |
| resources.limits.memory | string | `"256Mi"` | |

## Contribute

### Run locally
```bash
make deploy_local
```

### Run locally with Delve Debug
```bash
make deploy_debug
```
Then connect to `localhost:30002` with [delve](https://github.com/go-delve/delve) or your IDE.

### Run e2e Test
```bash
make deploy_e2e
```

### Debug e2e
```bash
make deploy_e2e_debug
```
Then run a debug against [deployment_test.go](tests/e2e/deployment_test.go)

## License

Expand Down
7 changes: 4 additions & 3 deletions Update.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ REF: https://leeyoongti.medium.com/helm-in-kubernetes-part-4-publish-helm-chart-
version='v0.1.0'
docker login ghcr.io --username github-account
docker build -t ghcr.io/jmcgrath207/par:$version .
docker build -t ghcr.io/jmcgrath207/par:latest .
docker push ghcr.io/jmcgrath207/par:$version
helm package chart
helm repo index --merge index.yaml .

docker push ghcr.io/jmcgrath207/par:latest
helm package chart --destination chart
helm repo index --merge index.yaml chart/.
```
2 changes: 2 additions & 0 deletions chart/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
*.tmproj
.vscode/
README.md.gotmpl
index.yaml
*.tgz
Binary file added chart/Par-0.1.0.tgz
Binary file not shown.
38 changes: 34 additions & 4 deletions chart/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
## Helm Install

```bash
helm repo add par https://jmcgrath207.github.io/par/chart
helm install par par/Par
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| image.repository | string | `"local.io/library/par"` | |
| image.tag | string | `"debug-latest"` | |
| image.repository | string | `"ghcr.io/jmcgrath207/par"` | |
| image.tag | string | `"v0.1.0"` | |
| kubernetesClusterDomain | string | `"cluster.local"` | |
| metrics | bool | `false` | |
| requests.cpu | string | `"256m"` | |
| requests.memory | string | `"128Mi"` | |
| resources.limits.cpu | string | `"1"` | |
| resources.limits.memory | string | `"512Mi"` | |
| resources.limits.cpu | string | `"500m"` | |
| resources.limits.memory | string | `"256Mi"` | |

## Contribute

### Run locally
```bash
make deploy_local
```

### Run locally with Delve Debug
```bash
make deploy_debug
```
Then connect to `localhost:30002` with [delve](https://github.com/go-delve/delve) or your IDE.

### Run e2e Test
```bash
make deploy_e2e
```

### Debug e2e
```bash
make deploy_e2e_debug
```
Then run a debug against [deployment_test.go](tests/e2e/deployment_test.go)

## License

Expand Down
30 changes: 30 additions & 0 deletions chart/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
## Helm Install

```bash
helm repo add par https://jmcgrath207.github.io/par/chart
helm install par par/Par
```

{{ template "chart.valuesSection" . }}

## Contribute

### Run locally
```bash
make deploy_local
```

### Run locally with Delve Debug
```bash
make deploy_debug
```
Then connect to `localhost:30002` with [delve](https://github.com/go-delve/delve) or your IDE.

### Run e2e Test
```bash
make deploy_e2e
```

### Debug e2e
```bash
make deploy_e2e_debug
```
Then run a debug against [deployment_test.go](tests/e2e/deployment_test.go)

## License

This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). See the `LICENSE` file for more details.
6 changes: 3 additions & 3 deletions index.yaml → chart/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ entries:
Par:
- apiVersion: v2
appVersion: 0.1.0
created: "2023-06-21T22:04:16.216159864-05:00"
created: "2023-06-21T22:56:23.283437707-05:00"
description: Label Based DNS Operator
digest: 6b237990787f1549bccfd7bb38608db7a3254d7ef5b447c1b0b4de9d7c4f6520
digest: e1d0bd099dc08d219cd2342de6f85a13db3ccd823fdca53490c48a2655693ad4
name: Par
type: application
urls:
- Par-0.1.0.tgz
version: 0.1.0
generated: "2023-06-21T22:04:16.215129239-05:00"
generated: "2023-06-21T22:56:23.283191036-05:00"
4 changes: 2 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ image:

resources:
limits:
cpu: "1"
memory: 512Mi
cpu: 500m
memory: 256Mi

requests:
cpu: 256m
Expand Down

0 comments on commit 9a268cd

Please sign in to comment.