Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

chore: cleanup dead code #4053

Merged
merged 1 commit into from
Nov 20, 2020
Merged

Conversation

jackfrancis
Copy link
Member

Reason for Change:

This PR removes dead code, the result of an audit of pkg/api/types.go. Plenty of indirection happened and various parts of the codebase were pruned, but the main story was culling through the type library for no-longer relevant stuffs.

Issue Fixed:

Credit Where Due:

Does this change contain code from or inspired by another project?

  • No
  • Yes

If "Yes," did you notify that project's maintainers and provide attribution?

  • No
  • Yes

Requirements:

Notes:

@codecov
Copy link

codecov bot commented Nov 19, 2020

Codecov Report

Merging #4053 (c4b77d4) into master (29c2508) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4053      +/-   ##
==========================================
- Coverage   73.22%   73.21%   -0.01%     
==========================================
  Files         135      135              
  Lines       20640    20540     -100     
==========================================
- Hits        15113    15039      -74     
+ Misses       4550     4527      -23     
+ Partials      977      974       -3     
Impacted Files Coverage Δ
pkg/api/defaults.go 93.41% <ø> (ø)
pkg/api/mocks.go 100.00% <ø> (ø)
pkg/api/vlabs/types.go 72.85% <ø> (+0.32%) ⬆️
pkg/armhelpers/support_validator.go 61.11% <ø> (+2.18%) ⬆️
pkg/engine/engine.go 86.77% <ø> (+0.01%) ⬆️
pkg/engine/template_generator.go 67.55% <ø> (+0.73%) ⬆️
pkg/engine/templates_generated.go 43.70% <ø> (ø)
pkg/engine/virtualmachines.go 82.79% <ø> (+1.73%) ⬆️
pkg/engine/virtualmachinescalesets.go 80.72% <ø> (+1.28%) ⬆️
pkg/api/types.go 92.14% <100.00%> (-1.18%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29c2508...c4b77d4. Read the comment docs.

Copy link
Member

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

/lgtm

@@ -1106,20 +1010,6 @@ func (p *Properties) GetClusterID() string {
return p.ClusterID
}

// GetClusterMetadata returns a instance of the struct type api.ClusterMetadata.
func (p *Properties) GetClusterMetadata() *ClusterMetadata {
Copy link
Member

Choose a reason for hiding this comment

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

This wasn't used anywhere outside the unit test, eh? So much cruft!

@@ -535,15 +479,6 @@ type CustomFile struct {
Dest string `json:"dest,omitempty"`
}

// BootstrapProfile represents the definition of the DCOS bootstrap node used to deploy the cluster
Copy link
Member

Choose a reason for hiding this comment

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

Nice! I must have missed these structs in #3965.

return p.OrchestratorProfile.KubernetesConfig.IsIPMasqAgentDisabled()
}
return false
return p.OrchestratorProfile != nil &&
Copy link
Member

Choose a reason for hiding this comment

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

Alternate implementation: return !p.IsIPMasqAgentEnabled().

Copy link
Member Author

Choose a reason for hiding this comment

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

so this is a confusing one that I stumbled around as well

Basically there's a race condition between kubelet and addons defaults enforcement, and they depend on each other for this particular config. So what we want to confirm is that the addon is explicitly disabled. Whereas the "is enabled" foo will return false when it's empty/nil/whatever, which is misleading, because if you consider that authoritative and then the addons default foo sets it to true later in the code flow, you're in trouble.

Luckily we have UT to tell this story, and when I did the obvious thing that you suggested they complained!

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I was wondering if it was more of a tri-state boolean but I made the naive comment anyway. I don't remember these details for very long apparently. :-)

Copy link
Member

Choose a reason for hiding this comment

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

Also all hail the UT.

@acs-bot
Copy link

acs-bot commented Nov 20, 2020

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jackfrancis, mboersma

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [jackfrancis,mboersma]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jackfrancis jackfrancis merged commit 6dd804c into Azure:master Nov 20, 2020
@jackfrancis jackfrancis deleted the types-cleanup branch November 20, 2020 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants