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

Give the possibility to set an annotation that forces resource re-creation #1007

Closed
Mokto opened this issue Feb 25, 2020 · 5 comments
Closed
Assignees
Labels
area/core kind/enhancement Improvements or new features resolution/fixed This issue was fixed size/M Estimated effort to complete (up to 5 days).
Milestone

Comments

@Mokto
Copy link

Mokto commented Feb 25, 2020

Problem description

Some of the resources we use are immutable (in my case, in a weird way).
For example, whenever I try to update my Prometheus resource, I get this :

the Kubernetes API server reported that "metrics/prometheus" failed to fully initialize or become live: the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json

Reproducing the issue

Create any Prometheus resource, deploy it, change, the image tag try to re-deploy it.

Suggestions for a fix

I've seen that you've created some annotations, pulumi.com/skipAwait or pulumi.com/timeoutSeconds to modify the way things are deployed.

It would be nice to add another annotation to force resource replacement.

Because you can't possibly add exceptions for any CRD resource.
Ref: #525

Thanks!

@spender0
Copy link

spender0 commented Apr 2, 2020

I got the same issue installing prometheus-operator helm chart

@lukehoban
Copy link
Contributor

Related to pulumi/pulumi#6753. We could choose whether to address this via a general Pulumi option like in 6753, or a Kubernetes-specific annotation like pulumi.com/skipAwait. Since most of the use cases for this are in Kubernertes, and it would be simpler to address just for Kubernetes, it might make more sense to address this issue initially instead of 6753.

@lukehoban lukehoban added kind/enhancement Improvements or new features area/core labels Apr 30, 2021
@lblackstone
Copy link
Member

I was just looking at this as a possible solution to #856 as well.

@lblackstone
Copy link
Member

lblackstone commented Jul 14, 2021

I confirmed that pulumi/pulumi#7226 solves this in general, so we won't need an annotation specific to Kubernetes. Here's an example:

import * as k8s from "@pulumi/kubernetes";

const appLabels = { app: "nginx" };
const deployment = new k8s.apps.v1.Deployment("nginx", {
    spec: {
        selector: { matchLabels: appLabels },
        replicas: 1,
        template: {
            metadata: { labels: appLabels },
            spec: {
                containers: [{ name: "nginx", image: "nginx:1.14"}],
            },
        },
    }
}, {replaceOnChanges: [".spec.replicas"]});

Changing the replicas to 3 shows the following preview:
Screen Shot 2021-07-14 at 3 38 34 PM

Here's the preview without replaceOnChanges specified for comparison:
Screen Shot 2021-07-14 at 3 39 14 PM

(This is using "@pulumi/pulumi": "^3.7.0" and "@pulumi/kubernetes": "^3.5.1")

@lblackstone lblackstone added the resolution/fixed This issue was fixed label Jul 14, 2021
@lukehoban
Copy link
Contributor

{replaceOnChanges: [".spec.replicas"]});

Just an additional note that you can also do {replaceOnChanges: ["*"]}); to cause the replacement to be triggered on any change to the resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core kind/enhancement Improvements or new features resolution/fixed This issue was fixed size/M Estimated effort to complete (up to 5 days).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants