Skip to content

Commit

Permalink
Add dns config support
Browse files Browse the repository at this point in the history
  • Loading branch information
xianlubird authored and xianlu committed Apr 2, 2019
1 parent 850f3f1 commit 0759168
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,10 @@
"description": "Arguments contain the parameters and artifacts sent to the workflow entrypoint Parameters are referencable globally using the 'workflow' variable prefix. e.g. {{workflow.parameters.myparam}}",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Arguments"
},
"dnsConfig": {
"description": "PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.",
"$ref": "#/definitions/io.k8s.api.core.v1.PodDNSConfig"
},
"dnsPolicy": {
"description": "Set DNS policy for the pod. Defaults to \"ClusterFirst\". Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. DNS parameters given in DNSConfig will be merged with the policy selected with DNSPolicy. To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.",
"type": "string"
Expand Down
22 changes: 22 additions & 0 deletions examples/dns-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow # new type of k8s spec
metadata:
generateName: test-dns-config- # name of the workflow spec
spec:
entrypoint: whalesay # invoke the whalesay template
templates:
- name: whalesay # name of the template
container:
image: docker/whalesay
command: [cowsay]
args: ["hello world"]
resources: # limit the resources
limits:
memory: 32Mi
cpu: 100m
dnsConfig:
nameservers:
- 1.2.3.4
options:
- name: ndots
value: "2"
8 changes: 7 additions & 1 deletion pkg/apis/workflow/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/apis/workflow/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ type WorkflowSpec struct {
// explicitly to 'ClusterFirstWithHostNet'.
DNSPolicy *apiv1.DNSPolicy `json:"dnsPolicy,omitempty"`

// PodDNSConfig defines the DNS parameters of a pod in addition to
// those generated from DNSPolicy.
DNSConfig *apiv1.PodDNSConfig `json:"dnsConfig,omitempty"`

// OnExit is a template reference which is invoked at the end of the
// workflow, irrespective of the success, failure, or error of the
// primary workflow.
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/workflow/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ func (woc *wfOperationCtx) createWorkflowPod(nodeName string, mainCtr apiv1.Cont
pod.Spec.DNSPolicy = *woc.wf.Spec.DNSPolicy
}

if woc.wf.Spec.DNSConfig != nil {
pod.Spec.DNSConfig = woc.wf.Spec.DNSConfig
}

if woc.controller.Config.InstanceID != "" {
pod.ObjectMeta.Labels[common.LabelKeyControllerInstanceID] = woc.controller.Config.InstanceID
}
Expand Down

0 comments on commit 0759168

Please sign in to comment.