Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Commit

Permalink
Spelling (#35)
Browse files Browse the repository at this point in the history
Fix spelling errors
  • Loading branch information
jsoref authored and nicholasjackson committed Sep 5, 2018
1 parent 070c68f commit fce8be4
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -254,7 +254,7 @@ That is all there is to it, checkout the OpenFaaS community page for some inspir
[faas/community.md at master · openfaas/faas · GitHub](https://github.com/openfaas/faas/blob/master/community.md)
### Datacenters and Constraints
By default the Nomad provider will use a default datacenter for a deployed function of `dc1`, this can be overridden by setting the label `datacenters`, which takes a comma separated list of datacenters to deploy the funtion into. Contstraints for limiting CPU and memory can also be set `memory` is an integer representing Megabytes, `cpu` is an integer representing MHz of CPU where 1024 equals one core.
By default the Nomad provider will use a default datacenter for a deployed function of `dc1`, this can be overridden by setting the label `datacenters`, which takes a comma separated list of datacenters to deploy the function into. Constraints for limiting CPU and memory can also be set `memory` is an integer representing Megabytes, `cpu` is an integer representing MHz of CPU where 1024 equals one core.
i.e.
```bash
Expand All @@ -272,7 +272,7 @@ functions:
memory: 512
cpu: 1000
labels:
datacentres: "dc1"
datacenters: "dc1"
```
### Async functions
Expand Down
4 changes: 2 additions & 2 deletions consul/mock_watcher_test.go
Expand Up @@ -25,8 +25,8 @@ func (m *MockWatcher) Remove(d dependency.Dependency) bool {
return args.Get(0).(bool)
}

// ItterateDataCh itterates over the watchers data channel and calls a function
func (m *MockWatcher) ItterateDataCh(f itterateFunc) {
// IterateDataCh iterates over the watchers data channel and calls a function
func (m *MockWatcher) IterateDataCh(f iterateFunc) {
args := m.Mock.Called(f)
dep := args.Get(0).(dependency.Dependency)

Expand Down
10 changes: 5 additions & 5 deletions consul/service_resolver.go
Expand Up @@ -31,10 +31,10 @@ type WrappedWatcher struct {
*watch.Watcher
}

type itterateFunc func(dep dependency.Dependency, deps []*dependency.CatalogService)
type iterateFunc func(dep dependency.Dependency, deps []*dependency.CatalogService)

// ItterateDataCh returns the list of CatalogService from the View
func (ww *WrappedWatcher) ItterateDataCh(f itterateFunc) {
// IterateDataCh returns the list of CatalogService from the View
func (ww *WrappedWatcher) IterateDataCh(f iterateFunc) {
for cs := range ww.DataCh() {
f(
cs.Dependency(),
Expand All @@ -47,7 +47,7 @@ func (ww *WrappedWatcher) ItterateDataCh(f itterateFunc) {
type Watcher interface {
Add(dependency dependency.Dependency) (bool, error)
Remove(dependency dependency.Dependency) bool
ItterateDataCh(itterateFunc)
IterateDataCh(iterateFunc)
}

// ServiceResolver uses consul to resolve a function name into addresses
Expand Down Expand Up @@ -139,7 +139,7 @@ func (sr *Resolver) RemoveCacheItem(function string) {

// watch watches consul for changes and updates the cache on change
func (sr *Resolver) watch() {
sr.watcher.ItterateDataCh(
sr.watcher.IterateDataCh(
func(dep dependency.Dependency, deps []*dependency.CatalogService) {
sr.updateCatalog(dep, deps)
},
Expand Down
4 changes: 2 additions & 2 deletions consul/service_resolver_test.go
Expand Up @@ -27,7 +27,7 @@ func setup(t *testing.T, queryError error) (*Resolver, *MockWatcher, *cache.Cach
watcher := &MockWatcher{data: make(chan []*dependency.CatalogService)}
watcher.On("Add", mock.Anything).Return(true, nil)
watcher.On("Remove", mock.Anything).Return(true)
watcher.On("ItterateDataCh", mock.Anything).Return(serviceQuery)
watcher.On("IterateDataCh", mock.Anything).Return(serviceQuery)

pc := cache.New(5*time.Minute, 10*time.Minute)
return &Resolver{
Expand All @@ -44,7 +44,7 @@ func setup(t *testing.T, queryError error) (*Resolver, *MockWatcher, *cache.Cach
serviceQuery
}

func TestResolveWithCachReturnsURLS(t *testing.T) {
func TestResolveWithCacheReturnsURLS(t *testing.T) {
address := "http://mytest.com"
r, _, c, sq := setup(t, nil)
c.Add(sq.String(), &cacheItem{addresses: []string{address}}, cache.DefaultExpiration)
Expand Down
4 changes: 2 additions & 2 deletions handlers/deploy.go
Expand Up @@ -22,7 +22,7 @@ var (
restartAttempts = 25
logFiles = 5
logSize = 2
ephermerialDiskSize = 20
ephemeralDiskSize = 20

// Constraints
constraintCPUArch = "amd64"
Expand Down Expand Up @@ -109,7 +109,7 @@ func createTaskGroup(r requests.CreateFunctionRequest) []*api.TaskGroup {
Attempts: &restartAttempts,
},
EphemeralDisk: &api.EphemeralDisk{
SizeMB: &ephermerialDiskSize,
SizeMB: &ephemeralDiskSize,
},
Tasks: []*api.Task{task},
},
Expand Down
2 changes: 1 addition & 1 deletion handlers/get_function_middleware.go
Expand Up @@ -7,7 +7,7 @@ import (
)

// FunctionNameCTXKey is a context key which points to the location of the function
// name set bu the ExtractFunctiopn middleware
// name set bu the ExtractFunction middleware
var FunctionNameCTXKey = struct{}{}

// MakeExtractFunctionMiddleWare returns a middleware handler which validates
Expand Down
2 changes: 1 addition & 1 deletion handlers/mock_proxy_client.go
Expand Up @@ -17,7 +17,7 @@ func (mp *MockProxyClient) GetFunctionName(r *http.Request) string {
return args.Get(0).(string)
}

// CallAndReturnResponse returns a mock respoonse
// CallAndReturnResponse returns a mock response
func (mp *MockProxyClient) CallAndReturnResponse(address string, body []byte, h http.Header) (
[]byte, http.Header, error) {
args := mp.Called(address, body, h)
Expand Down
2 changes: 1 addition & 1 deletion handlers/proxy_client.go
Expand Up @@ -53,7 +53,7 @@ func (pc *HTTPProxyClient) GetFunctionName(r *http.Request) string {
return vars["name"]
}

// CallAndReturnResponse calls the function and resturns the response
// CallAndReturnResponse calls the function and returns the response
func (pc *HTTPProxyClient) CallAndReturnResponse(address string, body []byte, headers http.Header) (
[]byte, http.Header, error) {

Expand Down
2 changes: 1 addition & 1 deletion handlers/replication_reader_test.go
Expand Up @@ -43,7 +43,7 @@ func TestMiddlewareReturns404WhenNotFound(t *testing.T) {
assert.Equal(t, rr.Code, http.StatusNotFound)
}

func TestReplicationRReturnsFunctionWhenFound(t *testing.T) {
func TestReplicationReturnsFunctionWhenFound(t *testing.T) {
functionName := "tester"
jobName := nomad.JobPrefix + functionName

Expand Down
54 changes: 27 additions & 27 deletions main.go
Expand Up @@ -28,83 +28,83 @@ var (
nodeURI = flag.String("node_addr", "localhost", "URI of the current Nomad node, this address is used for reporting and logging")
nomadAddr = flag.String("nomad_addr", "localhost:4646", "Address for Nomad API endpoint")
consulAddr = flag.String("consul_addr", "http://localhost:8500", "Address for Consul API endpoint")
nomadRegion = flag.String("nomad_region", "global", "Default region to schedlue functions in")
nomadRegion = flag.String("nomad_region", "global", "Default region to schedule functions in")
)

var functionTimeout = flag.Duration("function_timeout", 30*time.Second, "Timeout for function execution")

var (
loggerFormat = flag.String("logger_format", "text", "Format for log output text | json")
loggerLevel = flag.String("logger_level", "INFO", "Log output level INFO | ERROR | DEBUG | TRACE")
loggerOutput = flag.String("logger_output", "", "Filepath to write log file, if ommited stdOut is used")
loggerOutput = flag.String("logger_output", "", "Filepath to write log file, if omitted stdOut is used")
)

// parseDeprecatedEnvironment is used to merge the previous environment variable configutaion to the new flag style
// parseDeprecatedEnvironment is used to merge the previous environment variable configuration to the new flag style
// this will be removed in the next release
func parseDeprecatedEnvironment() {
checkDepricatedStatsD()
checkDepricatedNomadHTTP()
checkDepricatedNomadAddr()
checkDepricatedConsulAddr()
checkDepricatedNomadRegion()
checkDepricatedLoggerLevel()
checkDepricatedLoggerFormat()
checkDepricatedLoggerOutput()
checkDeprecatedStatsD()
checkDeprecatedNomadHTTP()
checkDeprecatedNomadAddr()
checkDeprecatedConsulAddr()
checkDeprecatedNomadRegion()
checkDeprecatedLoggerLevel()
checkDeprecatedLoggerFormat()
checkDeprecatedLoggerOutput()
}

func checkDepricatedStatsD() {
func checkDeprecatedStatsD() {
if env := os.Getenv("STATSD_ADDR"); env != "" {
*statsdServer = env
log.Println("The environment variable STATSD_ADDR is depricated please use the command line flag stasd_server")
log.Println("The environment variable STATSD_ADDR is deprecated please use the command line flag stasd_server")
}
}

func checkDepricatedNomadHTTP() {
func checkDeprecatedNomadHTTP() {
if env := os.Getenv("NOMAD_ADDR_http"); env != "" {
*nodeURI = env
log.Println("The environment variable NOMAD_ADDR_http is depricated please use the command line flag node_uri")
log.Println("The environment variable NOMAD_ADDR_http is deprecated please use the command line flag node_uri")
}
}

func checkDepricatedNomadAddr() {
func checkDeprecatedNomadAddr() {
if env := os.Getenv("NOMAD_ADDR"); env != "" {
*nomadAddr = env
log.Println("The environment variable NOMAD_ADDR is depricated please use the command line flag nomad_addr")
log.Println("The environment variable NOMAD_ADDR is deprecated please use the command line flag nomad_addr")
}
}

func checkDepricatedConsulAddr() {
func checkDeprecatedConsulAddr() {
if env := os.Getenv("CONSUL_ADDR"); env != "" {
*consulAddr = env
log.Println("The environment variable CONSUL_ADDR is depricated please use the command line flag consul_addr")
log.Println("The environment variable CONSUL_ADDR is deprecated please use the command line flag consul_addr")
}
}

func checkDepricatedNomadRegion() {
func checkDeprecatedNomadRegion() {
if env := os.Getenv("NOMAD_REGION"); env != "" {
*nomadRegion = env
log.Println("The environment variable NOMAD_REGION is depricated please use the command line flag nomad_region")
log.Println("The environment variable NOMAD_REGION is deprecated please use the command line flag nomad_region")
}
}

func checkDepricatedLoggerLevel() {
func checkDeprecatedLoggerLevel() {
if env := os.Getenv("logger_level"); env != "" {
*loggerLevel = env
log.Println("The environment variable logger_level is depricated please use the command line flag logger_level")
log.Println("The environment variable logger_level is deprecated please use the command line flag logger_level")
}
}

func checkDepricatedLoggerFormat() {
func checkDeprecatedLoggerFormat() {
if env := os.Getenv("logger_format"); env != "" {
*loggerFormat = env
log.Println("The environment variable logger_format is depricated please use the command line flag logger_format")
log.Println("The environment variable logger_format is deprecated please use the command line flag logger_format")
}
}

func checkDepricatedLoggerOutput() {
func checkDeprecatedLoggerOutput() {
if env := os.Getenv("logger_output"); env != "" {
*loggerOutput = env
log.Println("The environment variable logger_output is depricated please use the command line flag logger_output")
log.Println("The environment variable logger_output is deprecated please use the command line flag logger_output")
}
}

Expand Down
2 changes: 1 addition & 1 deletion nomad/mock_job.go
Expand Up @@ -10,7 +10,7 @@ type MockJob struct {
mock.Mock
}

// Register is a mock implementaion of the register interface method
// Register is a mock implementation of the register interface method
func (m *MockJob) Register(job *api.Job, options *api.WriteOptions) (
*api.JobRegisterResponse,
*api.WriteMeta, error) {
Expand Down
4 changes: 2 additions & 2 deletions nomad_job_files/faas_ddog.hcl
Expand Up @@ -134,7 +134,7 @@ logs:
# port / path : (mandatory) Set port if type is tcp or udp. Set path if type is file
# service : (mandatory) name of the service owning the log
# source : (mandatory) attribute that defines which integration is sending the logs
# sourcecategory : (optional) Multiple value attribute. Can be used to refine the source attribtue
# sourcecategory : (optional) Multiple value attribute. Can be used to refine the source attribute
# tags: (optional) add tags to each logs collected
- type: file
Expand All @@ -161,7 +161,7 @@ logs:
# port / path : (mandatory) Set port if type is tcp or udp. Set path if type is file
# service : (mandatory) name of the service owning the log
# source : (mandatory) attribute that defines which integration is sending the logs
# sourcecategory : (optional) Multiple value attribute. Can be used to refine the source attribtue
# sourcecategory : (optional) Multiple value attribute. Can be used to refine the source attribute
# tags: (optional) add tags to each logs collected
- type: file
Expand Down
2 changes: 1 addition & 1 deletion terraform/README.md
Expand Up @@ -89,4 +89,4 @@ You can now interact with OpenFaaS using the ALB which has been created, to see
terraform output
```

Please see the main README in the root of this repository for infomation on running and creating jobs with OpenFaaS.
Please see the main README in the root of this repository for information on running and creating jobs with OpenFaaS.

0 comments on commit fce8be4

Please sign in to comment.