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

Show error when using invalid pod spec #76

Open
gregoryfranklin opened this issue Jan 11, 2019 · 1 comment
Open

Show error when using invalid pod spec #76

gregoryfranklin opened this issue Jan 11, 2019 · 1 comment

Comments

@gregoryfranklin
Copy link

When trying to create an agent with an invalid pod.yaml, GoCD only shows 'waiting for agent'. Checking the logs on the server, it shows

2019-01-11 14:27:01,002 ERROR [155@MessageListener for CreateAgentListener] p.c.g.c.e.k.c.g.c.e.KubernetesPlugin:128 [plugin-cd.go.contrib.elasticagent.kubernetes] - Failed to handle request cd.go.elastic-agent.create-agent
io.fabric8.kubernetes.client.KubernetesClientException: Operation: [create]  for kind: [Pod]  with name: [null]  in namespace: [gocd]  failed.
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:62)
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:71)
	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:363)
	at cd.go.contrib.elasticagent.KubernetesInstanceFactory.createKubernetesPod(KubernetesInstanceFactory.java:133)
Caused by: java.net.SocketTimeoutException: timeout
2019-01-11 14:27:01,002 ERROR [155@MessageListener for CreateAgentListener] JMSMessageListenerAdapter:77 - Exception thrown in message handling by listener com.thoughtworks.go.server.messaging.elasticagents.CreateAgentListener@2ad4f87c
java.lang.RuntimeException: Interaction with plugin with id 'cd.go.contrib.elasticagent.kubernetes' implementing 'elastic-agent' extension failed while requesting for 'cd.go.elastic-agent.create-agent'. Reason: [The plugin sent a response that could not be understood by Go. Plugin returned with code '500' and the following response: 'Failed to handle request cd.go.elastic-agent.create-agent']
	at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:57)
	at com.thoughtworks.go.plugin.access.elastic.v3.ElasticAgentExtensionV3.createAgent(ElasticAgentExtensionV3.java:101)

Without any indication as to what the problem is.

For example:

apiVersion: v1
kind: Pod
metadata:
  name: xxxx
spec:
  containers:
    - name: agent
      image: xxxx
      resources:
        limits:
          cpu: 1
          memory: 4096Mi
        requests:
          cpu: 1
          memory: 8096Mi

Should show the following error message which it would get from kubernetes, but this is not visible anywhere in GoCD.

The Pod "xxxx is invalid: spec.containers[0].resources.requests: Invalid value: "8096Mi": must be less than or equal to memory limit

A possible reason for this is that it seems to take kubernetes 30 secs to return the error (when using kubectl create -f pod.yaml) which is longer than the 10 second timeout in GoCD.

Kubernetes: v1.10.9-gke.0
GoCD: 18.6.0
Kubernetes Elastic Agent Plugin: 1.0.1

@arvindsv
Copy link
Member

I think this should be done across elastic agent plugins, and not just for this. But, it is a valid problem.

/cc @prateekbaheti @SanjanaB @sheroy Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants