Ingress integration (#688)

Ingress integration to allow the optional creation of ingress for a given route. The ingress controller needs to be set up by the user separately so that ingress path is accessible outside the cluster.
This commit is contained in:
Vishal
2018-05-31 11:27:55 +05:30
committed by GitHub
parent fedf6b6e5b
commit a761393816
10 changed files with 249 additions and 9 deletions
+19 -3
View File
@@ -93,6 +93,12 @@ func htCreate(c *cli.Context) error {
}
checkFunctionExistence(client, fnName, fnNamespace)
createIngress := false
if c.IsSet("createingress") {
createIngress = c.Bool("createingress")
}
host := c.String("host")
// just name triggers by uuid.
triggerName := uuid.NewV4().String()
@@ -103,12 +109,14 @@ func htCreate(c *cli.Context) error {
Namespace: fnNamespace,
},
Spec: fission.HTTPTriggerSpec{
Host: host,
RelativeURL: triggerUrl,
Method: getMethod(method),
FunctionReference: fission.FunctionReference{
Type: fission.FunctionReferenceTypeFunctionName,
Name: fnName,
},
CreateIngress: createIngress,
},
}
@@ -157,6 +165,14 @@ func htUpdate(c *cli.Context) error {
ht.Spec.FunctionReference.Name = newFn
}
if c.IsSet("createingress") {
ht.Spec.CreateIngress = c.Bool("createingress")
}
if c.IsSet("host") {
ht.Spec.Host = c.String("host")
}
_, err = client.HTTPTriggerUpdate(ht)
checkErr(err, "update HTTP trigger")
@@ -191,10 +207,10 @@ func htList(c *cli.Context) error {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\n", "NAME", "METHOD", "HOST", "URL", "FUNCTION_NAME")
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\n", "NAME", "METHOD", "HOST", "URL", "INGRESS", "FUNCTION_NAME")
for _, ht := range hts {
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\n",
ht.Metadata.Name, ht.Spec.Method, ht.Spec.Host, ht.Spec.RelativeURL, ht.Spec.FunctionReference.Name)
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\n",
ht.Metadata.Name, ht.Spec.Method, ht.Spec.Host, ht.Spec.RelativeURL, ht.Spec.CreateIngress, ht.Spec.FunctionReference.Name)
}
w.Flush()