Skip to content

Commit

Permalink
refactor resource tracker to be usable across packages
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsykim committed Sep 2, 2017
1 parent 022529c commit 76ea7e9
Show file tree
Hide file tree
Showing 10 changed files with 376 additions and 301 deletions.
11 changes: 6 additions & 5 deletions cmd/kops/delete_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"k8s.io/kops/pkg/apis/kops/registry"
"k8s.io/kops/pkg/kubeconfig"
"k8s.io/kops/pkg/resources"
"k8s.io/kops/pkg/resources/tracker"
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/cloudup"
"k8s.io/kops/upup/pkg/fi/cloudup/awsup"
Expand Down Expand Up @@ -148,7 +149,7 @@ func RunDeleteCluster(f *util.Factory, out io.Writer, options *DeleteClusterOpti
return err
}

clusterResources := make(map[string]*resources.ResourceTracker)
clusterResources := make(map[string]*tracker.Resource)
for k, resource := range allResources {
if resource.Shared {
continue
Expand All @@ -162,16 +163,16 @@ func RunDeleteCluster(f *util.Factory, out io.Writer, options *DeleteClusterOpti
wouldDeleteCloudResources = true

t := &tables.Table{}
t.AddColumn("TYPE", func(r *resources.ResourceTracker) string {
t.AddColumn("TYPE", func(r *tracker.Resource) string {
return r.Type
})
t.AddColumn("ID", func(r *resources.ResourceTracker) string {
t.AddColumn("ID", func(r *tracker.Resource) string {
return r.ID
})
t.AddColumn("NAME", func(r *resources.ResourceTracker) string {
t.AddColumn("NAME", func(r *tracker.Resource) string {
return r.Name
})
var l []*resources.ResourceTracker
var l []*tracker.Resource
for _, v := range clusterResources {
l = append(l, v)
}
Expand Down
1 change: 1 addition & 0 deletions hack/.packages
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ k8s.io/kops/pkg/pretty
k8s.io/kops/pkg/resources
k8s.io/kops/pkg/resources/digitalocean
k8s.io/kops/pkg/resources/digitalocean/dns
k8s.io/kops/pkg/resources/tracker
k8s.io/kops/pkg/systemd
k8s.io/kops/pkg/templates
k8s.io/kops/pkg/testutils
Expand Down
Loading

0 comments on commit 76ea7e9

Please sign in to comment.