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

networking.k8s.io/v1beta1 should be flagged deprecated also #94

Closed
jmcdon01 opened this issue Jan 27, 2021 · 7 comments · Fixed by #163
Closed

networking.k8s.io/v1beta1 should be flagged deprecated also #94

jmcdon01 opened this issue Jan 27, 2021 · 7 comments · Fixed by #163
Milestone

Comments

@jmcdon01
Copy link

Since 1.19 has moved ingress to v1 could we alert on both v1beta1 strings?

	"Ingress": {
		"old": ["extensions/v1beta1"],
		"new": "networking.k8s.io/v1beta1"

https://v1-19.docs.kubernetes.io/docs/setup/release/notes/#deprecations-and-removals
Ingress and IngressClass resources have graduated to networking.k8s.io/v1. Ingress and IngressClass types in the extensions/v1beta1 and networking.k8s.io/v1beta1 API versions are deprecated and will no longer be served in 1.22+

Once again thanks for the fantastic tool!

@mausch
Copy link

mausch commented May 11, 2022

Hi, this was closed 2021-06-11 but the latest release 0.5.1 (2021-10-26) doesn't seem to have it?

@stepanstipl
Copy link
Contributor

Hi @mausch,

I've checked with 0.5.1 in particular, and it seems to work as expected:

$~/Downloads/kubent -c=false --helm2=false --helm3=false -f ingress-v1beta1.yaml
11:27AM INF >>> Kube No Trouble `kubent` <<<
11:27AM INF version 0.5.1 (git sha a762ff3c6b5622650b86dc982652843cc2bd123c)
11:27AM INF Initializing collectors and retrieving data
11:27AM INF Retrieved 1 resources from collector name=File
11:27AM INF Loaded ruleset name=custom.rego.tmpl
11:27AM INF Loaded ruleset name=deprecated-1-16.rego
11:27AM INF Loaded ruleset name=deprecated-1-22.rego
11:27AM INF Loaded ruleset name=deprecated-1-25.rego
__________________________________________________________________________________________
>>> Deprecated APIs removed in 1.22 <<<
------------------------------------------------------------------------------------------
KIND      NAMESPACE     NAME           API_VERSION          REPLACE_WITH (SINCE)
Ingress   <undefined>   test-ingress   extensions/v1beta1   networking.k8s.io/v1 (1.19.0)

Can you elaborate a bit more on what exactly are you trying and is not working? If we're talking about in-cluster resource, can you share the full manifest (kubectl get ... -o yaml)? Cheers 👍

@mausch
Copy link

mausch commented Jun 7, 2022

Hi, thanks for checking back.
Just noticed that if I download the manifest and pass it to kubent explicitly it does recognise it as deprecated.
But when I let kubent scan in-cluster resources it doesn't report it.

The ingress is:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  creationTimestamp: "2021-09-30T18:29:19Z"
  generation: 4
  labels:
    app: elevate-app-graphql-api
    chart: elevate-app-graphql-api-0.1.1
    release: elevate-app-dev
  name: elevate-app-graphql-api
  namespace: dev
  resourceVersion: "218971072"
  selfLink: /apis/extensions/v1beta1/namespaces/dev/ingresses/elevate-app-graphql-api
  uid: 535013d3-221c-11ec-8ee3-0281f75a7f2b
spec:
  rules:
  - host: some_domain.com
    http:
      paths:
      - backend:
          serviceName: elevate-app-graphql-api
          servicePort: 80
        path: /graphql

@stepanstipl
Copy link
Contributor

No problem 😄.

This would be expected if the resource does not contain the kubectl.kubernetes.io/last-applied-configuration annotation. This is because the versioning applies to APIs, rather than the internal storage. I.e. once a resource is created, it's not directly possible to tell which API version was used, so we have to use various hints (kubectl.kubernetes.io/last-applied-configuration for cluster collector, or Helm actually stores the original manifests in-cluster). This is explained more in detail in #287 (comment) and the linked posts.

So I'm guessing you're not using kubectl (i.e. annotation is missing; also some other tools "copy" kubectl's behavour and add this annotation), nor Helm (the currently supported detection methods are listed in readme).

Out of curiosity - how do you deploy the manifests? Might give me some ideas for future support...

@mausch
Copy link

mausch commented Jun 7, 2022

Out of curiosity - how do you deploy the manifests? Might give me some ideas for future support...

Strange, I deploy with Helm 2.

kubent recognises all other deprecated resource types correctly... I've already used it to update a bunch of Deployments. The issue is only with Ingresses apparently.

@stepanstipl
Copy link
Contributor

Hmm, that should work. And thanks for the additional info. Let's try to find out why it is not flagged.

Can you please try to get and share the Helm manifest by running helm get manifest [RELEASE_NAME] - this should show the manifest stored in-cluster.

@mausch
Copy link

mausch commented Jun 8, 2022

Here's the ingress from the Helm manifest:

# Source: elevate-app/charts/elevate-app-graphql-api/templates/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: elevate-app-graphql-api
  labels:
    chart: "elevate-app-graphql-api-0.1.1"
    app: elevate-app-graphql-api
    release: "elevate-app-dev"
    
spec:
  rules:
  - host: "some_domain.com"
    http:
      paths:
      - path: "/graphql"
        backend:
          serviceName: elevate-app-graphql-api
          servicePort: 80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment