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

Changes made by Rancher outside of Pulumi are not detected by Pulumi #641

Closed
ghost opened this issue Jul 16, 2019 · 11 comments
Closed

Changes made by Rancher outside of Pulumi are not detected by Pulumi #641

ghost opened this issue Jul 16, 2019 · 11 comments
Assignees
Labels
dry-run-diff Related to dry run diff behavior kind/bug Some behavior is incorrect or out of spec last-applied-configuration Issues related to the last-applied-configuration annotation resolution/fixed This issue was fixed

Comments

@ghost
Copy link

ghost commented Jul 16, 2019

Creating a service like so:

new k8s.core.v1.Service(appName, {
    metadata: {
        namespace: 'sia-ns',
        name: 'nginx-service'
    },
    spec: {
        type: 'ClusterIP',
        ports: [{ port: 80, targetPort: 8080, protocol: 'TCP'}],
        selector: {
            app: 'nginx'
        }
    }
});

after updating the service over another channel to targetPort: 8081

pulumi doesn't detect the change. Refresh appears to sometimes notice, but following updates don't restore the targetPort to 8080

@lukehoban
Copy link
Contributor

Refresh appears to sometimes notice,

Do you mean it sometimes works but other times doesn't? That would be very unexpected!

following updates don't restore the targetPort to 8080

That is definitely a bug.

@lukehoban lukehoban added kind/bug Some behavior is incorrect or out of spec feature/q3 labels Jul 17, 2019
@lukehoban lukehoban added this to the 0.25 milestone Jul 17, 2019
@pgavlin
Copy link
Member

pgavlin commented Jul 17, 2019

What versions of the Pulumi CLI and @pulumi/kubernetes are you using?

@ghost
Copy link
Author

ghost commented Jul 17, 2019

I'm using pulumi v0.17.22 and @pulumi/kubernetes 0.25.2

@ghost
Copy link
Author

ghost commented Jul 17, 2019

I did some more testing.
It looks like if I edit the service using kubectl

apiVersion: v1
kind: Service
metadata:
  namespace: sia-ns
  name: nginx-service
spec:
  selector: 
    App: nginx
  type: ClusterIP
  ports:
    - name: http
      port: 80
      targetPort: 8081
      protocol: TCP

Pulumi refresh notices the change and subsequent updates work as expected.

If however I edit the service using rancher, pulumi refresh still picks up the change, but doesn't modify the stack's state in such a way that subsequent updates overwrite it.

It looks like the rancher update does not overwrite the last-applied-configuration

kubectl.kubernetes.io/last-applied-configuration: '{"apiVersion":"v1","kind":"Service","metadata":{"labels":{"app.kubernetes.io/managed-by":"pulumi"},"name":"nginx-service","namespace":"sia-ns"},"spec":{"ports":[{"name":"http","port":80,"protocol":"TCP","targetPort":8080}],"selector":{"App":"nginx"},"type":"ClusterIP"}}'

@lukehoban lukehoban changed the title Changes are not detected. Changes made by Rancher outside of Pulumi are not detected by Pulumi Jul 17, 2019
@lukehoban
Copy link
Contributor

Thanks @aeb-sia. I've updated the title to match the details of your investigation.

cc @hausdorff for thoughts on this as well.

@pgavlin
Copy link
Member

pgavlin commented Jul 17, 2019

This is a bit surprising... I would have expected that the three-way-merge logic used in Diff would pick this up.

As an aside, I'm glad that we've found a tool that does not update that annotation, as it should make these scenarios much easier to test.

@hausdorff
Copy link
Contributor

Talking to @lukehoban again, let's move this back provisionally to Q3. I'll take some time in the next couple days to dig in a bit at the intersection of diff and refresh to build more confidence that this works as expected.

@aeb-sia in the mean time, do you have a list of specific steps you took to arrive in this situation? It would be very nice to have a repro.

@ghost
Copy link
Author

ghost commented Jul 26, 2019

@hausdorff create the service as described above then change the port in rancher.

@lblackstone
Copy link
Member

Haven't had time to look into this further, so bumping to M26

@lblackstone
Copy link
Member

lblackstone commented Aug 5, 2019

Reproduced the underlying issue in #694. This does work properly with the dryRun-based diff behavior, but it was causing some other stability problems, so it's disabled by default for now. After it stabilizes, it will become the new default.

If you want to try it out, you can set the enableDryRun flag on the provider for the resource. e.g.,

const provider = new k8s.Provider("foo", {enableDryRun: true});

@lblackstone lblackstone added dry-run-diff Related to dry run diff behavior and removed feature/q3 labels Aug 7, 2019
@lblackstone lblackstone removed this from the 0.26 milestone Aug 7, 2019
@lblackstone lblackstone added the resolution/fixed This issue was fixed label Jul 20, 2022
@lblackstone
Copy link
Member

This should be fixed with the enableServerSideApply mode available in the v3.20.1 release

@lblackstone lblackstone added the last-applied-configuration Issues related to the last-applied-configuration annotation label Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dry-run-diff Related to dry run diff behavior kind/bug Some behavior is incorrect or out of spec last-applied-configuration Issues related to the last-applied-configuration annotation resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

4 participants