Reputation: 863
I have been working around the GKE policy controller lately, and while applying the HPA policy as per this. I am getting the error
error: resource mapping not found for name: "horizontal-pod-autoscaler" namespace: "" from "hpa-policy.yaml": no matches for kind "HorizontalPodAutoscalerConstraint" in version "constraints.gatekeeper.sh/v1beta1"
ensure CRDs are installed first
HPA policy
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sHorizontalPodAutoscaler
metadata:
name: horizontal-pod-autoscaler
spec:
enforcementAction: deny
match:
kinds:
- apiGroups:
- autoscaling
kinds:
- HorizontalPodAutoscaler
parameters:
enforceScaleTargetRef: true
minimumReplicaSpread: 1
ranges:
- max_replicas: 6
min_replicas: 3
Upvotes: 1
Views: 59