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

HPA autoscaling/v2beta2 Deprecated Warning #23612

Closed
gurpartb opened this issue Jun 21, 2023 · 6 comments
Closed

HPA autoscaling/v2beta2 Deprecated Warning #23612

gurpartb opened this issue Jun 21, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers receiver/k8scluster

Comments

@gurpartb
Copy link

gurpartb commented Jun 21, 2023

Component(s)

receiver/k8scluster

What happened?

Description

Repeatedly getting HPA autoscaling/v2beta2 Deprecated Warning in AKS

Steps to Reproduce

Deploy Otel Collector version 0.76.0 in AKS

Expected Result

Ignore autoscaling/v2beta2 warning

Actual Result

Deprecated Warning

Collector version

v0.76.0

Environment information

Environment

Node Info:
architecture : amd64
bootID : xxx
containerRuntimeVersion : containerd://1.7.1+azure-1
kernelVersion : 5.15.0-1038-azure
kubeProxyVersion : v1.25.6
kubeletVersion : v1.25.6
machineID : xxx
operatingSystem : linux
osImage : Ubuntu 22.04.2 LTS
systemUUID : xxx

OpenTelemetry Collector configuration

data:
  relay: |
    exporters:
      splunk_hec/platform_metrics:
        endpoint: xxx
        index: xxx
        splunk_app_version: 0.76.0
        token: ${SPLUNK_PLATFORM_HEC_TOKEN}
    extensions:
      health_check: null
      memory_ballast:
        size_mib: ${SPLUNK_BALLAST_SIZE_MIB}
    processors:
      batch:
        send_batch_max_size: 32768
      memory_limiter:
        check_interval: 2s
        limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
      resource:
        attributes:
        - action: insert
          key: metric_source
          value: kubernetes
      resource/add_collector_k8s:
        attributes:
        - action: insert
          key: k8s.node.name
          value: ${K8S_NODE_NAME}
        - action: insert
          key: k8s.pod.name
          value: ${K8S_POD_NAME}
        - action: insert
          key: k8s.pod.uid
          value: ${K8S_POD_UID}
        - action: insert
          key: k8s.namespace.name
          value: ${K8S_NAMESPACE}
      resource/k8s_cluster:
        attributes:
        - action: insert
          key: receiver
          value: k8scluster
    receivers:
      k8s_cluster:
        auth_type: serviceAccount
    service:
      extensions:
      - health_check
      - memory_ballast
      pipelines:
        metrics:
          exporters:
          - splunk_hec/platform_metrics
          processors:
          - memory_limiter
          - batch
          - resource
          - resource/k8s_cluster
          receivers:
          - k8s_cluster

Log output

W0621 17:17:58.295255       1 warnings.go:70] autoscaling/v2beta2 HorizontalPodAutoscaler is deprecated in v1.23+, unavailable in v1.26+; use autoscaling/v2 HorizontalPodAutoscaler
W0621 17:17:58.299935       1 warnings.go:70] autoscaling/v2beta2 HorizontalPodAutoscaler is deprecated in v1.23+, unavailable in v1.26+; use autoscaling/v2 HorizontalPodAutoscaler

Additional context

No response

@gurpartb gurpartb added bug Something isn't working needs triage New item requiring triage labels Jun 21, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

  • receiver/k8scluster: @dmitryax @TylerHelmuth
  • needs: Github issue template generation code needs this to generate the corresponding labels.

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Aug 21, 2023
@dmitryax
Copy link
Member

The collector tries to discover and use any resources available in the cluster. This warning is nothing to worry about and will disappear after 1.23

@technimad-splunk
Copy link
Contributor

I can confirm version 0.82 of the collector generates errors on OpenShift.
A deprecated API, horizontalpodautoscalers.v2beta2.autoscaling, is being queried.
This puts the cluster in a state where it cannot be upgraded.

@prashant-shahi
Copy link
Contributor

prashant-shahi commented Sep 4, 2023

A deprecated API, horizontalpodautoscalers.v2beta2.autoscaling, is being queried.
This puts the cluster in a state where it cannot be upgraded.

Same behaviour in GKE for version 0.79.

Screenshot:

Screenshot

/cc @dmitryax

@dmitryax
Copy link
Member

dmitryax commented Sep 5, 2023

Sorry, I meant the warning will disappear in 1.26 when the deprecated resources are discontinued. The warning is raised in the following course of actions:

  1. k8scluster receiver fetches list of all supported k8s API resources.
  2. k8s API responds with all supported resources, including deprecated ones.
  3. k8scluster receiver watches for changes in any of them, including deprecated resources -- here is where the warning is thrown by the k8s API client.

If we exclude watching for deprecated resources, collector can stop recoding some metrics after k8s cluster upgrade to a version at that deprecates some resources but user has not updated them yet. I don't think we should do it by default.

Maybe there is an option to suppress the warnings. I'm not aware of any. I'll put a label "help wanted" in case if anyone can try to find a way.

If there is no way to suppress the warnings, we can add an optional configuration to not watch for deprecated resources e.g. ignore_deprecated_resource. Enabling this removes the warning, but the deprecated resources will not be watched. This should be an opt-in.

@dmitryax dmitryax added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers and removed bug Something isn't working labels Sep 5, 2023
@crobert-1 crobert-1 removed needs triage New item requiring triage help wanted Extra attention is needed labels Sep 8, 2023
dmitryax added a commit that referenced this issue Sep 11, 2023
…es (#26516)

**Description:**
Remove support for deprecated Kubernetes API resources: 
- `batch/v1beta1`
- `autoscaling/v2beta2`

This also resolves the issue with double reporting metrics for hpa and
cronjob in certain k8s versions.

**Link to tracking Issue(s):**
#23612 #26551

**Testing:**
From source, built the custom image
[coolboi567/otelcontribcol:0.83.1](https://hub.docker.com/layers/coolboi567/otelcontribcol/0.83.1/images/sha256-fe111e1dff87a26eb64217a8505b84679263c8d7b3ffa16656bba1c1865052d5?context=explore)
and tested in kubernetes cluster `v1.25` as well as `v1.27`.

In K8s `v1.25`, we no longer see the warnings in the logs about usage of
deprecated APIs.

**Documentation:**
N/A

---------

Signed-off-by: Prashant Shahi <me@prashantshahi.dev>
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers receiver/k8scluster
Projects
None yet
Development

No branches or pull requests

6 participants