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: old pods are listed in new pod section for devtron apps deployed through Helm #89

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ashishdevtron
Copy link
Contributor

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

@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

for _, node := range nodes {
if node.Kind == k8sCommonBean.DeploymentKind {
deploymentNode := node.ResourceRef.Manifest.Object
dNodeMap := deploymentNode["spec"].(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.

there should be constants already present for these keys, use them


d, err := json.Marshal(dNodeTemplate)
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

add log

isNew = replicaSet.GetLabels()["pod-template-hash"] == pod.GetLabels()["pod-template-hash"]
replicaNode := replicaSetNode.ResourceRef.Manifest.Object
replicaNodeMap := replicaNode["spec"].(map[string]interface{})
replicaNodeTemplate := replicaNodeMap["template"]
Copy link
Member

Choose a reason for hiding this comment

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

same as above


replica, err := json.Marshal(replicaNodeTemplate)
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

log

replicaSetTemplate := &coreV1.PodTemplateSpec{}
err = json.Unmarshal(replica, replicaSetTemplate)
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

log

rsCopy := replicaSetTemplate.DeepCopy()
labels := make(map[string]string)
for k, v := range rsCopy.Labels {
if k != "pod-template-hash" {
Copy link
Member

Choose a reason for hiding this comment

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

constant

"reflect"
)

const alphanums = "bcdfghjklmnpqrstvwxz2456789"
Copy link
Member

Choose a reason for hiding this comment

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

why not include a & 1?

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

Successfully merging this pull request may close these issues.

2 participants