-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcertificate.py
More file actions
55 lines (48 loc) · 1.65 KB
/
certificate.py
File metadata and controls
55 lines (48 loc) · 1.65 KB
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
import json
from scheduler.resources import Resource
from scheduler.exceptions import KubeHTTPException, KubeException
class Certificate(Resource):
def manifest(self, namespace, name, ingress_class, hosts):
data = {
"apiVersion": "certmanager.k8s.io/v1alpha1",
"kind": "Certificate",
"metadata": {
"name": name,
"namespace": namespace
},
"spec": {
"secretName": "%s-auto-tls" % name,
"issuerRef": {
"name": "drycc-controller-letsencrypt",
"kind": "ClusterIssuer"
},
"dnsNames": hosts,
"acme": {
"config": [
{
"http01": {
"ingressClass": ingress_class
},
"domains": hosts
}
]
}
}
}
return data
def get(self, namespace, name):
"""
Fetch a single Ingress or a list of Ingresses
"""
if name is not None:
url = "/apis/certmanager/v1alpha1/namespaces/%s/certificates/%s" % (namespace, name)
message = 'get Ingress ' + name
else:
url = "/apis/certmanager/v1alpha1/namespaces/%s/certificates" % namespace
message = 'get Ingresses'
def create(self, namespace, name, ingress_class, hosts):
pass
def put(self, namespace, name, ingress_class, hosts):
pass
def delete(self, namespace, name):
pass