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

[aws-eks] UnsupportedMediaType Error when creating KubernetesPatch for custom resource #6723

Closed
mattchrist opened this issue Mar 14, 2020 · 0 comments · Fixed by #6753
Closed
Assignees
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug.

Comments

@mattchrist
Copy link
Contributor

When creating a KubernetesPatch construct to update the Gloo settings custom resource, I receive the following error:
Failed to create resource. Error: b'Error from server (UnsupportedMediaType): the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json\n'

It appears that the default patch type of 'strategic' is not appropriate for patching this resource, and there's no mechanism available to specify a --type=merge or --type=json for the kubectl provider.

It's my understanding that custom resources in general do not support the default 'strategic' merge type.
https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

Reproduction Steps

  const app = new App();
  const stack = new Stack(app, "stack", {});
  const cluster = new Cluster(stack, "deleteme");
  cluster.addChart("gloo", {
    chart: "gloo",
    repository: "https://storage.googleapis.com/solo-public-helm",
    version: "1.2.21",
    wait: true,
    values: {
      settings: {
        create: true
      }
    }
  });
  const glooPatch = new KubernetesPatch(stack, "enableConsulPatch", {
    applyPatch: {
      spec: {
        consul: {
          address: `127.0.0.1:8500`,
          serviceDiscovery: {}
        }
      }
    },
    restorePatch: { spec: { consul: {} } },
    cluster,
    resourceName: "Settings/default",
    resourceNamespace: `default`
  });

Error Log

Failed to create resource. Error: b'Error from server (UnsupportedMediaType): the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json\n'

Environment

  • CLI Version : 1.27.0
  • Framework Version: 1.27.0
  • OS : Mac OS 10.14.6
  • Language : Typescript

Other

A PatchType field in the kubectl provider for patch resources would resolve this issue for me. I intend to submit a PR for this.


This is 🐛 Bug Report

@mattchrist mattchrist added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 14, 2020
@SomayaB SomayaB added the @aws-cdk/custom-resources Related to AWS CDK Custom Resources label Mar 16, 2020
@SomayaB SomayaB added in-progress This issue is being actively worked on. @aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service and removed @aws-cdk/custom-resources Related to AWS CDK Custom Resources labels Mar 19, 2020
@mergify mergify bot closed this as completed in #6753 Mar 19, 2020
mergify bot pushed a commit that referenced this issue Mar 19, 2020
feat(eks): KubernetesPatch (#6753)

Exports KubernetesPatch from aws-eks module.

Adds ability to specify a patch "type" for `kubectl patch` to use (fixes #6723)
@iliapolo iliapolo changed the title UnsupportedMediaType Error when creating KubernetesPatch for custom resource [aws-eks] UnsupportedMediaType Error when creating KubernetesPatch for custom resource Aug 16, 2020
@iliapolo iliapolo removed in-progress This issue is being actively worked on. needs-triage This issue or PR still needs to be triaged. labels Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-eks Related to Amazon Elastic Kubernetes Service bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants