Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openfaas-faas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Team Jaz CS 598 CCC Final Project
openfaas-faas
Commits
3db2064d
Commit
3db2064d
authored
7 years ago
by
Alex Ellis
Browse files
Options
Downloads
Patches
Plain Diff
Handle constraints
Signed-off-by:
Alex Ellis
<
alexellis2@gmail.com
>
parent
44544d80
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gateway/handlers/createhandler.go
+8
-1
8 additions, 1 deletion
gateway/handlers/createhandler.go
gateway/requests/requests.go
+8
-24
8 additions, 24 deletions
gateway/requests/requests.go
with
16 additions
and
25 deletions
gateway/handlers/createhandler.go
+
8
−
1
View file @
3db2064d
...
...
@@ -62,6 +62,12 @@ func MakeNewFunctionHandler(metricsOptions metrics.MetricOptions, c *client.Clie
func
makeSpec
(
request
*
requests
.
CreateFunctionRequest
,
maxRestarts
uint64
)
swarm
.
ServiceSpec
{
linuxOnlyConstraints
:=
[]
string
{
"node.platform.os == linux"
}
constraints
:=
[]
string
{}
if
request
.
Constraints
!=
nil
&&
len
(
request
.
Constraints
)
>
0
{
constraints
=
request
.
Constraints
}
else
{
constraints
=
linuxOnlyConstraints
}
nets
:=
[]
swarm
.
NetworkAttachmentConfig
{
{
Target
:
request
.
Network
},
...
...
@@ -81,7 +87,7 @@ func makeSpec(request *requests.CreateFunctionRequest, maxRestarts uint64) swarm
},
Networks
:
nets
,
Placement
:
&
swarm
.
Placement
{
Constraints
:
linuxOnlyC
onstraints
,
Constraints
:
c
onstraints
,
},
},
Annotations
:
swarm
.
Annotations
{
...
...
@@ -105,6 +111,7 @@ func makeSpec(request *requests.CreateFunctionRequest, maxRestarts uint64) swarm
return
spec
}
// BuildEncodedAuthConfig for private registry
func
BuildEncodedAuthConfig
(
basicAuthB64
string
,
dockerImage
string
)
(
string
,
error
)
{
// extract registry server address
distributionRef
,
err
:=
reference
.
ParseNormalizedNamed
(
dockerImage
)
...
...
This diff is collapsed.
Click to expand it.
gateway/requests/requests.go
+
8
−
24
View file @
3db2064d
...
...
@@ -7,10 +7,11 @@ package requests
type
CreateFunctionRequest
struct
{
// Service corresponds to a Docker Service
Service
string
`json:"service"`
// Image corresponds to a Docker image
Image
string
`json:"image"`
// Network is
a Docker overlay network in
Swarm -
the
default
value
is func_functions
// Network is
specific to Docker
Swarm - default
overlay network
is
:
func_functions
Network
string
`json:"network"`
// EnvProcess corresponds to the fprocess variable for your container watchdog.
...
...
@@ -23,40 +24,23 @@ type CreateFunctionRequest struct {
// in the same encoded format as Docker native credentials
// (see ~/.docker/config.json)
RegistryAuth
string
`json:"registryAuth,omitempty"`
// Constraints are specific to back-end orchestration platform
Constraints
[]
string
`json:"constraints"`
}
// DeleteFunctionRequest delete a deployed function
type
DeleteFunctionRequest
struct
{
FunctionName
string
`json:"functionName"`
}
type
AlexaSessionApplication
struct
{
ApplicationId
string
`json:"applicationId"`
}
type
AlexaSession
struct
{
SessionId
string
`json:"sessionId"`
Application
AlexaSessionApplication
`json:"application"`
}
type
AlexaIntent
struct
{
Name
string
`json:"name"`
}
type
AlexaRequest
struct
{
Intent
AlexaIntent
`json:"intent"`
}
// AlexaRequestBody top-level request produced by Alexa SDK
type
AlexaRequestBody
struct
{
Session
AlexaSession
`json:"session"`
Request
AlexaRequest
`json:"request"`
}
// PrometheusInnerAlertLabel PrometheusInnerAlertLabel
type
PrometheusInnerAlertLabel
struct
{
AlertName
string
`json:"alertname"`
FunctionName
string
`json:"function_name"`
}
// PrometheusInnerAlert PrometheusInnerAlert
type
PrometheusInnerAlert
struct
{
Status
string
`json:"status"`
Labels
PrometheusInnerAlertLabel
`json:"labels"`
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment