pulumi-kubernetes icon indicating copy to clipboard operation
pulumi-kubernetes copied to clipboard

Overlay resources in node are ignored by policy packs

Open jkodroff opened this issue 2 years ago • 1 comments

The handwritten node overlays in provider/pkg/gen all need changes similar to those made in #2066 and #2133.

Sample pulumi program for a test bench:

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

new k8s.helm.v3.Chart("my-chart", {
    chart: "ingress-nginx/ingress-nginx",
});

Sample policy pack for a test bench:

import * as k8s from "@pulumi/kubernetes";
import { PolicyPack, validateResourceOfType } from "@pulumi/policy";

new PolicyPack("kubernetes-typescript", {
    policies: [{
        name: "no-helm-v3-charts",
        description: "no-helm-v3-charts",
        enforcementLevel: "mandatory",
        validateResource: validateResourceOfType(k8s.helm.v3.Chart, (svc, args, reportViolation) => {
            reportViolation("reportViolation no-helm-v3-charts");
        }),
    }],
});

IMPORTANT: When testing, be sure to yarn link @pulumi/kubernetes in both the policy pack dir AND the pulumi program dir or it'll appear as though your changes did not fix the problem.

Might be worth also trying similar programs/policy packs to tell whether Python resources have the same issue.

This issue can be closed if we turn these resources into MLCs (i.e. schema-tize them).

jkodroff avatar Aug 11 '22 21:08 jkodroff