UNPKG

@pulumi/kubernetes-compliance-policies

Version:

This repository contains a growing set of Compliance Policies to validate your infrastructure using Pulumi's Crossguard Policy-as-Code framework.

117 lines (116 loc) 5.59 kB
"use strict"; // Copyright 2016-2024, Pulumi Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // ------------------------------- WARNING ------------------------------------- // This file was programmatically generated. Do not edit unless you know what // you're doing. // ------------------------------- WARNING ------------------------------------- Object.defineProperty(exports, "__esModule", { value: true }); exports.LeasePatch = exports.LeaseList = exports.Lease = void 0; const policy_1 = require("@pulumi/policy"); const compliance_policy_manager_1 = require("@pulumi/compliance-policy-manager"); const v1beta1_1 = require("@pulumi/kubernetes/coordination/v1beta1"); const v1beta1_2 = require("@pulumi/kubernetes/coordination/v1beta1"); const v1beta1_3 = require("@pulumi/kubernetes/coordination/v1beta1"); var Lease; (function (Lease) { /** * Disallow the use of non-stable (Beta) Kubernetes resouces (coordination.v1beta1.Lease). * * @severity medium * @frameworks none * @topics api, beta, unstable * @link https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-groups-and-versioning */ Lease.disallowBetaResource = compliance_policy_manager_1.policyManager.registerPolicy({ resourceValidationPolicy: { name: "kubernetes-coordination-v1beta1-lease-disallow-beta-resource", description: "Disallow the use of non-stable (Beta) Kubernetes resouces (coordination.v1beta1.Lease).", configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema, enforcementLevel: "advisory", validateResource: (0, policy_1.validateResourceOfType)(v1beta1_1.Lease, (_, args, reportViolation) => { if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) { return; } reportViolation("Kubernetes Lease shouldn't use an unstable API (coordination.v1beta1.Lease)."); }), }, vendors: ["kubernetes"], services: ["coordination"], severity: "medium", topics: ["api", "unstable", "beta"], }); })(Lease || (Lease = {})); exports.Lease = Lease; var LeaseList; (function (LeaseList) { /** * Disallow the use of non-stable (Beta) Kubernetes resouces (coordination.v1beta1.LeaseList). * * @severity medium * @frameworks none * @topics api, beta, unstable * @link https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-groups-and-versioning */ LeaseList.disallowBetaResource = compliance_policy_manager_1.policyManager.registerPolicy({ resourceValidationPolicy: { name: "kubernetes-coordination-v1beta1-leaselist-disallow-beta-resource", description: "Disallow the use of non-stable (Beta) Kubernetes resouces (coordination.v1beta1.LeaseList).", configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema, enforcementLevel: "advisory", validateResource: (0, policy_1.validateResourceOfType)(v1beta1_2.LeaseList, (_, args, reportViolation) => { if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) { return; } reportViolation("Kubernetes LeaseList shouldn't use an unstable API (coordination.v1beta1.LeaseList)."); }), }, vendors: ["kubernetes"], services: ["coordination"], severity: "medium", topics: ["api", "unstable", "beta"], }); })(LeaseList || (LeaseList = {})); exports.LeaseList = LeaseList; var LeasePatch; (function (LeasePatch) { /** * Disallow the use of non-stable (Beta) Kubernetes resouces (coordination.v1beta1.LeasePatch). * * @severity medium * @frameworks none * @topics api, beta, unstable * @link https://kubernetes.io/docs/concepts/overview/kubernetes-api/#api-groups-and-versioning */ LeasePatch.disallowBetaResource = compliance_policy_manager_1.policyManager.registerPolicy({ resourceValidationPolicy: { name: "kubernetes-coordination-v1beta1-leasepatch-disallow-beta-resource", description: "Disallow the use of non-stable (Beta) Kubernetes resouces (coordination.v1beta1.LeasePatch).", configSchema: compliance_policy_manager_1.policyManager.policyConfigSchema, enforcementLevel: "advisory", validateResource: (0, policy_1.validateResourceOfType)(v1beta1_3.LeasePatch, (_, args, reportViolation) => { if (!compliance_policy_manager_1.policyManager.shouldEvalPolicy(args)) { return; } reportViolation("Kubernetes LeasePatch shouldn't use an unstable API (coordination.v1beta1.LeasePatch)."); }), }, vendors: ["kubernetes"], services: ["coordination"], severity: "medium", topics: ["api", "unstable", "beta"], }); })(LeasePatch || (LeasePatch = {})); exports.LeasePatch = LeasePatch;