Skip to content

Commit

Permalink
feat: added labelSelector for cloud worker
Browse files Browse the repository at this point in the history
  • Loading branch information
siredmar committed Mar 28, 2022
1 parent 806e531 commit 32b6218
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
14 changes: 14 additions & 0 deletions cue/components/cloud-worker.cue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ template: {
]
}

if parameter["labelSelector"] != _|_ {
affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: [{
matchExpressions: [
for v in parameter.labelSelector {
{
key: v
operator: "Exists"
}}
]
}]
}
}
}
}
Expand All @@ -88,6 +99,9 @@ template: {
// +short=i
image: string

// +usage=labelSelector define labels that must be present on cloud nodes to receive the application. If not specified, the application will be deployed to any cloud node.
labelSelector?: [...string]

// +usage=Specify image pull policy for your service
imagePullPolicy?: string

Expand Down
2 changes: 1 addition & 1 deletion cue/components/edge-worker.cue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ template: {
image: string

// +usage=Specify runtimes that shall receive the application. If not specified, the application will be deployed on all runtimes.
runtime: [...string]
runtime?: [...string]

// +usage=Specify image pull policy for your service
imagePullPolicy?: string
Expand Down
13 changes: 9 additions & 4 deletions dev/manifests/applications/mixed-app-network/nats-box.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
name: nats-box
---
apiVersion: core.oam.dev/v1beta1
kind: Application
Expand All @@ -15,6 +11,8 @@ spec:
properties:
image: natsio/nats-box:latest
name: nats-box
runtime:
- mydevice
command:
- /bin/sh
- -c
Expand All @@ -37,6 +35,8 @@ spec:
type: cloud-worker
properties:
image: natsio/nats-box:latest
labelSelector:
- myCloudNode
name: nats-box
command:
- /bin/sh
Expand All @@ -58,3 +58,8 @@ spec:
subjects:
- data
storage: file
---
apiVersion: v1
kind: Namespace
metadata:
name: nats-box
14 changes: 14 additions & 0 deletions manifests/vela-caps/components/cloud-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ spec:
]
}
if parameter["labelSelector"] != _|_ {
affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: [{
matchExpressions: [
for v in parameter.labelSelector {
{
key: v
operator: "Exists"
}},
]
}]
}
}
}
}
Expand All @@ -85,6 +96,9 @@ spec:
// +short=i
image: string
// +usage=labelSelector define labels that must be present on cloud nodes to receive the application. If not specified, the application will be deployed to any cloud node.
labelSelector?: [...string]
// +usage=Specify image pull policy for your service
imagePullPolicy?: string
Expand Down
2 changes: 1 addition & 1 deletion manifests/vela-caps/components/edge-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ spec:
image: string
// +usage=Specify runtimes that shall receive the application. If not specified, the application will be deployed on all runtimes.
runtime: [...string]
runtime?: [...string]
// +usage=Specify image pull policy for your service
imagePullPolicy?: string
Expand Down

0 comments on commit 32b6218

Please sign in to comment.