From 5edb9c11d2f11120310d9d2954f9ddb56640e379 Mon Sep 17 00:00:00 2001 From: Michal Kuritka Date: Wed, 5 Jun 2024 12:36:06 +0200 Subject: [PATCH] README.md --- .github/workflows/golangci.yaml | 2 - .github/workflows/golic.yaml | 2 - .github/workflows/test.yaml | 2 - .github/workflows/yamllint.yaml | 2 - README.md | 76 ++++++++++++++++++++++++++++++++- 5 files changed, 75 insertions(+), 9 deletions(-) diff --git a/.github/workflows/golangci.yaml b/.github/workflows/golangci.yaml index d8a3f6a..cc6469a 100644 --- a/.github/workflows/golangci.yaml +++ b/.github/workflows/golangci.yaml @@ -22,8 +22,6 @@ on: pull_request: branches: - main - paths-ignore: - - '**.md' jobs: lint: name: GolangCI diff --git a/.github/workflows/golic.yaml b/.github/workflows/golic.yaml index 49d2031..a790aba 100644 --- a/.github/workflows/golic.yaml +++ b/.github/workflows/golic.yaml @@ -22,8 +22,6 @@ on: pull_request: branches: - main - paths-ignore: - - '**.md' jobs: golic: name: GoLic diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4388b80..77cb6a9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,8 +22,6 @@ on: pull_request: branches: - main - paths-ignore: - - '**.md' jobs: test: name: Test diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml index 0125646..9929668 100644 --- a/.github/workflows/yamllint.yaml +++ b/.github/workflows/yamllint.yaml @@ -22,8 +22,6 @@ on: pull_request: branches: - main - paths-ignore: - - '**.md' jobs: lint: name: YamlLint diff --git a/README.md b/README.md index 8889caa..40b6de9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,9 @@ Infoblox provider based on in-tree provider for ExternalDNS. Supported records: ## Quick start -Required environment variables: +To run the provider, you must provide the following Environment Variables: + +**Infoblox Environment Variables**: | Environment Variable | Default value | Required | |-----------------------------|---------------|----------| @@ -27,3 +29,75 @@ Required environment variables: | INFOBLOX_MAX_RESULTS | 1500 | false | | INFOBLOX_CREATE_PTR | false | false | | INFOBLOX_DEFAULT_TTL | 300 | false | + + +**external-dns-infoblox-webhook Environment Variables**: + +| Environment Variable | Default value | Required | +|--------------------------------|---------------|----------| +| SERVER_HOST | 0.0.0.0 | true | +| SERVER_PORT | 8888 | true | +| SERVER_READ_TIMEOUT | | false | +| SERVER_WRITE_TIMEOUT | | false | +| DOMAIN_FILTER | | false | +| EXCLUDE_DOMAIN_FILTER | | false | +| REGEXP_DOMAIN_FILTER | | false | +| REGEXP_DOMAIN_FILTER_EXCLUSION | | false | +| REGEXP_NAME_FILTER | | false | + + +## Contribution +All PRs are welcome, but before you create a PR, make sure your changes pass the linters and the apache2 license is +injected into the newly added files. The `make lint` command will do this for you. + +Another point is the tests. If you create/change functionality, make sure the tests are running, updated or necessary ones +are added. The `make test` command is used to run the tests. + +## Running locally + +To run provider in a local environment, you must provide all required settings through environment variables. +To run locally, set `SERVER_HOST` to `localhost`, otherwise leave it at `0.0.0.0`. +Infoblox Provider is a simple web server with several clearly defined routers: + +| Route | Method | +|------------------|--------| +| /healthz | GET | +| /records | GET | +| /records | POST | +| /adjustendpoints | POST | + +#### Reading Data +```shell +curl -H 'Accept: application/external.dns.webhook+json;version=1' localhost:8888/records +``` + +#### Writing Data + +Here are the updating rules according to which the data in the DNS server will be updated: + +- if updateNew is not part of Update Old , object should be created +- if updateOld is not part of Update New , object should be deleted +- if information is not present (TTL might change) , object should be updated +- if we rename the object, object should be deleted and created + + +Based on the rules I am providing some examples of `data.json` creating, changing and deleting records in DNS. + +```shell +curl -X POST -H 'Accept: application/external.dns.webhook+json;version=1;' -H 'Content-Type: application/external.dns.webhook+json;version=1' -d @data.json localhost:8888/records +``` + +Create `test.cloud.example.com` +```json +{"Create":null,"UpdateOld":[{"dnsName":"test.cloud.example.com","targets":["1.3.2.1"],"recordType":"A","recordTTL":300}],"UpdateNew":null,"Delete":null} +``` + +Update `test.cloud.example.com` +```json +{"Create":null,"UpdateOld":[{"dnsName":"test.cloud.example.com","targets":["1.3.2.1"],"recordType":"A","recordTTL":300}],"UpdateNew":null,"Delete":[{"dnsName":"new-test.cloud.example.com","targets":["1.2.3.4","4.3.2.1"],"recordType":"A","recordTTL":300}]} +``` + +Delete `test-new.cloud.example.com` +```json +{"Create":null,"UpdateOld":null,"UpdateNew":null,"Delete":[{"dnsName":"new-test.cloud.example.","targets":["1.2.3.4","4.3.2.1"],"recordType":"A","recordTTL":300}]} +``` \ No newline at end of file