adamant-apartment-27628
01/15/2024, 9:48 AMimport {
PersistentVolumeClaim,
type PersistentVolumeClaimArgs,
} from '@pulumi/kubernetes/core/v1/persistentVolumeClaim';
import { output } from '@pulumi/pulumi/output';
import type { CustomResourceOptions } from '@pulumi/pulumi/resource';
export class SaasPersistentVolumeClaim extends PersistentVolumeClaim {
constructor(name: string, args: SaasPersistentVolumeClaimArgs, opts?: CustomResourceOptions) {
super(
name,
{
metadata: output(args).apply((args) => ({
namespace: args.metadata?.namespace,
labels: args.metadata?.labels,
annotations: {
'<http://pulumi.com/patchForce|pulumi.com/patchForce>': 'true',
'<http://pulumi.com/skipAwait|pulumi.com/skipAwait>': 'true'
},
name: name,
})),
spec: {
accessModes: ['ReadWriteOnce'],
resources: { requests: { storage: `${args.newSize}Gi` } },
storageClassName: 'performance-regular',
},
},
{
...opts,
ignoreChanges: ['metadata', 'spec.accessModes', 'spec.storageClassName'],
},
);
}
}
Here, I deploy the pvc with 10Gi, and I want to upgrade it to have 20Gi. When I:
• include the metadata
field in the ignoreChanges
array, the upgrade fails with metadata.managedFields must be nil
• remove the metadata
field from the ignoreChanges
array, the upgrade is successful
I think the '<http://pulumi.com/patchForce|pulumi.com/patchForce>': 'true'
is getting ignored during the update because it's in the ignoreChanges
array. I want to keep the metadata
field in the ignoreChanges
array. Theoretically, the '<http://pulumi.com/patchForce|pulumi.com/patchForce>': 'true'
should be used during the operation, just changes to it should be ignored. This looks like a bug with pulumi, or is there something I'm missing?
Versions:
"@pulumi/kubernetes": "4.5.5",
"@pulumi/pulumi": "3.94.2",
Any help is appreciated!cuddly-computer-18851
01/15/2024, 11:12 PMadamant-apartment-27628
01/25/2024, 8:22 AMcuddly-computer-18851
01/25/2024, 11:11 PMpreview
to verify change sets, as ignoring the entire metadata could have unintended side effects as you've noticed.adamant-apartment-27628
02/07/2024, 9:27 AMmetadata.name
has been enough to ensure that the PVC is not deleted on changes. Thank you for your input!