Hello :wave: , I've been using Pulumi for a while ...
# kubernetes
t
Hello 👋 , I've been using Pulumi for a while but I feel I have to ask the community for help. I am using server-side-apply and have a bunch of Deployments in one stack. By default, the
spec.strategy
is
RollingUpdate
. I want to conditionally change the it to
Recreate
on some resources. If I try to run it I get:
spec.strategy.rollingUpdate: Forbidden: may not be specified when strategy type is 'Recreate'
I tried (using Python): • using `replace_on_changes=['spec.strategy']`with no luck. • to create an extra label mapped to the strategy value, in this case
replace_on_changes=['metadata.labels.strategy']
works if
spec.strategy.type='Recreate'
is not set. If I set it, I go back to the same error. • I've tried to use a Patch resource but ran into the same issue. Has anyone ran into this ? Thanks!
c
@tall-library-51128 it seems you may be hitting this: https://github.com/kubernetes/kubernetes/issues/24198 from my reading of this, you need to explicitly set
strategy.rollingUpdate
to null / None.
t
sorry, forgot to mentioned that I did try to explicitly set it to
None
and ran into the same error, it's odd (and a bit frustrating)
the official kubernetes documentation states that we should patch the resource like that:
Copy code
spec:
  strategy:
    $retainKeys:
    - type
    type: Recreate
Explaining that
With this patch, we indicate that we want to retain only the type key of the strategy object. Thus, the rollingUpdate will be removed during the patch operation.
Is there any way we can achieve the same using
pulumi_kubernetes
?