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

🏃 Remove all TODOs in the codebase #555

Merged
merged 1 commit into from
Apr 24, 2020

Conversation

CecileRobertMichon
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon commented Apr 20, 2020

What this PR does / why we need it: Removed all TODOs from the code and either 1) Opened a corresponding issue 2) marked as resolve.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #148

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 20, 2020
@k8s-ci-robot k8s-ci-robot added area/provider/azure Issues or PRs related to azure provider sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 20, 2020
@@ -19,11 +19,7 @@ hybrid deployments of Kubernetes.

Check out the [Cluster API Quick Start][quickstart] to create your first Kubernetes cluster on Azure using Cluster API.

## Features

TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makefile Outdated Show resolved Hide resolved
// TODO: Investigate if we should reference resources in other ways
}

// TODO: Investigate resource filters
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: Azure doesn't have resource filters, it's an AWS concept only (Azure has resource groups).

// TODO: ResourceSpec should be removed once concrete specs have been defined for all Azure resources in use.
// type ResourceSpec interface{}

// TODO: Write type tests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: there are no testable functions in this file, only type definitions

@@ -23,22 +23,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// // ResourceSpec defines a generic spec that can used to define Azure resources.
// TODO: ResourceSpec should be removed once concrete specs have been defined for all Azure resources in use.
// type ResourceSpec interface{}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: removed this as it is unused and we have individual specs for the Azure resources used.

// ID of resource
// +optional
ID *string `json:"id,omitempty"`
// TODO: Investigate if we should reference resources in other ways
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: removed AzureResourceReference as it is unused in the codebase and Azure does not have several ways for referencing resources.

@@ -157,14 +141,6 @@ type SecurityGroup struct {
Tags Tags `json:"tags,omitempty"`
}

/*
// TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: dead code

@@ -197,45 +173,10 @@ type IngressRule struct {
Destination *string `json:"destination,omitempty"`
}

// TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: dead code

// IngressRules is a slice of Azure ingress rules for security groups.
type IngressRules []*IngressRule

// TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: dead code

// PublicIP defines an Azure public IP address.
// TODO: Remove once load balancer is implemented.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: load balancer is already implemented but we still reference this type in the Network struct for APIServerIP.

@@ -75,7 +75,6 @@ func (s *Service) Reconcile(ctx context.Context, spec interface{}) error {
return errors.New("Invalid Subnet Specification")
}
if subnet, err := s.Get(ctx, subnetSpec); err == nil {
// TODO: add validation on existing subnet
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -78,12 +78,6 @@ func (s *Service) Reconcile(ctx context.Context, spec interface{}) error {
return errors.Wrapf(err, "cannot create vm extension")
}

// TODO: review if can remove this code
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: dead code

@@ -275,7 +275,6 @@ func getResourceNameByID(resourceID string) string {

// generateStorageProfile generates a pointer to a compute.StorageProfile which can utilized for VM creation.
func generateStorageProfile(vmSpec Spec) (*compute.StorageProfile, error) {
// TODO: Validate parameters before building storage profile
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -89,7 +89,6 @@ func (s *Service) Reconcile(ctx context.Context, spec interface{}) error {
s.Scope.V(2).Info("Working on custom vnet", "vnet-id", vnet.ID)
}
// vnet already exists, cannot update since it's immutable
// TODO: ensure tags & other managed vnet attributes
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: this is not needed: if the vnet is detected as "managed" then it already has the "owner" tags. If not, then it is probably unmanaged and we shouldn't apply those tags. I don't think "other managed vnet attributes" applies here, I believe this is a leftover copy paste from capa.

@@ -123,8 +123,6 @@ func (r *AzureClusterReconciler) reconcileNormal(clusterScope *scope.ClusterScop
return reconcile.Result{}, errors.Wrap(err, "failed to reconcile cluster services")
}

// TODO: We may need to use azureCluster.Status.Network.APIServerIP.IPAddress
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -217,7 +217,6 @@ func (r *AzureMachineReconciler) reconcileNormal(ctx context.Context, machineSco
return reconcile.Result{}, err
}

// TODO(ncdc): move this validation logic into a validating webhook
Copy link
Contributor Author

Choose a reason for hiding this comment

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

// validateUpdate checks that no immutable fields have been updated and
// returns a slice of errors representing attempts to change immutable state.
func (r *AzureMachineReconciler) validateUpdate(spec *infrav1.AzureMachineSpec, i *infrav1.VM) (errs []error) {
// TODO: Add comparison logic for immutable fields
Copy link
Contributor Author

Choose a reason for hiding this comment

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

// Make sure Spec.ProviderID is always set.
machineScope.SetProviderID(fmt.Sprintf("azure:////%s", vm.ID))

// Proceed to reconcile the AzureMachine state.
machineScope.SetVMState(vm.State)

// TODO(vincepri): Remove this annotation when clusterctl is no longer relevant.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vincepri is this still relevant?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we use this any longer, cc @fabriziopandini

Copy link
Member

Choose a reason for hiding this comment

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

clusterctl uses cluster.x-k8s.io/provider label, so AFAIK this annotation can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I removed it and now E2E is failing so maybe it is needed...

@@ -42,7 +42,6 @@ const (
)

// azureMachineService are list of services required by cluster actuator, easy to create a fake
// TODO: We should decide if we want to keep this
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -24,17 +24,3 @@ require (
sigs.k8s.io/kustomize/kustomize/v3 v3.5.4
sigs.k8s.io/testing_frameworks v0.1.2
)

replace (
// TODO(vincepri) Remove the following replace directives, needed for golangci-lint until
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: golangci/golangci-lint#595 is fixed.

@@ -133,7 +133,6 @@ run_tests() {
}

get_logs() {
# TODO collect more logs https://github.com/kubernetes-sigs/cluster-api-provider-azure/issues/474
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -49,7 +49,6 @@ func (g *ClusterAPI) releaseYAMLPath() string {

// Manifests return the generated components and any error if there is one.
func (g *ClusterAPI) Manifests(ctx context.Context) ([]byte, error) {
// TODO: this is not very nice
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jadarsie is this still relevant? If so could you please file an issue with what you had in mind

Copy link
Contributor

Choose a reason for hiding this comment

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

Not my comment actually, it was there in the first iteration of the test framework

kubernetes-sigs/cluster-api@ea48d0c#diff-c4cddf335f3f881e1b942982a3ada01f

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, removed those files in #569 because I realized these were duplicates from the ones in the upstream framework.

@@ -59,6 +59,5 @@ func expandCredVariables(stdout []byte, creds auth.Creds) []byte {
os.Setenv("AZURE_CLIENT_SECRET_B64", base64.StdEncoding.EncodeToString([]byte(creds.ClientSecret)))
os.Setenv("AZURE_SUBSCRIPTION_ID_B64", base64.StdEncoding.EncodeToString([]byte(creds.SubscriptionID)))
os.Setenv("AZURE_TENANT_ID_B64", base64.StdEncoding.EncodeToString([]byte(creds.TenantID)))
// TODO Figure out a better way of doing this
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jadarsie same here

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not remember what I meant. Probably something related to the fact that stdout is turned into string and []byte back and forth a few times.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it can be removed

@@ -47,7 +47,4 @@ var _ = Describe("Metacluster", func() {
AfterEach(func() {
kindCluster.Teardown()
})

// TODO: validate that the controller-manager is deployed and the
Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved: this test suite is empty and not being used. @justaugustus to confirm there is nothing to do here.

Copy link
Member

Choose a reason for hiding this comment

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

Fine to remove

@CecileRobertMichon CecileRobertMichon changed the title [WIP] 🏃 Remove all TODOs in the codebase 🏃 Remove all TODOs in the codebase Apr 20, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 20, 2020
@CecileRobertMichon
Copy link
Contributor Author

/hold

waiting for a few responses from TODO items owners

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 20, 2020
@CecileRobertMichon
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 23, 2020
@CecileRobertMichon
Copy link
Contributor Author

/retest

@CecileRobertMichon
Copy link
Contributor Author

/hold cancel

@CecileRobertMichon
Copy link
Contributor Author

/retest

@justaugustus
Copy link
Member

This is a really impressive cleanup, @CecileRobertMichon!
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 24, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon, justaugustus

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 [CecileRobertMichon,justaugustus]

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

@k8s-ci-robot k8s-ci-robot merged commit 3db249f into kubernetes-sigs:master Apr 24, 2020
@k8s-ci-robot k8s-ci-robot added this to the v0.5 milestone Apr 24, 2020
@CecileRobertMichon CecileRobertMichon deleted the sweep-todos branch September 29, 2020 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep TODOs
6 participants