-
Notifications
You must be signed in to change notification settings - Fork 15
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
deis doctor includes lots of k8s data #81
Conversation
ebbc6ba
to
2c73dff
Compare
e27ace9
to
c838ebe
Compare
moving out of the 2.2 milestone |
c838ebe
to
34399f0
Compare
Current coverage is 31.19% (diff: 38.15%)@@ master #81 diff @@
==========================================
Files 9 8 -1
Lines 343 359 +16
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 89 112 +23
+ Misses 235 220 -15
- Partials 19 27 +8
|
bb4d580
to
8bfad59
Compare
@@ -31,7 +32,7 @@ func GetCluster( | |||
} | |||
err = AddUpdateData(&cluster, v, secretGetterCreator) | |||
if err != nil { | |||
return models.Cluster{}, err | |||
log.Println("unable to decorate cluster data with available updates data") |
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.
When we're unable to add definitive "available component update" data we'll log the event, but we don't want to short-circuit the entire version data-gathering process.
8bfad59
to
8045f8c
Compare
@@ -0,0 +1 @@ | |||
package data |
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.
TODO: delete this placeholder file (or actually add tests).
8045f8c
to
f2bb03a
Compare
} | ||
] | ||
}]`)) | ||
_ = json.Unmarshal(data, &componentVersions) |
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.
you should either return this error or just construct the []models.ComponentVersion
directly (instead of going through the json decoder) and return it
@@ -20,7 +20,10 @@ type testAvailableVersions struct{} | |||
func (a testAvailableVersions) Refresh(cluster models.Cluster) ([]models.ComponentVersion, error) { | |||
data := getMockComponentVersions() | |||
var componentVersions []models.ComponentVersion | |||
_ = json.Unmarshal(data, &componentVersions) | |||
err := json.Unmarshal(data, &componentVersions) | |||
if err != nil { |
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.
combine these lines. if err := json.Unmarshal(...); err != nil { ...
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 with the below combinations
err = AddUpdateData(&cluster, v) | ||
if err != nil { | ||
log.Printf("unable to decorate cluster data with available updates data: %#v\n", err) | ||
if err = AddUpdateData(&cluster, v); err != nil { |
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.
if err := AddUpdateData...
. note the :
in the if
I tested this by putting it into the workflow-dev chart. Resulted in a huge JSON blob full of the above information--good stuff! |
closes #79 |
This PR delivers the following feature additions:
data
property. This makes for a predictably heavy-weight data payload, and in the future it may make sense to include some filtering. That, and any additional explicit properties data modeling is TODO.Included in the implementation to support these features are the following under-the-hood items worth emphasizing:
k8s
sub-package was created to accommodate all new business logic responsible for gathering and preparing kubernetes cluster data; pre-existing kubernetes-specific implementations that were formerly in thedata
package were moved tok8s
, as appropriate (e.g., thedata.getRCItems()
helper function becomes the exportablek8s.GetReplicationControllers()
.kubeapp
dependency was updated, and in factjackfan.us.kg/deis
absorbed what was formerly @arschles's personal creation.glide.yaml
andglide.lock
updated to reflect updatedkubeapp
dependenciesk8s.ResourceInterface
is meant, with the help of its constructor, to conveniently provide a re-usable kubernetes-namespace-specific, per-resource data retrieval singleton.