Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dns config support #1301

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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