-
Notifications
You must be signed in to change notification settings - Fork 13
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
base: main
Are you sure you want to change the base?
Conversation
Kudos, SonarCloud Quality Gate passed!
|
for _, node := range nodes { | ||
if node.Kind == k8sCommonBean.DeploymentKind { | ||
deploymentNode := node.ResourceRef.Manifest.Object | ||
dNodeMap := deploymentNode["spec"].(map[string]interface{}) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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"] |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" { |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
These changes fix the flag condition which decides whether the pods are new or old