Skip to content

Commit cc58d66

Browse files
committed
Removes all references to ecs and uses fargate naming
Signed-off-by: Edward Wilde <[email protected]>
1 parent 3d38d9c commit cc58d66

26 files changed

+137
-117
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
## Motivation and Context
77
<!--- Why is this change required? What problem does it solve? -->
88
<!--- If it fixes an open issue, please link to the issue here. -->
9-
- [ ] I have raised an issue to propose this change ([required](https://github.com/ewilde/faas-ecs/blob/master/CONTRIBUTING.md))
9+
- [ ] I have raised an issue to propose this change ([required](https://github.com/ewilde/faas-fargate/blob/master/CONTRIBUTING.md))
1010

1111

1212
## How Has This Been Tested?
@@ -27,7 +27,7 @@
2727
- [ ] My code follows the code style of this project.
2828
- [ ] My change requires a change to the documentation.
2929
- [ ] I have updated the documentation accordingly.
30-
- [ ] I've read the [CONTRIBUTION](https://github.com/ewilde/faas-ecs/blob/master/CONTRIBUTING.md) guide
30+
- [ ] I've read the [CONTRIBUTION](https://github.com/ewilde/faas-fargate/blob/master/CONTRIBUTING.md) guide
3131
- [ ] I have signed-off my commits with `git commit -s`
3232
- [ ] I have added tests to cover my changes.
3333
- [ ] All new and existing tests passed.

.goreleaser.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
builds:
2-
- binary: faas-ecs
2+
- binary: faas-fargate
33
goos:
44
- linux
55
goarch:

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ before_script:
1717

1818
after_success:
1919
- if [ ! -z "$TRAVIS_TAG" ] ; then
20-
docker tag ewilde/faas-ecs:latest ewilde/faas-ecs:$TRAVIS_TAG;
20+
docker tag ewilde/faas-fargate:latest ewilde/faas-fargate:$TRAVIS_TAG;
2121
echo $DOCKER_PASSWORD | docker login -u=$DOCKER_USERNAME --password-stdin;
22-
docker push $DOCKER_NS/faas-ecs:$TRAVIS_TAG;
23-
docker push $DOCKER_NS/faas-ecs:latest;
22+
docker push $DOCKER_NS/faas-fargate:$TRAVIS_TAG;
23+
docker push $DOCKER_NS/faas-fargate:latest;
2424
fi
2525
script:
2626
- make build

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ Guidelines for contributing.
88

99
We have a number of areas where we can accept contributions:
1010

11-
* Work on [missing features and bugs](https://github.com/ewilde/faas-ecs/issues)
11+
* Work on [missing features and bugs](https://github.com/ewilde/faas-fargate/issues)
1212

1313

1414
### I've found a typo
1515

16-
* A Pull Request is not necessary. Raise an [Issue](https://github.com/ewilde/faas-ecs/issues) and we'll fix it as soon as we can.
16+
* A Pull Request is not necessary. Raise an [Issue](https://github.com/ewilde/faas-fargate/issues) and we'll fix it as soon as we can.
1717

1818
### I have a (great) idea
1919

20-
The maintainers would like to make faas-ecs the best it can be and welcome new contributions that align with the project's goals.
20+
The maintainers would like to make faas-fargate the best it can be and welcome new contributions that align with the project's goals.
2121
Our time is limited so we'd like to make sure we agree on the proposed work before you spend time doing it.
2222
Saying "no" is hard which is why we'd rather say "yes" ahead of time. You need to raise a proposal.
2323

@@ -65,7 +65,7 @@ Here's an example:
6565
```
6666
Add secrets to provider
6767
68-
We need to have the ability to pass secrets to faas-ecs securely.
68+
We need to have the ability to pass secrets to faas-fargate securely.
6969
This commits adds secrets support using AWS Secrets Manager API.
7070
7171
Resolves #1

Dockerfile

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ FROM golang:1.10.2-alpine3.7
33
RUN apk --no-cache add git curl
44
RUN go get golang.org/x/tools/cmd/goimports
55

6-
RUN mkdir -p /go/src/github.com/ewilde/faas-ecs/
6+
RUN mkdir -p /go/src/github.com/ewilde/faas-fargate/
77

8-
WORKDIR /go/src/github.com/ewilde/faas-ecs
8+
WORKDIR /go/src/github.com/ewilde/faas-fargate
99

1010
COPY . .
1111

@@ -17,10 +17,10 @@ RUN goimports -l -d $(find . -type f -name '*.go' -not -path "./vendor/*") \
1717
&& GIT_COMMIT_SHA=$(git rev-list -1 HEAD) \
1818
&& GIT_COMMIT_MESSAGE=$(git log -1 --pretty=%B 2>&1 | head -n 1) \
1919
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w \
20-
-X github.com/ewilde/faas-ecs/version.GitCommitSHA=${GIT_COMMIT_SHA}\
21-
-X \"github.com/ewilde/faas-ecs/version.GitCommitMessage=${GIT_COMMIT_MESSAGE}\"\
22-
-X github.com/ewilde/faas-ecs/version.Version=${VERSION}" \
23-
-a -installsuffix cgo -o faas-ecs .
20+
-X github.com/ewilde/faas-fargate/version.GitCommitSHA=${GIT_COMMIT_SHA}\
21+
-X \"github.com/ewilde/faas-fargate/version.GitCommitMessage=${GIT_COMMIT_MESSAGE}\"\
22+
-X github.com/ewilde/faas-fargate/version.Version=${VERSION}" \
23+
-a -installsuffix cgo -o faas-fargate .
2424

2525
FROM alpine:3.7
2626

@@ -35,9 +35,9 @@ EXPOSE 8080
3535
ENV http_proxy ""
3636
ENV https_proxy ""
3737

38-
COPY --from=0 /go/src/github.com/ewilde/faas-ecs/faas-ecs .
38+
COPY --from=0 /go/src/github.com/ewilde/faas-fargate/faas-fargate .
3939
RUN chown -R app:app ./
4040

4141
USER app
4242

43-
CMD ["./faas-ecs"]
43+
CMD ["./faas-fargate"]

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local-build: goimportscheck vet
1515
@echo "Build succeeded"
1616

1717
build:
18-
docker build -t ewilde/faas-ecs:$(TAG) . --squash=${SQUASH}
18+
docker build -t ewilde/faas-fargate:$(TAG) . --squash=${SQUASH}
1919

2020
release:
2121
go get github.com/goreleaser/goreleaser; \
@@ -40,8 +40,8 @@ vet:
4040
fi
4141

4242
lint:
43-
@echo "go lint ."
44-
@golint $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \
43+
@echo "golint ."
44+
@golint -set_exit_status $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \
4545
echo ""; \
4646
echo "Lint found errors in the source code. Please check the reported errors"; \
4747
echo "and fix them if necessary before submitting the code for review."; \

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<p align="center">
22
<img alt="Mascot" src="docs/mascot.png" />
3-
<h3 align="center">faas-ecs</h3>
3+
<h3 align="center">faas-fargate</h3>
44
<p align="center">Run OpenFaaS on AWS serverless with Fargate.</p>
55
<p align="center">
6-
<a href="https://github.com/goreleaser/goreleaser/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/ewilde/faas-ecs.svg?style=flat-square"></a>
6+
<a href="https://github.com/goreleaser/goreleaser/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/ewilde/faas-fargate.svg?style=flat-square"></a>
77
<a href="/LICENSE.md"><img alt="Software License" src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square"></a>
8-
<a href="https://travis-ci.org/ewilde/faas-ecs"><img alt="Travis" src="https://img.shields.io/travis/ewilde/faas-ecs/master.svg?style=flat-square"></a>
8+
<a href="https://travis-ci.org/ewilde/faas-fargate"><img alt="Travis" src="https://img.shields.io/travis/ewilde/faas-fargate/master.svg?style=flat-square"></a>
99
<a href="https://github.com/goreleaser"><img alt="Powered By: GoReleaser" src="https://img.shields.io/badge/powered%20by-goreleaser-green.svg?style=flat-square"></a>
1010
</p>
1111
</p>
@@ -14,22 +14,22 @@
1414

1515
## Installation
1616
### Terraform deployment
17-
_**Easy to get started**_: A [terraform module](https://github.com/ewilde/terraform-aws-openfaas-ecs) has been developed
18-
to build out a standard deployment of `faas-ecs` on `fargate`. See: https://github.com/ewilde/terraform-aws-openfaas-ecs.
17+
_**Easy to get started**_: A [terraform module](https://github.com/ewilde/terraform-aws-openfaas-fargate) has been developed
18+
to build out a standard deployment of `faas-fargate` on `fargate`. See: https://github.com/ewilde/terraform-aws-openfaas-fargate.
1919
This module deploys the whole stack on Fargate including openfaas `gateway`, `nats` and sets up default security setting
2020
etc...
2121

2222
### Manually
23-
1. Use the [published docker image](https://hub.docker.com/r/ewilde/faas-ecs/)
24-
2. Download from the [releases tab](https://github.com/ewilde/faas-ecs/releases)
23+
1. Use the [published docker image](https://hub.docker.com/r/ewilde/faas-fargate/)
24+
2. Download from the [releases tab](https://github.com/ewilde/faas-fargate/releases)
2525

2626
## Configuration
2727
All configuration is managed using environment variables
2828

2929
| Option | Usage | Default | Required |
3030
|-----------------------------------|------------------------------------------------------------------------------------------------|--------------------------|----------|
3131
| `subnet_ids` | Comma separated list of subnet ids used to place function | subnets from default vpc | no |
32-
| `security_group_id` | Id of the security group to assign functions. If using [terraform-aws-openfaas-ecs](https://github.com/ewilde/terraform-aws-openfaas-ecs) this is the output variable `service_security_group` | | no |
32+
| `security_group_id` | Id of the security group to assign functions. If using [terraform-aws-openfaas-fargate](https://github.com/ewilde/terraform-aws-openfaas-fargate) this is the output variable `service_security_group` | | no |
3333
| `cluster_name` | Name of the AWS ECS cluster. | `openfaas` | no |
3434
| `assign_public_ip` | Whether or not to associate a public ip address with your function. | `DISABLED` | no |
3535
| `enable_function_readiness_probe` | Boolean - enable a readiness probe to test functions. | `true` | no |
@@ -57,5 +57,5 @@ git push origin v0.5.7
5757
Travis will:
5858
1. build the release
5959
1. run tests
60-
1. push to [docker](https://hub.docker.com/r/ewilde/faas-ecs/)
61-
1. create a github release on the [releases tab](https://github.com/ewilde/faas-ecs/releases)
60+
1. push to [docker](https://hub.docker.com/r/ewilde/faas-fargate/)
61+
1. create a github release on the [releases tab](https://github.com/ewilde/faas-fargate/releases)

aws/api.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package aws
22

33
import "github.com/aws/aws-sdk-go/service/ecs"
44

5+
// KeyValuePairGetValue searches the array of values and returns the matching name or nil if none are found.
56
func KeyValuePairGetValue(name string, values []*ecs.KeyValuePair) (*string, bool) {
67
for _, item := range values {
78
if *item.Name == name {

aws/autonaming.go

+29-27
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,34 @@ package aws
33
import (
44
"sync"
55

6-
"github.com/aws/aws-sdk-go/service/servicediscovery"
7-
log "github.com/sirupsen/logrus"
8-
"github.com/aws/aws-sdk-go/aws"
9-
"github.com/satori/go.uuid"
106
"errors"
117
"fmt"
8+
9+
"github.com/aws/aws-sdk-go/aws"
10+
"github.com/aws/aws-sdk-go/service/servicediscovery"
11+
"github.com/satori/go.uuid"
12+
log "github.com/sirupsen/logrus"
1213
)
1314

1415
const namespace = "openfaas.local"
16+
1517
var once = &sync.Once{}
16-
var namespaceId *string
18+
var namespaceID *string
1719

18-
func ensureServiceRegistrationExists(discovery *servicediscovery.ServiceDiscovery, serviceName string, vpcId string) (string, error) {
20+
func ensureServiceRegistrationExists(discovery *servicediscovery.ServiceDiscovery, serviceName string, vpcID string) (string, error) {
1921

20-
namespaceId, err := ensureDnsNamespaceExists(discovery, vpcId)
22+
namespaceID, err := ensureDNSNamespaceExists(discovery, vpcID)
2123
if err != nil {
2224
log.Errorln("error ensuring dns namespace existing. ", err)
2325
return "", err
2426
}
2527

2628
listResults, err := discovery.ListServices(&servicediscovery.ListServicesInput{
27-
Filters:[]*servicediscovery.ServiceFilter {
29+
Filters: []*servicediscovery.ServiceFilter{
2830
{
2931
Name: aws.String("NAMESPACE_ID"),
3032
Values: []*string{
31-
namespaceId,
33+
namespaceID,
3234
},
3335
},
3436
},
@@ -48,21 +50,21 @@ func ensureServiceRegistrationExists(discovery *servicediscovery.ServiceDiscover
4850
}
4951

5052
if serviceArn == "" {
51-
requestId := uuid.NewV4()
53+
requestID := uuid.NewV4()
5254
createResult, err := discovery.CreateService(&servicediscovery.CreateServiceInput{
53-
Name: aws.String(serviceName),
54-
CreatorRequestId: aws.String(requestId.String()),
55-
Description: aws.String(fmt.Sprintf("Openfaas auto-naming service for %s", serviceName)),
56-
DnsConfig: &servicediscovery.DnsConfig {
57-
NamespaceId: namespaceId,
55+
Name: aws.String(serviceName),
56+
CreatorRequestId: aws.String(requestID.String()),
57+
Description: aws.String(fmt.Sprintf("Openfaas auto-naming service for %s", serviceName)),
58+
DnsConfig: &servicediscovery.DnsConfig{
59+
NamespaceId: namespaceID,
5860
DnsRecords: []*servicediscovery.DnsRecord{
5961
{
6062
Type: aws.String("A"),
61-
TTL: aws.Int64(10),
63+
TTL: aws.Int64(10),
6264
},
6365
},
6466
},
65-
HealthCheckCustomConfig: &servicediscovery.HealthCheckCustomConfig {
67+
HealthCheckCustomConfig: &servicediscovery.HealthCheckCustomConfig{
6668
FailureThreshold: aws.Int64(1),
6769
},
6870
})
@@ -78,7 +80,7 @@ func ensureServiceRegistrationExists(discovery *servicediscovery.ServiceDiscover
7880
return serviceArn, nil
7981
}
8082

81-
func ensureDnsNamespaceExists(discovery *servicediscovery.ServiceDiscovery, vpcId string) (id *string, err error) {
83+
func ensureDNSNamespaceExists(discovery *servicediscovery.ServiceDiscovery, vpcID string) (id *string, err error) {
8284
once.Do(func() {
8385
var found bool
8486

@@ -89,12 +91,12 @@ func ensureDnsNamespaceExists(discovery *servicediscovery.ServiceDiscovery, vpcI
8991
}
9092

9193
if !found {
92-
requestId := uuid.NewV4()
93-
_ , err = discovery.CreatePrivateDnsNamespace(&servicediscovery.CreatePrivateDnsNamespaceInput{
94-
Name: aws.String(namespace),
95-
CreatorRequestId: aws.String(requestId.String()),
96-
Description: aws.String("Openfaas private DNS namespace"),
97-
Vpc: aws.String(vpcId),
94+
requestID := uuid.NewV4()
95+
_, err = discovery.CreatePrivateDnsNamespace(&servicediscovery.CreatePrivateDnsNamespaceInput{
96+
Name: aws.String(namespace),
97+
CreatorRequestId: aws.String(requestID.String()),
98+
Description: aws.String("Openfaas private DNS namespace"),
99+
Vpc: aws.String(vpcID),
98100
})
99101

100102
if err != nil {
@@ -114,10 +116,10 @@ func ensureDnsNamespaceExists(discovery *servicediscovery.ServiceDiscovery, vpcI
114116
}
115117
}
116118

117-
namespaceId = id
119+
namespaceID = id
118120
})
119121

120-
return namespaceId, err
122+
return namespaceID, err
121123
}
122124

123125
func findNamespace(discovery *servicediscovery.ServiceDiscovery) (*string, bool, error) {
@@ -130,7 +132,7 @@ func findNamespace(discovery *servicediscovery.ServiceDiscovery) (*string, bool,
130132

131133
found := false
132134
var id *string
133-
for _, item := range listResult.Namespaces {
135+
for _, item := range listResult.Namespaces {
134136
if aws.StringValue(item.Name) == namespace {
135137
id = item.Id
136138
found = true

0 commit comments

Comments
 (0)