Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Kubernetes clusters should be accessible only over HTTPS" triggers false positive for Nginx mergable ingress resource. #1427

Open
Binghankina opened this issue Feb 25, 2025 · 0 comments

Comments

@Binghankina
Copy link

Details of the scenario you tried and the problem that is occurring

False positive on policy "Kubernetes clusters should be accessible only over HTTPS" for Nginx mergable ingress resources. The mergeable ingress resource has master type with spec.tls configuration and minion type without spec.tls.
Detailed spec for mergeable ingress types. https://github.com/nginx/kubernetes-ingress/tree/v3.3.2/examples/ingress-resources/mergeable-ingress-types

apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    annotations:
      nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
      nginx.org/mergeable-ingress-type: master
    name: ingress-master
    namespace: application
  spec:
    ingressClassName: nginx
    rules:
    - host: www.example.com
    tls:
    - hosts:
      - www.example.com
      secretName: exampleTls
- apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    annotations:
      nginx.org/mergeable-ingress-type: minion
    name: ingress-A
    namespace: application
  spec:
    ingressClassName: nginx
    rules:
    - host: www.example.com
      http:
        paths:
        - backend:
            service:
              name: serviceA
              port:
                number: 8083
          path: /serviceA
          pathType: Prefix

Verbose logs showing the problem

error: ingresses.networking.k8s.io "handbook" could not be patched: admission webhook "validation.gatekeeper.sh" denied the request: [azurepolicy-k8sazurev1ingresshttpsonly-51db6f58fe78f0936166] Ingress should allow https only. tls configuration and annotation nginx.ingress.kubernetes.io/force-ssl-redirect=true are required for handbook

Suggested solution to the issue

The policy code should check whether it contains the nginx.org/mergeable-ingress-type annotation. If it is a minion, the the policy should not block the resource deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant