cloudflare_dns_operator/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! [![Crates.io](https://img.shields.io/crates/v/cloudflare-dns-operator)](https://crates.io/crates/cloudflare-dns-operator)
//! [![](https://docs.rs/cloudflare-dns-operator/badge.svg)](https://docs.rs/cloudflare-dns-operator)
//! [![License](https://img.shields.io/crates/l/cloudflare-dns-operator?color=informational&logo=mpl-2)](/LICENSE)
//!
//! [This is a kubernetes operator](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/) (custom resource definition + kubernetes controller) to manage cloudflare DNS entries from within kubernetes using the cloudflare API.
//!
//! __Note:__ This is an unofficial project and not affiliated in any way with cloudflare.
//!
//! ## Installation
//!
//! In your kubernetes cluster install the [`crds.yaml`](./crds.yaml) file and a deployment matching
//! [examples/deployment.yaml](./examples/deployment.yaml). Note that you'll need to set the env var
//! `CLOUDFLARE_API_TOKEN` to a valid cloudflare API token.
//!
//! This sets up the controller as a deployment. It'll watch for `CloudflareDNSRecord` resources and
//! create/update/delete DNS records in cloudflare.
//!
//! You can optionally have the controller check the records by doing DNS lookups from 1.1.1.1. The resolution result
//! will be reflected in the `status.pending` field of the `CloudflareDNSRecord` resource. For this to be enabled, set
//! the env var `CHECK_DNS_RESOLUTION` to a human readable duration like `5m` or `1h` or `60s`.
//!
//! You can then create a new DNS record like this:
//!
//! ```yaml
//! apiVersion: dns.cloudflare.com/v1alpha1
//! kind: CloudflareDNSRecord
//! metadata:
//!   name: my-cloudflare-dns-record
//! spec:
//!   name: foo.example.com
//!   type: A
//!   ttl: 3600
//!   content: "1.2.3.4"
//!   zone:
//!     name:
//!       value: example.com
//!   comment: "Managed by the Cloudflare DNS Operator"
//!   tags:
//!     - k8s
//! ```
//!
//! You can also automatically expose IPs from LoadBalancer services or external IP services by referencing a service in
//! the `content` instead of a static IP:
//!
//! ```yaml
//! # ...
//!   content:
//!     service:
//!       name: traefik
//!       namespace: traefik
//! # ...
//! ```
//!
//! The zone can also be set with a `secret` or `configMap` reference like this:
//!
//! ```yaml
//! # ...
//!   zone:
//!     name:
//!       from:
//!         secret:
//!           name: cloudflare-dns-secret
//!           key: zone-name
//! # ...
//! ```
//!
//! See [CloudflareDNSRecordSpec](https://docs.rs/cloudflare-dns-operator/latest/cloudflare_dns_operator/resources/struct.CloudflareDNSRecordSpec.html) for more details.

#[macro_use]
extern crate tracing;

pub mod conditions;
pub mod context;
pub mod dns;
pub mod dns_check;
pub mod reconcile;
pub mod resources;
pub mod services;