File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ const k8s = require ( '@kubernetes/client-node' )
2
+ const kc = new k8s . KubeConfig ( )
3
+ kc . loadFromDefault ( )
4
+
5
+ const k8sApi = kc . makeApiClient ( k8s . NetworkingV1beta1Api ) // before 1.14 use extensions/v1beta1
6
+ const clientIdentifier = 'my-subdomain'
7
+
8
+ k8sApi . createNamespacedIngress ( 'default' , {
9
+ apiVersions : 'networking.k8s.io/v1beta1' ,
10
+ kind : 'Ingress' ,
11
+ metadata : { name : `production-custom-${ clientIdentifier } ` } ,
12
+ spec : {
13
+ rules : [ {
14
+ host : `${ clientIdentifier } .example.com` ,
15
+ http : {
16
+ paths : [ {
17
+ backend : {
18
+ serviceName : 'production-auto-deploy' ,
19
+ servicePort : 5000
20
+ } ,
21
+ path : '/'
22
+ } ]
23
+ }
24
+ } ] ,
25
+ tls : [ { hosts : [ `${ clientIdentifier } .example.com` ] } ]
26
+ }
27
+ } ) . catch ( e => console . log ( e ) )
You can’t perform that action at this time.
0 commit comments