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

fix: suppress Kubernetes API deprecation warnings from application controller (#11973) #12067

Merged

Conversation

toVersus
Copy link
Contributor

@toVersus toVersus commented Jan 21, 2023

Signed-off-by: Tsubasa Nagasawa toversus2357@gmail.com

Fixes: #11973

Suppress Kubernetes API deprecation warnings for log levels that are less than Debug by customizing the cluster cache client warning handler.

❯ kind version
kind v0.17.0 go1.19.2 linux/amd64

# Build Argo CD image from fix/suppress-deprecation-warnings branch
make image

# Create Kind cluster
kind create cluster --image kindest/node:v1.23.13@sha256:ef453bb7c79f0e3caba88d2067d4196f427794086a7d0df8df4f019d5e336b61
# Load Argo CD image into Kind cluster
kind load docker-image argocd:latest

# Install Argo CD using default setup
kubectl create ns argocd
kubectl apply -n argocd -f manifests/install.yaml

# Apply the patch to replace the image with a local build
kubectl patch -n argocd sts argocd-application-controller -p '{"spec":{"template":{"spec":{"containers":[{"name":"argocd-application-controller","image":"argocd:latest","imagePullPolicy":"Never"}]}}}}'

# Create Argo CD Application to start watcher
cat <<EOF | kubectl apply -n argocd -f -
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: grafana
spec:
  project: default
  source:
    chart: grafana
    repoURL: https://grafana.github.io/helm-charts
    targetRevision: 6.50.8
    helm:
      releaseName: grafana
  destination:
    server: "https://kubernetes.default.svc"
    namespace: default
EOF

# Check to see if there are no API deprecation warning logs
kubectl logs -n argocd -f sts/argocd-application-controller

# Change log level to debug
kubectl patch -n argocd configmap/argocd-cmd-params-cm -p '{"data":{"controller.log.level":"debug"}}'

# Restart argocd-application-controller
kubectl rollout restart -n argocd sts/argocd-application-controller

# Check to see if there are API deprecation warning logs
kubectl logs -n argocd -f sts/argocd-application-controller
# W0222 11:29:33.616120       1 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+
# W0222 11:29:33.626792       1 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@codecov
Copy link

codecov bot commented Jan 21, 2023

Codecov Report

Base: 47.76% // Head: 47.75% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (899655c) compared to base (ba86be2).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12067      +/-   ##
==========================================
- Coverage   47.76%   47.75%   -0.02%     
==========================================
  Files         246      246              
  Lines       41910    41923      +13     
==========================================
  Hits        20020    20020              
- Misses      19891    19904      +13     
  Partials     1999     1999              
Impacted Files Coverage Δ
controller/cache/cache.go 26.35% <0.00%> (-0.80%) ⬇️
util/settings/settings.go 49.36% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

…ntroller

Completely suppress warning logs only for log levels that are less than Debug.

Signed-off-by: toVersus <toversus2357@gmail.com>
@toVersus toVersus force-pushed the fix/suppress-deprecation-warnings branch from 3e4801e to 899655c Compare February 22, 2023 11:36
@toVersus
Copy link
Contributor Author

@blakepettersson
Added step in PR description to confirm that changes work as expected. PTAL

Copy link
Member

@blakepettersson blakepettersson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@crenshaw-dev
Copy link
Collaborator

/cherry-pick release-2.6

@crenshaw-dev
Copy link
Collaborator

/cherry-pick release-2.5

@crenshaw-dev
Copy link
Collaborator

/cherry-pick release-2.4

Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @toVersus!

@crenshaw-dev crenshaw-dev merged commit 42d1c85 into argoproj:master Mar 6, 2023
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Mar 6, 2023
…ntroller (#12067)

Completely suppress warning logs only for log levels that are less than Debug.

Signed-off-by: toVersus <toversus2357@gmail.com>
@gcp-cherry-pick-bot
Copy link

Cherry-pick failed with Merge error 42d1c85d7588f1a4c9014a5dff58af4acff540c0 into temp-cherry-pick-832928-release-2.5

@gcp-cherry-pick-bot
Copy link

Cherry-pick failed with Merge error 42d1c85d7588f1a4c9014a5dff58af4acff540c0 into temp-cherry-pick-832928-release-2.4

crenshaw-dev pushed a commit that referenced this pull request Mar 6, 2023
…ntroller (#12067)

Completely suppress warning logs only for log levels that are less than Debug.

Signed-off-by: toVersus <toversus2357@gmail.com>
crenshaw-dev pushed a commit that referenced this pull request Mar 6, 2023
…ntroller (#12067)

Completely suppress warning logs only for log levels that are less than Debug.

Signed-off-by: toVersus <toversus2357@gmail.com>
@crenshaw-dev
Copy link
Collaborator

Manually cherry-picked onto release-2.5 and release-2.4.

crenshaw-dev pushed a commit that referenced this pull request Mar 6, 2023
…ntroller (#12067) (#12742)

Completely suppress warning logs only for log levels that are less than Debug.

Signed-off-by: toVersus <toversus2357@gmail.com>
Co-authored-by: Tsubasa Nagasawa <toversus2357@gmail.com>
@toVersus toVersus deleted the fix/suppress-deprecation-warnings branch March 7, 2023 01:42
yyzxw pushed a commit to yyzxw/argo-cd that referenced this pull request Aug 9, 2023
…ntroller (argoproj#12067)

Completely suppress warning logs only for log levels that are less than Debug.

Signed-off-by: toVersus <toversus2357@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Issues with Kubernetes API Deprecation warnings
4 participants