Skip to content

Sync Kubernetes HTTPS certificates to cloud services like Tencent Cloud CDN

Notifications You must be signed in to change notification settings

rhyzx/sync-certs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

Install

helm install my-sync-certs --repo https://rhyzx.github.io/sync-certs sync-certs --set env.SECRET_ID=$TENCENT_SECRET_ID,env.SECRET_KEY=$TENCENT_SECRET_KEY

Add labels and annotations to TLS Secret(eg. Secrets generated by CertManager)

kind: Secret
apiVersion: v1
type: kubernetes.io/tls
metadata:
  name: example-tls
  labels:
    sync-certs.io/enable: 'true'
  annotations:
    sync-certs.io/0.adapter: tencent_cloud_cdn
    sync-certs.io/0.domain: test.example.com

Tips

Multiple domains+API keys

Install with

--set env.TENCENT_SECRET_ID=$TENCENT_SECRET_ID,env.ALIYUN_ACCESS_KEY_ID=$ALIYUN_ACCESS_KEY_ID,OTHERS…
metadata:
  annotations:
    sync-certs.io/0.adapter: tencent_cloud_cdn
    sync-certs.io/0.env-prefix: TENCENT_
    sync-certs.io/0.domain: test.example.com
    sync-certs.io/1.adapter: aliyun_cdn
    sync-certs.io/1.env-prefix: ALIYUN_
    sync-certs.io/1.domain: test2.example.com

Enable HTTP2/HSTS for Tencent Cloud CDN

Cause Tencent Cloud will reset HTTPS/HSTS settings after updating, an extra JSON field can be used.

metadata:
  annotations:
    sync-certs.io/0.extra: '{"Http2": "on", "Hsts": {"Switch":"on", "MaxAge": 31536000}}'

Adapters

Name Env requires Extra
tencent_cloud_cdn {PREFIX}SECRET_ID, {PREFIX}SECRET_KEY link
aliyun_cdn {PREFIX}ACCESS_KEY_ID, {PREFIX}ACCESS_KEY_SECRET N/A