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

Gateway doesn't indicate that TLSPolicy is failing #420

Closed
pehala opened this issue Feb 13, 2024 · 3 comments
Closed

Gateway doesn't indicate that TLSPolicy is failing #420

pehala opened this issue Feb 13, 2024 · 3 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@pehala
Copy link
Contributor

pehala commented Feb 13, 2024

If you use TLSPolicy, which is failing, in a single-cluster context, Gateway reports ready and claims to be only affected by DNSPolicy.

I expect to see at least some status indicating that something is wrong with the TLSPolicy attached. There is an error in the listener section but that still didn't prevent Gateway from going to "Ready" state.

Gateway:

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  labels:
    app: testrun-phala-kudrnt-te-j3k-qsqdtgg
    cluster.open-cluster-management.io/placement: http-gateway
  name: mgc-gate-phala-kudrnt-te-6ybc
  namespace: kuadrant
spec:
  gatewayClassName: istio
  listeners:
    - allowedRoutes:
        namespaces:
          from: All
      hostname: '*.aws.kua.3scale.app-services-dev.net'
      name: api
      port: 443
      protocol: HTTPS
      tls:
        certificateRefs:
          - group: ''
            kind: Secret
            name: mgc-gate-phala-kudrnt-te-6ybc-tls
        mode: Terminate
status:
  addresses:
    - type: IPAddress
      value: 10.0.193.68
  conditions:
    - lastTransitionTime: '2024-02-13T13:51:15Z'
      message: Resource accepted
      observedGeneration: 1
      reason: Accepted
      status: 'True'
      type: Accepted
    - lastTransitionTime: '2024-02-13T13:53:04Z'
      message: >-
        Resource programmed, assigned to service(s)
        mgc-gate-phala-kudrnt-te-6ybc-istio.kuadrant.svc.cluster.local:443
      observedGeneration: 1
      reason: Programmed
      status: 'True'
      type: Programmed
    - lastTransitionTime: '2024-02-13T13:54:01Z'
      message: >-
        policy success. Object affected by policy kuadrant.io/v1alpha1,
        Kind=DNSPolicy in namespace kuadrant with name dns-phala-kudrnt-te-heyl 
      observedGeneration: 1
      reason: Accepted
      status: 'True'
      type: kuadrant.io/DNSPolicyAffected
  listeners:
    - attachedRoutes: 0
      conditions:
        - lastTransitionTime: '2024-02-13T13:51:15Z'
          message: No errors found
          observedGeneration: 1
          reason: Accepted
          status: 'True'
          type: Accepted
        - lastTransitionTime: '2024-02-13T13:51:15Z'
          message: No errors found
          observedGeneration: 1
          reason: NoConflicts
          status: 'False'
          type: Conflicted
        - lastTransitionTime: '2024-02-13T13:51:15Z'
          message: Bad TLS configuration
          observedGeneration: 1
          reason: Invalid
          status: 'False'
          type: Programmed
        - lastTransitionTime: '2024-02-13T13:51:15Z'
          message: >-
            invalid certificate reference
            /Secret/mgc-gate-phala-kudrnt-te-6ybc-tls., secret
            kuadrant/mgc-gate-phala-kudrnt-te-6ybc-tls not found
          observedGeneration: 1
          reason: InvalidCertificateRef
          status: 'False'
          type: ResolvedRefs
      name: api
      supportedKinds:
        - group: gateway.networking.k8s.io
          kind: HTTPRoute
        - group: gateway.networking.k8s.io
          kind: GRPCRoute

TLSPolicy:

apiVersion: kuadrant.io/v1alpha1
kind: TLSPolicy
metadata:
  name: tls-phala-kudrnt-te-jeui
  namespace: kuadrant
  finalizers:
    - kuadrant.io/tls-policy
  labels:
    app: testrun-phala-kudrnt-te-j3k-qsqdtgg
spec:
  issuerRef:
    group: cert-manager.io
    kind: ClusterIssuer
    name: selfsigned-cluster-issuer2
  privateKey: {}
  targetRef:
    group: gateway.networking.k8s.io
    kind: Gateway
    name: mgc-gate-phala-kudrnt-te-6ybc
    namespace: kuadrant
status:
  conditions:
    - lastTransitionTime: '2024-02-13T13:51:19Z'
      message: ClusterIssuer.cert-manager.io "selfsigned-cluster-issuer2" not found
      reason: ReconciliationError
      status: 'False'
      type: Ready
  observedGeneration: 1
@pehala pehala added the kind/bug Something isn't working label Feb 13, 2024
@pehala pehala changed the title Gateway reports ready, even if TLSPolicy is failing Gateway doesn't indicate that TLSPolicy is failing Feb 13, 2024
@philbrookes
Copy link
Contributor

Ensure that TLS Policy affected status is on gateway when policy is not ready.

@philbrookes philbrookes moved this to Todo in Kuadrant May 9, 2024
@maleck13
Copy link
Collaborator

We can't stop the gateway from going into a ready state, but we could add the enforced and accepted conditions as stated. Some work was done here around TLSPolicy status
#635 so it may be worth re-checking if this is still an issue

@maksymvavilov maksymvavilov self-assigned this May 20, 2024
@maksymvavilov maksymvavilov moved this from Todo to In Progress in Kuadrant May 20, 2024
@maksymvavilov
Copy link
Contributor

I was not able to reproduce this issue.
The failing TLS Policy:

k get tlspolicy tls-policy -n test -o yaml | yq ".status.conditions"
- lastTransitionTime: "2024-05-28T13:58:42Z"
  message: 'TLSPolicy has encountered some issues: ClusterIssuer.cert-manager.io "selfsigned-cluster-issuer2" not found'
  reason: Unknown
  status: "False"
  type: Accepted

And the Gateway status:

k get gateway test -n test -o yaml | yq ".status.conditions"
- lastTransitionTime: "2024-05-28T13:58:42Z"
  message: Resource accepted
  observedGeneration: 1
  reason: Accepted
  status: "True"
  type: Accepted
- lastTransitionTime: "2024-05-28T13:58:44Z"
  message: Resource programmed, assigned to service(s) test-istio.test.svc.cluster.local:80
  observedGeneration: 1
  reason: Programmed
  status: "True"
  type: Programmed
- lastTransitionTime: "2024-05-28T13:58:44Z"
  message: Object affected by DNSPolicy test/dnspolicy-sample
  observedGeneration: 1
  reason: Accepted
  status: "True"
  type: kuadrant.io/DNSPolicyAffected
- lastTransitionTime: "2024-05-28T13:58:44Z"
  message: Object unaffected by TLSPolicy test/tls-policy, policy is not accepted
  observedGeneration: 1
  reason: Unknown
  status: "False"
  type: kuadrant.io/TLSPolicyAffected

Closing this issue

@github-project-automation github-project-automation bot moved this from In Progress to Done in Kuadrant May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

4 participants