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

Knative service annotation "konghq.com/override" has no effect #742

Closed
StarpTech opened this issue Jun 20, 2020 · 3 comments
Closed

Knative service annotation "konghq.com/override" has no effect #742

StarpTech opened this issue Jun 20, 2020 · 3 comments

Comments

@StarpTech
Copy link

StarpTech commented Jun 20, 2020

Summary

I successfully configured Kong with knative. KongPlugin's works but I can't configure a KongIngress resource according to the http-https redirect tutorial.

Kong Ingress controller version
0.9.1

Kubernetes version

paste kubectl version output

Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-21T20:58:41Z", GoVersion:"go1.13.11", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:12:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

What happened

I annotate my Knative service to extend the Kong Ingress.

apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  name: helloworld-go # The name of our route; appears in the URL to access the app
  namespace: default # The namespace we're working in; also appears in the URL to access the app
spec:
  traffic:
  - latestRevision: true
    percent: 100 # All traffic goes to this revision
  template:
    metadata:
      annotations:
        konghq.com/plugins: add-response-header, harry-rate-limit
        konghq.com/override: https-only
    spec:
      timeoutSeconds: 30
      containerConcurrency: 15
      containers:
        - image: gcr.io/knative-samples/helloworld-go
          env:
            - name: TARGET
              value: Go Sample v1
kind: KongIngress
apiVersion: configuration.konghq.com/v1
metadata:
  name: https-only
route:
  protocols:
  - https
  https_redirect_status_code: 302

Because patching the service is not possible (knative configurations are immutable) I have to do it with the knative cli.

kn service update helloworld-go -a konghq.com/override=https-only

The command updated the configuration and created a new revision of my service.

kind: Service
apiVersion: v1
metadata:
  name: helloworld-go-gxrsd-7
  namespace: default
  selfLink: /api/v1/namespaces/default/services/helloworld-go-gxrsd-7
  uid: 44ce1d11-a905-4d1d-a30e-b48d80ce2751
  resourceVersion: '958325'
  creationTimestamp: '2020-06-20T10:47:01Z'
  labels:
    app: helloworld-go-gxrsd-7
    networking.internal.knative.dev/serverlessservice: helloworld-go-gxrsd-7
    networking.internal.knative.dev/serviceType: Public
    serving.knative.dev/configuration: helloworld-go
    serving.knative.dev/configurationGeneration: '7'
    serving.knative.dev/revision: helloworld-go-gxrsd-7
    serving.knative.dev/revisionUID: 0f08abb8-b04d-4070-a539-51801d807f3a
    serving.knative.dev/service: helloworld-go
  annotations:
    autoscaling.knative.dev/class: kpa.autoscaling.knative.dev
    autoscaling.knative.dev/maxScale: '10'
    autoscaling.knative.dev/minScale: '0'
    autoscaling.knative.dev/target: '10'
    konghq.com/override: https-only
    konghq.com/plugins: 'add-response-header, harry-rate-limit'
    serving.knative.dev/creator: 'system:serviceaccount:kube-system:lke-admin'
  ownerReferences:
    - apiVersion: networking.internal.knative.dev/v1alpha1
      kind: ServerlessService
      name: helloworld-go-gxrsd-7
      uid: fa30ef08-695e-415f-b369-2fa725b01835
      controller: true
      blockOwnerDeletion: true
spec:
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 8012
  clusterIP: 10.128.9.144
  type: ClusterIP
  sessionAffinity: None
status:
  loadBalancer: {}

Expected behavior

I'd expect that Kong identifies my service and apply the KongIngress to Kong's Ingress to redirect all HTTP requests with 302 to https.

Installation procedure

kubectl apply --filename https://github.com/knative/serving/releases/download/v0.15.0/serving-crds.yaml
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.15.0/serving-core.yaml
kubectl apply --filename https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/0.9.1/deploy/single/all-in-one-dbless.yaml
kubectl patch configmap/config-network \
  --namespace knative-serving \
  --type merge \
  --patch '{"data":{"ingress.class":"kong"}}'
kubectl --namespace kong get service kong-proxy
@hbagdi
Copy link
Member

hbagdi commented Jun 24, 2020

This is expected. We added support for plugins for knative services but didn't add support for overrides.
We will add support for https redirects and other route-level properties.
PRs welcome if you or anyone else wants to get to it before the maintainers can.

@hbagdi
Copy link
Member

hbagdi commented Sep 11, 2020

Closing this due to lack of activity. Please re-open if needed.

@rafaelfelix
Copy link
Contributor

Just pushed https://github.com/Kong/kubernetes-ingress-controller/pull/908m which should fix this.

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

3 participants