-
Notifications
You must be signed in to change notification settings - Fork 710
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
Add support for viewing and migrate Tiller releases #330
Conversation
Delete | ||
</button> | ||
</div> | ||
{this.props.loading === true ? ( |
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.
this is needed to wait until the Tiller release is deleted, if not, after clicking "Delete" it goes directly to the Applications view and the deleted application is still there.
dccdfbe
to
4d5784a
Compare
dashboard/src/shared/App.ts
Outdated
|
||
export class App { | ||
public static async waitForDeletion(name: string) { | ||
const timeout = 10000; // 10s |
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.
10s timeout is too short. Can we make is 30s or higher?
<button className="button button-danger" onClick={this.openModel}> | ||
Delete | ||
<button className="button" onClick={this.handleMigrateClick}> | ||
Migrate |
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.
should we call this button Import App
?
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.
I set this back to Migrate
since there is now a banner that explains it in detail
I encountered a major issue while testing this PR. I deployed the todos chart from /~https://github.com/bitnami-labs/redisdemo using the helm cli and attempted to migrate it to kubeapps. During the migration I selected |
Right, I can do a validation to ensure that the chart and version are present in the repository chosen. There is still a chance that for example |
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.
Great work on this @andresmgot.
Some thoughts about the UX. A button that just says "Import App"/"Migrate" isn't clear enough. I suggest adding a banner above the button to explain that the app is "unmanaged" and that importing it will allow you to manage (update/delete) it from Kubeapps.
I also suggest adding something to the cards in the AppList screen to indicate that the App is not fully imported. Perhaps an warning triangle icon or something could be useful here.
const roles = RequiredRBACRoles; | ||
roles[0].verbs = ["create"]; | ||
switch (error && error.constructor) { | ||
case MissingChart: |
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.
could we take people back to the migration form to fix this error?
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.
that's the current behavior, if the chart exists the migration form print this error.
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.
Ah okay, missed that - thanks!
/> | ||
</div> | ||
<div> | ||
<label htmlFor="tillerReleaseName">Release Name (Global)</label> |
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.
I think this will be confusing to users. IMO it would be better to take this opportunity to simplify the naming relationship between HelmRelease CRD and Tiller release name and just assume that both should be globally unique.
We could:
- Verify that no Tiller release name exists by checking the configmaps in the kubeapps namespace
- Make HelmRelease CRD un-namespaced so that it follows the same global name requirement as Tiller
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.
Yeah, I agree it could be confusing. I would do 1. (or any other method that checks if a release already exists) more than 2. since this is something more specific to kubeapps.
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.
Yeah, I think you're right, it doesn't make sense to impose the restriction onto Helm CRD itself.
<p> | ||
{" "} | ||
* If the repository containing this chart is not in the list add it{" "} | ||
<a href="/config/repos"> here </a>{" "} |
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.
add a full stop after.
We may want to make this an actual alert, or make this nicer with CSS
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.
it's quite visible right now but let me know if you have a specific suggestion
Thank you for the review.
I can add that.
I thought about that but I think it is not necessary, a warning would mean that something is wrong with the application or something that needs to be fixed. I don't think that's the case. |
dashboard/src/shared/HelmRelease.ts
Outdated
|
||
// Go through all HelmReleaseConfigMaps and parse as IApp objects | ||
const apps = Object.keys(cms).map(key => this.parseRelease(helmReleaseMap[key], cms[key])); | ||
const apps = Object.keys(cms).map(key => this.parseRelease(cms[key], helmReleaseMap[key])); |
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.
We need to filter this list of apps by the namespace (if provided) using the namespace in the release data (app.data.namespace
). Currently we are always showing all Tiller releases despite what namespace is selected. This also has the strange side-effect that a "migrated" app or one installed from the dashboard looks like an un-migrated app (missing HelmRelease CRD) when in a different namespace.
For example, in the default namespace, Redis looks like it hasn't been migrated (icon is missing).
In the "osba" namespace, it is correct:
With this fix, "redis" and "osba" should not appear at all when in the default namespace, and likewise "default-catalog" and "modest-shrimp" should not appear in the "osba" namespace.
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.
good catch!
<div className="container container-small text-c"> | ||
<p className="margin-t-small"> | ||
This release is not being managed by Kubeapps. To be able to upgrade or delete this | ||
release <b> click in the button "Migrate" below </b>. |
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.
please use strong
instead of b
. Also, there is extra spacing on either side of the text that you should remove.
click in the button "Migrate" below -> click on the "Migrate" button below
<a href="/config/repos"> here </a>.{" "} | ||
</p> | ||
</div> | ||
<div> |
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.
I would remove everything below this point. None of this is configurable (and doesn't need to be for importing an app). Let's keep this form simple.
BTW, a future improvement for this form would be to search for the chart and version across all the repos and display the possible charts from the different repos it could belong too. We should create an issue for this when this gets merged.
Yes, you're right - we'd need to figure out a way to make it not appear like the app has an error. We can leave this for now and get advice from @Angelmmiguel later. |
dashboard/src/shared/HelmRelease.ts
Outdated
return Promise.all<IApp>(apps.map(async app => this.getChart(app))); | ||
const apps = await Promise.all<IApp>(releases.map(rel => this.getChart(rel))); | ||
|
||
if (namespace) { |
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.
let's avoid some unnecessary API calls by moving this filter above the this.getChart
fetching.
dashboard/src/shared/HelmRelease.ts
Outdated
if (namespace) { | ||
// Exclude releases that are not of this namespace | ||
const nsApps = [] as IApp[]; | ||
apps.forEach(app => { |
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.
Array.filter
will be easier (no need to instantiate a new array and push) - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
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.
One thing I noticed is that when migrating, the Tiller release gets updated two times. The controller outputs:
2018/06/05 23:54:03 Downloading repo https://kubernetes-charts.storage.googleapis.com/index.yaml index...
2018/06/05 23:54:04 Downloading https://kubernetes-charts.storage.googleapis.com/redis-3.3.5.tgz ...
2018/06/05 23:54:04 Updating release inky-orangutan
2018/06/05 23:54:04 Installed/updated release inky-orangutan
2018/06/05 23:54:04 Release status: DEPLOYED
2018/06/05 23:54:04 Downloading repo https://kubernetes-charts.storage.googleapis.com/index.yaml index...
2018/06/05 23:54:05 Downloading https://kubernetes-charts.storage.googleapis.com/redis-3.3.5.tgz ...
2018/06/05 23:54:05 Updating release inky-orangutan
2018/06/05 23:54:05 Installed/updated release inky-orangutan
2018/06/05 23:54:05 Release status: DEPLOYED
For whatever reason, it's upgrading the Tiller release twice even though the HelmRelease is only created once. Might be a small bug in the controller, I've created #345 to track this.
This lgtm, please feel free to merge.
Thanks @sameersbn and @prydonius! I replied in the issue you have opened. |
Add Tiller releases to the
Applications
view. Since for creating a HelmRelease from a Tiller release it is necessary to add new information (the chart repository URL and name) we have added a new form:MigrateForm
.