Skip to content

Commit

Permalink
DOCD-1243 Declare httpHeaders as ListField(HTTPHeader)
Browse files Browse the repository at this point in the history
The httpHeaders field doesn't deserialize to dict and thus to json correctly since it is just declared as a list.
  • Loading branch information
oyvindio committed Nov 22, 2017
1 parent 803ca33 commit 1c5993a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions k8s/models/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ class VolumeMount(Model):
mountPath = Field(six.text_type)


class HTTPHeader(Model):
name = Field(six.text_type)
value = Field(six.text_type)


class HTTPGetAction(Model):
path = Field(six.text_type)
port = Field(six.text_type, alt_type=int)
scheme = Field(six.text_type, "HTTP")
httpHeaders = Field(list, None)


class HTTPHeader(Model):
name = Field(six.text_type)
value = Field(six.text_type)
httpHeaders = ListField(HTTPHeader)


class TCPSocketAction(Model):
Expand Down
6 changes: 3 additions & 3 deletions tests/k8s/test_replication_controller/test_lifecycle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interactions:
"ClusterFirst", "serviceAccountName": "default", "restartPolicy": "Always",
"volumes": [], "initContainers": [], "imagePullSecrets": [{"name": "image_pull_secret"}],
"containers": [{"livenessProbe": {"initialDelaySeconds": 5, "httpGet": {"path":
"/", "scheme": "HTTP", "port": "http5000"}}, "name": "container", "image": "dummy_image",
"/", "scheme": "HTTP", "port": "http5000", "httpHeaders": []}}, "name": "container", "image": "dummy_image",
"volumeMounts": [], "env": [], "envFrom": [], "imagePullPolicy": "IfNotPresent", "readinessProbe":
{"initialDelaySeconds": 5, "tcpSocket": {"port": 5000}}, "ports": [{"protocol":
"TCP", "containerPort": 5000, "name": "http5000"}]}]}, "metadata": {"labels":
Expand All @@ -21,7 +21,7 @@ interactions:
method: POST
uri: http://localhost:8080/api/v1/namespaces/my-namespace/replicationcontrollers/
response:
body: {string: !!python/unicode '{"kind":"ReplicationController","apiVersion":"v1","metadata":{"name":"my-name","namespace":"my-namespace","selfLink":"/api/v1/namespaces/my-namespace/replicationcontrollers/my-name","uid":"a47913ea-a826-11e7-ba76-0800273598c9","resourceVersion":"792","generation":1,"creationTimestamp":"2017-10-03T10:35:57Z","labels":{"test":"true"}},"spec":{"replicas":2,"selector":{"test":"true"},"template":{"metadata":{"name":"my-name","namespace":"my-namespace","creationTimestamp":null,"labels":{"test":"true"}},"spec":{"containers":[{"name":"container","image":"dummy_image","ports":[{"name":"http5000","containerPort":5000,"protocol":"TCP"}],"resources":{},"livenessProbe":{"httpGet":{"path":"/","port":"http5000","scheme":"HTTP"},"initialDelaySeconds":5,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"readinessProbe":{"tcpSocket":{"port":5000},"initialDelaySeconds":5,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","securityContext":{},"imagePullSecrets":[{"name":"image_pull_secret"}],"schedulerName":"default-scheduler"}}},"status":{"replicas":0}}
body: {string: !!python/unicode '{"kind":"ReplicationController","apiVersion":"v1","metadata":{"name":"my-name","namespace":"my-namespace","selfLink":"/api/v1/namespaces/my-namespace/replicationcontrollers/my-name","uid":"a47913ea-a826-11e7-ba76-0800273598c9","resourceVersion":"792","generation":1,"creationTimestamp":"2017-10-03T10:35:57Z","labels":{"test":"true"}},"spec":{"replicas":2,"selector":{"test":"true"},"template":{"metadata":{"name":"my-name","namespace":"my-namespace","creationTimestamp":null,"labels":{"test":"true"}},"spec":{"containers":[{"name":"container","image":"dummy_image","ports":[{"name":"http5000","containerPort":5000,"protocol":"TCP"}],"resources":{},"livenessProbe":{"httpGet":{"path":"/","port":"http5000","scheme":"HTTP","httpHeaders":[]},"initialDelaySeconds":5,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"readinessProbe":{"tcpSocket":{"port":5000},"initialDelaySeconds":5,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","securityContext":{},"imagePullSecrets":[{"name":"image_pull_secret"}],"schedulerName":"default-scheduler"}}},"status":{"replicas":0}}

'}
headers:
Expand All @@ -39,7 +39,7 @@ interactions:
method: GET
uri: http://localhost:8080/api/v1/namespaces/my-namespace/replicationcontrollers/my-name
response:
body: {string: !!python/unicode '{"kind":"ReplicationController","apiVersion":"v1","metadata":{"name":"my-name","namespace":"my-namespace","selfLink":"/api/v1/namespaces/my-namespace/replicationcontrollers/my-name","uid":"a47913ea-a826-11e7-ba76-0800273598c9","resourceVersion":"797","generation":1,"creationTimestamp":"2017-10-03T10:35:57Z","labels":{"test":"true"}},"spec":{"replicas":2,"selector":{"test":"true"},"template":{"metadata":{"name":"my-name","namespace":"my-namespace","creationTimestamp":null,"labels":{"test":"true"}},"spec":{"containers":[{"name":"container","image":"dummy_image","ports":[{"name":"http5000","containerPort":5000,"protocol":"TCP"}],"resources":{},"livenessProbe":{"httpGet":{"path":"/","port":"http5000","scheme":"HTTP"},"initialDelaySeconds":5,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"readinessProbe":{"tcpSocket":{"port":5000},"initialDelaySeconds":5,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","securityContext":{},"imagePullSecrets":[{"name":"image_pull_secret"}],"schedulerName":"default-scheduler"}}},"status":{"replicas":0,"observedGeneration":1}}
body: {string: !!python/unicode '{"kind":"ReplicationController","apiVersion":"v1","metadata":{"name":"my-name","namespace":"my-namespace","selfLink":"/api/v1/namespaces/my-namespace/replicationcontrollers/my-name","uid":"a47913ea-a826-11e7-ba76-0800273598c9","resourceVersion":"797","generation":1,"creationTimestamp":"2017-10-03T10:35:57Z","labels":{"test":"true"}},"spec":{"replicas":2,"selector":{"test":"true"},"template":{"metadata":{"name":"my-name","namespace":"my-namespace","creationTimestamp":null,"labels":{"test":"true"}},"spec":{"containers":[{"name":"container","image":"dummy_image","ports":[{"name":"http5000","containerPort":5000,"protocol":"TCP"}],"resources":{},"livenessProbe":{"httpGet":{"path":"/","port":"http5000","scheme":"HTTP","httpHeaders":[]},"initialDelaySeconds":5,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"readinessProbe":{"tcpSocket":{"port":5000},"initialDelaySeconds":5,"timeoutSeconds":1,"periodSeconds":10,"successThreshold":1,"failureThreshold":3},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","serviceAccountName":"default","serviceAccount":"default","securityContext":{},"imagePullSecrets":[{"name":"image_pull_secret"}],"schedulerName":"default-scheduler"}}},"status":{"replicas":0,"observedGeneration":1}}

'}
headers:
Expand Down

0 comments on commit 1c5993a

Please sign in to comment.