https://github.com/open-policy-agent/gatekeeper-library
kustomize나 kubectl 명령을 통해 제공되는 라이브러리를 사용할 수 있다.
kustomization.yaml을 준비
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/open-policy-agent/gatekeeper-library/library
# You can optionally install a subset by specifying a subfolder, or specify a commit SHA
# - github.com/open-policy-agent/gatekeeper-library/library/pod-security-policy?ref=0c82f402fb3594097a90d15215ae223267f5b955
- constraints.yaml
constraints.yaml 준비
라이브러리가 있는 저장소에서 library/ 디렉토리 아래의 template.yaml과 constraint.yaml을 직접 사용할 수 있다.
cd library/general/httpsonly/
kubectl apply -f template.yaml
kubectl apply -f samples/ingress-https-only/constraint.yaml
kubectl apply -f library/general/httpsonly/sync.yaml # optional: when GK is running with OPA cache