2.0.7 doesn't work with k8s v.1.18 and 2.0.6 doesn't break but doesn't properly parse tls ingress #77

Closed
opened 2020-12-03 20:43:04 +00:00 by titansmc · 13 comments

with 2.0.7 I get:

Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "Ingress" in version "networking.k8s.io/v1"

and with 2.0.6:

Error: YAML parse error on gitea/templates/gitea/ingress.yaml: error converting YAML to JSON: yaml: line 22: mapping values are not allowed in this context

which corresponds to:

ingress:
  enabled: true
  annotations: {}
    # kubernetes.io/ingress.class: traefik
    # kubernetes.io/tls-acme: "true"
  hosts:
    - git.test.io
  tls:
  #  - secretName: chart-example-tls
    - hosts:
      - git.test.io

with 2.0.7 I get: ``` Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "Ingress" in version "networking.k8s.io/v1" ``` and with 2.0.6: ``` Error: YAML parse error on gitea/templates/gitea/ingress.yaml: error converting YAML to JSON: yaml: line 22: mapping values are not allowed in this context ``` which corresponds to: ``` ingress: enabled: true annotations: {} # kubernetes.io/ingress.class: traefik # kubernetes.io/tls-acme: "true" hosts: - git.test.io tls: # - secretName: chart-example-tls - hosts: - git.test.io ```
Contributor

I have the same problem. Broke it down to this commit

The issue:
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
will render to true on Kubernetes 1.18 API, as there are other resources running on that version (f.e. NetworkPolicy). Ingress resource however is still runnning on networking.k8s.io/v1beta1.

So to fix this, please fix this from

4  {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
5  apiVersion: networking.k8s.io/v1
6  {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
7  apiVersion: networking.k8s.io/v1beta1
8  {{- else -}}
9  apiVersion: extensions/v1beta1
38             backend:
39             {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
40               service:
41                 name: {{ $fullName }}-http
42                 port:
43                   number: {{ $httpPort }}
44             {{- else }}
45               serviceName: {{ $fullName }}-http
46               servicePort: {{ $httpPort }}
47             {{- end }}

to:

4  {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
5  apiVersion: networking.k8s.io/v1
6  {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" -}}
7  apiVersion: networking.k8s.io/v1beta1
8  {{- else -}}
9  apiVersion: extensions/v1beta1
38             backend:
39             {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
40               service:
41                 name: {{ $fullName }}-http
42                 port:
43                   number: {{ $httpPort }}
44             {{- else }}
45               serviceName: {{ $fullName }}-http
46               servicePort: {{ $httpPort }}
47             {{- end }}

which just adds the resource type ("Ingress") to the Capabilities query.

I have the same problem. Broke it down to [this commit](https://gitea.com/gitea/helm-chart/commit/63bc10e39346ab33d7382d9667ed13d60549f531) The issue: `{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}` will render to `true` on Kubernetes 1.18 API, as there are other resources running on that version (f.e. [NetworkPolicy](https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#networkpolicy-v1-networking-k8s-io)). Ingress resource however is still runnning on [networking.k8s.io/v1beta1](https://v1-18.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#ingress-v1beta1-networking-k8s-io). So to fix this, please [fix this](https://gitea.com/gitea/helm-chart/src/commit/63bc10e39346ab33d7382d9667ed13d60549f531/templates/gitea/ingress.yaml) from ```yaml 4 {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}} 5 apiVersion: networking.k8s.io/v1 6 {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} 7 apiVersion: networking.k8s.io/v1beta1 8 {{- else -}} 9 apiVersion: extensions/v1beta1 ``` ```yaml 38 backend: 39 {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1" }} 40 service: 41 name: {{ $fullName }}-http 42 port: 43 number: {{ $httpPort }} 44 {{- else }} 45 serviceName: {{ $fullName }}-http 46 servicePort: {{ $httpPort }} 47 {{- end }} ``` to: ```yaml 4 {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} 5 apiVersion: networking.k8s.io/v1 6 {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" -}} 7 apiVersion: networking.k8s.io/v1beta1 8 {{- else -}} 9 apiVersion: extensions/v1beta1 ``` ```yaml 38 backend: 39 {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }} 40 service: 41 name: {{ $fullName }}-http 42 port: 43 number: {{ $httpPort }} 44 {{- else }} 45 serviceName: {{ $fullName }}-http 46 servicePort: {{ $httpPort }} 47 {{- end }} ``` which just adds the resource type ("Ingress") to the Capabilities query.
Author

do you also have issues when parsing tls options on 2.0.6 version?

do you also have issues when parsing tls options on 2.0.6 version?
Contributor

Sorry, I am currently unable to try that. As it is a new deployment we directly start with 2.0.7 which let me only to the ingress problem. But this should be fixed easily IMHO.

Sorry, I am currently unable to try that. As it is a new deployment we directly start with 2.0.7 which let me only to the ingress problem. But this should be fixed easily IMHO.
Member

Hi there, sorry for the late response.

Can you confirm that #78 works for you on k8s 1.18? Currently i can only test this for 1.19

Hi there, sorry for the late response. Can you confirm that #78 works for you on k8s 1.18? Currently i can only test this for 1.19
Author

@luhahn how can I test it? Should I deploy v2.1.0 ?
Cheers.

@luhahn how can I test it? Should I deploy v2.1.0 ? Cheers.
Member

I've added this pr version to novumrgi on github, since it is not merged you wont find it on dl.gitea. You can install it like this:

helm repo add novum-rgi https://novumrgi.github.io/helm/
helm install gitea novum-rgi/gitea --version 2.1.0
I've added this pr version to novumrgi on github, since it is not merged you wont find it on dl.gitea. You can install it like this: ```bash helm repo add novum-rgi https://novumrgi.github.io/helm/ helm install gitea novum-rgi/gitea --version 2.1.0 ```
Member

@titansmc do you have some time for testing, otherwise i need to setup a 1.18 cluster

@titansmc do you have some time for testing, otherwise i need to setup a 1.18 cluster
Contributor

Works on 1.18.6:

$ k version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:51:04Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}

$ helm upgrade --install giteatest --set ingress.enabled=true novum-rgi/gitea --version 2.1.0
Release "giteatest" does not exist. Installing it now.
NAME: giteatest
LAST DEPLOYED: Tue Dec  8 07:47:43 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
  http://git.example.com/

$ helm list
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
giteatest       default         1               2020-12-08 07:47:43.900693559 +0000 UTC deployed        gitea-2.1.0     1.13.0

$ k get ingress
NAME        CLASS    HOSTS             ADDRESS   PORTS   AGE
giteatest   <none>   git.example.com             80      40s
Works on 1.18.6: ``` $ k version Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:51:04Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"} $ helm upgrade --install giteatest --set ingress.enabled=true novum-rgi/gitea --version 2.1.0 Release "giteatest" does not exist. Installing it now. NAME: giteatest LAST DEPLOYED: Tue Dec 8 07:47:43 2020 NAMESPACE: default STATUS: deployed REVISION: 1 NOTES: 1. Get the application URL by running these commands: http://git.example.com/ $ helm list NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION giteatest default 1 2020-12-08 07:47:43.900693559 +0000 UTC deployed gitea-2.1.0 1.13.0 $ k get ingress NAME CLASS HOSTS ADDRESS PORTS AGE giteatest <none> git.example.com 80 40s ```
Member

thank you !

thank you !
luhahn added the
kind
bug
label 2020-12-08 08:34:49 +00:00
Contributor

So, fix got merged, but the version was already bumped to 2.1.0 yesterday (without the fix).
Will the chart (at https://dl.gitea.io/charts) be updated automatically even if there is no new chart version?

:)

Thanks in advance.

So, fix got merged, but the version was already bumped to `2.1.0` yesterday (without the fix). Will the chart (at https://dl.gitea.io/charts) be updated automatically even if there is no new chart version? :) Thanks in advance.
Member

No, i want to merge #80 first, so the admin creation will work again. There is some error in migrating from 1.12.6 -> 1.13.0.

With #80 the chart version will be bumped and we'Re going to release the ingress fix

No, i want to merge #80 first, so the admin creation will work again. There is some error in migrating from 1.12.6 -> 1.13.0. With #80 the chart version will be bumped and we'Re going to release the ingress fix
Member

#80 was merged, the ingress changes are available in 2.1.1

#80 was merged, the ingress changes are available in 2.1.1
Contributor

Working fine now. Thanks!

Working fine now. Thanks!
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/helm-chart#77
No description provided.