mirror of
				https://github.com/KevinMidboe/cloudflare-ddns.git
				synced 2025-10-29 17:40:17 +00:00 
			
		
		
		
	Hydrate pod virtual env from secret-env-values
This commit is contained in:
		| @@ -12,6 +12,9 @@ spec: | |||||||
|           containers: |           containers: | ||||||
|           - name: cf-ddns |           - name: cf-ddns | ||||||
|             image: ${IMAGE} |             image: ${IMAGE} | ||||||
|  |             envFrom: | ||||||
|  |               - secretRef: | ||||||
|  |                   name: secret-env-values | ||||||
|             imagePullPolicy: IfNotPresent |             imagePullPolicy: IfNotPresent | ||||||
|           restartPolicy: OnFailure |           restartPolicy: OnFailure | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										26
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								README.md
									
									
									
									
									
								
							| @@ -11,7 +11,7 @@ cp .env.example .env | |||||||
|  |  | ||||||
| Fill inn `API_TOKEN` and `ZONE_ID`.  | Fill inn `API_TOKEN` and `ZONE_ID`.  | ||||||
|  |  | ||||||
| `API_TOKEN` should be generated from https://cloudflare.com/profile/generate-token and have access to all zones you wish to  update.  | `API_TOKEN` should be generated from [https://cloudflare.com/profile/generate-token](https://dash.cloudflare.com/profile/api-tokens) and have access to all zones you wish to  update.  | ||||||
|  |  | ||||||
| `ZONE_ID` should be the zone where a `addr` A record that will be compared to actual address to see if it should be updated.  | `ZONE_ID` should be the zone where a `addr` A record that will be compared to actual address to see if it should be updated.  | ||||||
|  |  | ||||||
| @@ -20,7 +20,7 @@ Fill inn `API_TOKEN` and `ZONE_ID`. | |||||||
| Prefered way to Build using dockerfile: | Prefered way to Build using dockerfile: | ||||||
| ``` | ``` | ||||||
| (sudo) docker build -t cloudflare-ddns . | (sudo) docker build -t cloudflare-ddns . | ||||||
| docker run --rm cloudflare-dns | docker run --rm -it cloudflare-dns | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| (Optional Installing python dependencies and running:) | (Optional Installing python dependencies and running:) | ||||||
| @@ -31,3 +31,25 @@ source -p $(which python3) env/bin/activate | |||||||
| pip install -r requirements.txt | pip install -r requirements.txt | ||||||
| python main.py | python main.py | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | ## Kubernetes | ||||||
|  |  | ||||||
|  | I am currenly running in kubernetes cluster as a cronjob checking periodically. Substitute `${IMAGE}` in `job.yml` manually or using CI script similar to: https://github.com/KevinMidboe/cloudflare-ddns/blob/main/.drone.yml#L49-L51.  | ||||||
|  |  | ||||||
|  | After job is created you also want to set environment variables from kubernetes secret, example `.kuberenetes/secret.yml`: | ||||||
|  |  | ||||||
|  | ```yaml | ||||||
|  | apiVersion: v1 | ||||||
|  | kind: Secret | ||||||
|  | metadata: | ||||||
|  |   name: secret-env-values | ||||||
|  |   namespace: cloudflare-ddns | ||||||
|  | type: Opaque | ||||||
|  | data: | ||||||
|  |   API_KEY: BASE_64_ENCODED_CLOUDFLARE_API_KEY | ||||||
|  |   DDNS_ZONE: BASE64_ENCODED_CLOUDFLARE_ZONE_ID | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | kubectl apply -f .kuberenetes/secret.yml | ||||||
|  | ``` | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user