kubernetes-sigs / ingress-controller-conformance

Repository for a compliance specification of ingress-controllers.
Apache License 2.0
43 stars 36 forks source link

Add flag to dump yaml definitions #75

Closed aledbf closed 4 years ago

aledbf commented 4 years ago

Running the conformance test suite we could find a particular test is not ok. The yaml definition helps to reproduce the problem without spending time trying to reproduce what is being executed underneath

aledbf commented 4 years ago

Example of the output:

=== RUN   TestSuite
Feature: Host rules
  An Ingress may define routing rules based on the request host.

  If the HTTP request host matches one of the hosts in the
  Ingress objects, the traffic is routed to its backend service.
---
metadata:
  creationTimestamp: null
  generateName: ingress-conformance-
  labels:
    app.kubernetes.io/name: ingress-conformance
spec: {}
status: {}

  Background:
    Given a new random namespace                                                                # feature.go:58 -> sigs.k8s.io/ingress-controller-conformance/test/conformance/hostrules.aNewRandomNamespace
---
data:
  tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJRENDQWdpZ0F3SUJBZ0lSQU52NWNLYXZDSVNwLzJyT1pvMEhlNUF3RFFZSktvWklodmNOQVFFTEJRQXcKSkRFUU1BNEdBMVVFQ2hNSFFXTnRaU0JEYnpFUU1BNEdBMVVFQXhNSFpHVm1ZWFZzZERBZUZ3MHlNREE1TWpreApOREEzTlRWYUZ3MHlNVEE1TWpreE5EQTNOVFZhTUNReEVEQU9CZ05WQkFvVEIwRmpiV1VnUTI4eEVEQU9CZ05WCkJBTVRCMlJsWm1GMWJIUXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCQVFDM3hSbTcKMzhLT3o4M0ZoUGlzTDJPUitRUEFvVTg3N0doOHBjSXNhYXFBQW5oMlRJRzdUVXArVTdpeDd0V1ZGZGxjUUxxNwowNVJFVEhZdEg3NUtLcy9RR1c4RmUwUlovZEU4ck52OUlzdGtOc09HczcwVDFTYUJVU3dkODBPZGJZUHFoSWIwCkZ1citEdEhob3UyMzZXalVoYVN3Y3VJSlRPNStEWCtqMmxFU2E4VVFITXBwUWJtZyt6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ata:
  creationTimestamp: null
  name: conformance-tls

    Given a self-signed TLS secret named "conformance-tls" for the "foo.bar.com" hostname       # feature.go:89 -> sigs.k8s.io/ingress-controller-conformance/test/conformance/hostrules.aSelfsignedTLSSecretNamedForTheHostname
---
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  name: host-rules-wildcard-foo-com
spec:
  replicas: 1
  selector:
    matchLabels:
      app: host-rules-wildcard-foo-com
  strategy:
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: host-rules-wildcard-foo-com
    spec:
      containers:
      - env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: INGRESS_NAME
          value: host-rules
        - name: SERVICE_NAME
          value: wildcard-foo-com
        image: gcr.io/k8s-staging-ingressconformance/echoserver@sha256:317f2dfad5e4e937275e79f783e5e7b81a88f0123a3988e8b06f9d7b1eb435c9
        livenessProbe:
          failureThreshold: 10
          httpGet:
            path: /health
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 1
          successThreshold: 1
          timeoutSeconds: 1
        name: ingress-conformance-echo
        ports:
        - containerPort: 3000
        readinessProbe:
          failureThreshold: 10
          httpGet:
            path: /health
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 1
          successThreshold: 1
          timeoutSeconds: 1
        resources: {}
status: {}

---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  name: wildcard-foo-com
spec:
  ports:
  - port: 8080
    targetPort: 3000
  selector:
    app: host-rules-wildcard-foo-com
  type: NodePort
status:
  loadBalancer: {}

---
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  name: host-rules-foo-bar-com
spec:
  replicas: 1
  selector:
    matchLabels:
      app: host-rules-foo-bar-com
  strategy:
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: host-rules-foo-bar-com
    spec:
      containers:
      - env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: INGRESS_NAME
          value: host-rules
        - name: SERVICE_NAME
          value: foo-bar-com
        image: gcr.io/k8s-staging-ingressconformance/echoserver@sha256:317f2dfad5e4e937275e79f783e5e7b81a88f0123a3988e8b06f9d7b1eb435c9
        livenessProbe:
          failureThreshold: 10
          httpGet:
            path: /health
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 1
          successThreshold: 1
          timeoutSeconds: 1
        name: ingress-conformance-echo
        ports:
        - containerPort: 3000
          name: http
        readinessProbe:
          failureThreshold: 10
          httpGet:
            path: /health
            port: 3000
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 1
          successThreshold: 1
          timeoutSeconds: 1
        resources: {}
status: {}

---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  name: foo-bar-com
spec:
  ports:
  - name: http
    port: 8080
    targetPort: 3000
  selector:
    app: host-rules-foo-bar-com
  type: NodePort
status:
  loadBalancer: {}

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  creationTimestamp: null
  name: host-rules
  namespace: ingress-conformance-468v5
spec:
  rules:
  - host: '*.foo.com'
    http:
      paths:
      - backend:
          service:
            name: wildcard-foo-com
            port:
              number: 8080
        path: /
        pathType: Prefix
  - host: foo.bar.com
    http:
      paths:
      - backend:
          service:
            name: foo-bar-com
            port:
              name: http
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - foo.bar.com
    secretName: conformance-tls
status:
  loadBalancer: {}

    Given an Ingress resource                                                                   # feature.go:68 -> sigs.k8s.io/ingress-controller-conformance/test/conformance/hostrules.anIngressResource
      """
      apiVersion: networking.k8s.io/v1
      kind: Ingress
      metadata:
        name: host-rules
      spec:
        tls:
          - hosts:
              - foo.bar.com
            secretName: conformance-tls
        rules:
          - host: "*.foo.com"
            http:
              paths:
                - path: /
                  pathType: Prefix
                  backend:
                    service:
                      name: wildcard-foo-com
                      port:
                        number: 8080

          - host: foo.bar.com
            http:
              paths:
                - path: /
                  pathType: Prefix
                  backend:
                    service:
                      name: foo-bar-com
                      port:
                        name: http
      """
bowei commented 4 years ago

/lgtm /approve

k8s-ci-robot commented 4 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf, bowei

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/ingress-controller-conformance/blob/master/OWNERS)~~ [bowei] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment