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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(CONVERSION_GEN) ## Runs Go related g
paths=./api/... \
paths=./$(EXP_DIR)/api/... \
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt

$(CONVERSION_GEN) \
--input-dirs=./api/v1alpha2 \
--output-file-base=zz_generated.conversion \
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


---
------

## Support Policy

Expand All @@ -47,7 +43,7 @@ Each version of Cluster API for Azure will attempt to support at least two Kuber

**NOTE:** As the versioning for this project is tied to the versioning of Cluster API, future modifications to this policy may be made to more closely align with other providers in the Cluster API ecosystem.

---
------

## Documentation

Expand Down
30 changes: 0 additions & 30 deletions api/v1alpha2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 0 additions & 59 deletions api/v1alpha3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.


// 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


// AzureResourceReference is a reference to a specific Azure resource by ID
type AzureResourceReference struct {
// 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.

}

// 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).


// AzureMachineProviderConditionType is a valid value for AzureMachineProviderCondition.Type
type AzureMachineProviderConditionType string

Expand Down Expand Up @@ -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

// String returns a string representation of the security group.
func (s *SecurityGroup) String() string {
return fmt.Sprintf("id=%s/name=%s", s.ID, s.Name)
}
*/

// SecurityGroupProtocol defines the protocol type for a security group rule.
type SecurityGroupProtocol string

Expand Down Expand Up @@ -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

// String returns a string representation of the ingress rule.
/*
func (i *IngressRule) String() string {
return fmt.Sprintf("protocol=%s/range=[%d-%d]/description=%s", i.Protocol, i.FromPort, i.ToPort, i.Description)
}
*/

// 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

// Difference returns the difference between this slice and the other slice.
/*
func (i IngressRules) Difference(o IngressRules) (out IngressRules) {
for _, x := range i {
found := false
for _, y := range o {
sort.Strings(x.CidrBlocks)
sort.Strings(y.CidrBlocks)
sort.Strings(x.SourceSecurityGroupIDs)
sort.Strings(y.SourceSecurityGroupIDs)
if reflect.DeepEqual(x, y) {
found = true
break
}
}
if !found {
out = append(out, x)
}
}
return
}
*/

// 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.

type PublicIP struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Expand Down
20 changes: 0 additions & 20 deletions api/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cloud/services/subnets/subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

// subnet already exists, skip creation
if subnetSpec.Role == infrav1.SubnetControlPlane {
subnet.DeepCopyInto(s.Scope.ControlPlaneSubnet())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

// if *vmExt.ProvisioningState != string(compute.ProvisioningStateSucceeded) {
// // If the script failed delete it so it can be retried
// s.Delete(ctx, vmExtSpec)
// }

klog.V(2).Infof("successfully created vm extension %s ", vmExtSpec.Name)
return nil
}
Expand Down
1 change: 0 additions & 1 deletion cloud/services/virtualmachines/virtualmachines.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

storageProfile := &compute.StorageProfile{
OsDisk: &compute.OSDisk{
Name: to.StringPtr(azure.GenerateOSDiskName(vmSpec.Name)),
Expand Down
1 change: 0 additions & 1 deletion cloud/services/virtualnetworks/virtualnetworks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

vnet.DeepCopyInto(s.Scope.Vnet())
return nil
}
Expand Down
2 changes: 0 additions & 2 deletions controllers/azurecluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

// instead when we look at configuring private clusters.
if azureCluster.Status.Network.APIServerIP.DNSName == "" {
clusterScope.Info("Waiting for API server endpoint to exist")
return reconcile.Result{RequeueAfter: 15 * time.Second}, nil
Expand Down
23 changes: 4 additions & 19 deletions controllers/azuremachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,24 +217,16 @@ 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.

if errs := r.validateUpdate(&machineScope.AzureMachine.Spec, vm); len(errs) > 0 {
agg := kerrors.NewAggregate(errs)
r.Recorder.Eventf(machineScope.AzureMachine, corev1.EventTypeWarning, "InvalidUpdate", "Invalid update: %s", agg.Error())
return reconcile.Result{}, nil
}

// 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...

machineScope.SetAnnotation("cluster-api-provider-azure", "true")

machineScope.SetAddresses(vm.Addresses)

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

switch vm.State {
case infrav1.VMStateSucceeded:
machineScope.V(2).Info("VM is running", "id", *machineScope.GetVMID())
Expand Down Expand Up @@ -306,14 +298,7 @@ func (r *AzureMachineReconciler) reconcileDelete(machineScope *scope.MachineScop
return reconcile.Result{}, nil
}

// 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.

return errs
}

// AzureClusterToAzureMachine is a handler.ToRequestsFunc to be used to enqueue requests for reconciliation
// AzureClusterToAzureMachines is a handler.ToRequestsFunc to be used to enqueue requests for reconciliation
// of AzureMachines.
func (r *AzureMachineReconciler) AzureClusterToAzureMachines(o handler.MapObject) []ctrl.Request {
result := []ctrl.Request{}
Expand Down
1 change: 0 additions & 1 deletion controllers/azuremachine_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

type azureMachineService struct {
machineScope *scope.MachineScope
clusterScope *scope.ClusterScope
Expand Down
14 changes: 0 additions & 14 deletions hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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.

// https://github.com/golangci/golangci-lint/issues/595 is fixed.
github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540 => github.com/go-critic/go-critic v0.0.0-20190526074819-1df300866540
github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6 => github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6
github.com/golangci/go-tools v0.0.0-20180109140146-af6baa5dc196 => github.com/golangci/go-tools v0.0.0-20190318060251-af6baa5dc196
github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98 => github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98
github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547 => github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547
github.com/golangci/ineffassign v0.0.0-20180808204949-42439a7714cc => github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc
github.com/golangci/lint-1 v0.0.0-20180610141402-ee948d087217 => github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217
github.com/timakin/bodyclose => github.com/golangci/bodyclose v0.0.0-20190714144026-65da19158fa2
mvdan.cc/unparam v0.0.0-20190124213536-fbb59629db34 => mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34
)
4 changes: 2 additions & 2 deletions hack/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golangci/bodyclose v0.0.0-20190714144026-65da19158fa2 h1:nh/PMhIaxu+h8NOuhOwT2el9Ed08166oitASyNYqQzs=
github.com/golangci/bodyclose v0.0.0-20190714144026-65da19158fa2/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0=
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4=
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM=
Expand Down Expand Up @@ -545,6 +543,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q=
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tommy-muehle/go-mnd v1.1.1 h1:4D0wuPKjOTiK2garzuPGGvm4zZ/wLYDOH8TJSABC7KU=
Expand Down
1 change: 0 additions & 1 deletion scripts/ci-conformance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,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.

kubectl logs deploy/capz-controller-manager -n capz-system manager > "${ARTIFACTS}/logs/capz-manager.log" || true
}

Expand Down
1 change: 0 additions & 1 deletion test/e2e/generators/capi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

if g.GitRef != "" {
kustomize := exec.NewCommand(
exec.WithCommand("kustomize"),
Expand Down
1 change: 0 additions & 1 deletion test/e2e/generators/capz.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

return []byte(os.ExpandEnv(string(stdout)))
}
3 changes: 0 additions & 3 deletions test/integration/metacluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

// types are available
})