Skip to content

fix: old pods are listed in new pod section for devtron apps deployed through Helm #4165

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

Closed
wants to merge 3 commits into from

Conversation

ashishdevtron
Copy link
Contributor

Description

These changes fix the flag condition which decides whether the pods are new or old

Fixes #4024

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


podMetadata := resourceTree["podMetadata"]
for _, data := range podMetadata.([]interface{}) {
dataMap := data.(map[string]interface{})
if _, ok := dataMap["isNew"]; !ok {
Copy link
Member

Choose a reason for hiding this comment

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

replace with constant

@@ -1594,6 +1594,14 @@ func (handler AppListingRestHandlerImpl) fetchResourceTree(w http.ResponseWriter
}
if detail != nil && detail.ReleaseExist {
resourceTree = util2.InterfaceToMapAdapter(detail.ResourceTreeResponse)
// add "isNew = false" flag in podMetaData - isNew flag will be omitted when the value is false
podMetadata := resourceTree["podMetadata"]
Copy link
Member

Choose a reason for hiding this comment

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

replace with constant

@@ -1594,6 +1594,14 @@ func (handler AppListingRestHandlerImpl) fetchResourceTree(w http.ResponseWriter
}
if detail != nil && detail.ReleaseExist {
resourceTree = util2.InterfaceToMapAdapter(detail.ResourceTreeResponse)
// add "isNew = false" flag in podMetaData - isNew flag will be omitted when the value is false
podMetadata := resourceTree["podMetadata"]
for _, data := range podMetadata.([]interface{}) {
Copy link
Member

Choose a reason for hiding this comment

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

is this type assertion always going to work? should add a validation for this

// add "isNew = false" flag in podMetaData - isNew flag will be omitted when the value is false
podMetadata := resourceTree["podMetadata"]
for _, data := range podMetadata.([]interface{}) {
dataMap := data.(map[string]interface{})
Copy link
Member

Choose a reason for hiding this comment

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

check for assertion

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vikramdevtron
Copy link
Contributor

Outdated, Not required anymore

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

Successfully merging this pull request may close these issues.

Bug: old pods are listed in new pod section for devtron apps deployed through Helm
3 participants