Skip to content

Commit 916592b

Browse files
authored
Merge pull request #436 from metrue/master
release 0.8.84
2 parents 10946a2 + 33cb4ce commit 916592b

File tree

6 files changed

+39
-13
lines changed

6 files changed

+39
-13
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,26 @@ But we would suggest you run `kubectl config current-context` to check if the cu
206206
* Amazon Elastic Kubernetes Service (EKS)
207207
TODO
208208

209-
* Google Kubernetes Engine (GKET)
210-
TODO
209+
* Google Kubernetes Engine (GKE)
210+
211+
First you should create a Kubernetes cluster in your GKE, then make sure your KUBECONFIG is ready in `~/.kube/config`, if not, you can run following commands,
212+
213+
``` shell
214+
$ gcloud auth login
215+
$ gcloud container clusters get-credentials <your cluster> --zone <zone> --project <project>
216+
```
217+
218+
Then make sure you current context is GKE cluster, you can check it with command,
219+
220+
``` shell
221+
$ kubectl config current-context
222+
```
223+
224+
Then you can deploy your function onto GKE cluster with,
225+
226+
```shell
227+
$ KUBECONFIG=~/.kube/config fx up examples/functions/JavaScript/func.js --name hellojs
228+
```
211229

212230
* Setup your own Kubernetes cluster
213231

fx.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import (
1414
"github.com/metrue/fx/handlers"
1515
"github.com/metrue/fx/middlewares"
1616
"github.com/urfave/cli"
17+
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
1718
)
1819

19-
const version = "0.8.82"
20+
const version = "0.8.84"
2021

2122
func init() {
2223
go checkForUpdate()

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ require (
3939
github.com/spf13/pflag v1.0.5 // indirect
4040
github.com/spf13/viper v1.6.1
4141
github.com/stretchr/testify v1.4.0
42-
github.com/ugorji/go/codec v1.1.7 // indirect
42+
github.com/ugorji/go v1.1.7 // indirect
4343
github.com/urfave/cli v1.22.2
4444
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
4545
golang.org/x/crypto v0.0.0-20191219195013-becbf705a915 // indirect

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
22
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
3+
cloud.google.com/go v0.38.0 h1:ROfEUZz+Gh5pa62DJWXSaonyu3StP6EA6lPEXPI6mCo=
34
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
45
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
56
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=

packer/packer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func Pack(output string, input ...string) error {
7070
return err
7171
}
7272

73-
if isHandler(path) {
73+
if isHandler(path, language) {
7474
if err := copy.Copy(input[0], path); err != nil {
7575
return err
7676
}
@@ -84,7 +84,7 @@ func Pack(output string, input ...string) error {
8484
return nil
8585
}
8686

87-
if !hasFxHandleFile(input...) {
87+
if !hasFxHandleFile(language, input...) {
8888
msg := `it requires a fx handle file when input is not a single file function, e.g.
8989
fx.go for Golang
9090
Fx.java for Java

packer/rules.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,18 @@ var ExtLangMapping = map[string]string{
2323
".pl": "perl",
2424
}
2525

26-
func isHandler(name string) bool {
26+
func isHandler(name string, lang string) bool {
2727
basename := filepath.Base(name)
2828
nameWithoutExt := strings.TrimSuffix(basename, filepath.Ext(basename))
29-
return nameWithoutExt == "fx" ||
30-
nameWithoutExt == "Fx" || // Fx is for Java
31-
nameWithoutExt == "mod" // mod.rs is for Rust
29+
if ExtLangMapping[filepath.Ext(basename)] != lang {
30+
return false
31+
}
32+
33+
return (nameWithoutExt == "fx" ||
34+
// Fx is for Java
35+
nameWithoutExt == "Fx" ||
36+
// mod.rs is for Rust)
37+
nameWithoutExt == "mod")
3238
}
3339

3440
func langFromFileName(fileName string) (string, error) {
@@ -44,10 +50,10 @@ func langFromFileName(fileName string) (string, error) {
4450
return lang, nil
4551
}
4652

47-
func hasFxHandleFile(input ...string) bool {
53+
func hasFxHandleFile(lang string, input ...string) bool {
4854
var handleFile string
4955
for _, file := range input {
50-
if utils.IsRegularFile(file) && isHandler(file) {
56+
if utils.IsRegularFile(file) && isHandler(file, lang) {
5157
handleFile = file
5258
break
5359
} else if utils.IsDir(file) {
@@ -56,7 +62,7 @@ func hasFxHandleFile(input ...string) bool {
5662
return err
5763
}
5864

59-
if utils.IsRegularFile(path) && isHandler(info.Name()) {
65+
if utils.IsRegularFile(path) && isHandler(info.Name(), lang) {
6066
handleFile = path
6167
}
6268
return nil

0 commit comments

Comments
 (0)