-
Notifications
You must be signed in to change notification settings - Fork 150
Add URL for downloading CLI to the console-config configmap #301
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
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jhadvig The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
We'll need a way to specify different URLs for different platforms |
|
@spadgett the downloads pod contains binary for linux,osx, widnows... was in impression that it is the route to the pod that we want to wire to the console. |
|
Or we want a direct link for each platform in the console's "Command Line Tools" page ? |
Yes, IMO this is a much better experience than dumping the user in a directory listing. |
|
@spadgett also, for each platform there are is a: |
|
Hm, maybe linux .tar.gz and mac and windows use .zip ? |
|
@spadgett @benjaminapetersen I've update the PR PTAL |
|
/retest |
| managedConfig *corev1.ConfigMap, | ||
| infrastructureConfig *configv1.Infrastructure, | ||
| rt *routev1.Route) (consoleConfigmap *corev1.ConfigMap, unsupportedOverridesHaveMerged bool, err error) { | ||
| rt *routev1.Route, |
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.
Can probably update to
consoleRoute *routev1.Route,
downloadsRoute *routev1.Route) (consoleConfigmap *corev1.ConfigMap, unsupportedOverridesHaveMerged bool, err error) {Mean name both routes now that there are two.
|
|
||
| const ( | ||
| host = "localhost" | ||
| downloadHost = "https://downloads-openshift-console.apps.some.cluster.openshift.com" |
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.
To be honest, for the test I'd rather inline these. Its a tad repetitious, but I think it makes a better test if the input and output are specific to each test and the output (ie, the want) is hard-coded in the specific test.
Also, it's nice to know that if one test breaks, you can be certain that fixing it won't accidentally break other tests.
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 may be good to add one test w/o the downloads route (nil) and make sure the config is still properly generated:
{
name: "Test default configmap, no customization overrides",
// downloadsRoute: &routev1.Route{ ... }
}, {
name: "Test default configmap, without downloads",
// downloadsRoute: 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.
It may be good to add one test w/o the downloads route (nil) and make sure the config is still properly generated:
All other TCs have the download route set :)
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.
Also the we have the host const here
| } | ||
|
|
||
| // CLIDownloadURLs contains download URLs for each of the platforms we provide CLI binary. | ||
| type CLIDownloadURLs struct { |
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.
Maybe simplify this a bit:
type CLIDownloadURLs struct {
Linux string `yaml:"linuxDownloadURL"`
Mac string `yaml:"macDownloadURL"`
Windows string `yaml:"windowsDownloadURL"`Since its already a heading CLIDownloadURLs we don't need to repeat the DownloadURL part in the field names.
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.
To be honest, we may want to do CLIDownloadURLs[arch][platform] just like the downloads deployment. Only amd64 now.
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.
@benjaminapetersen how about?
type ClusterInfo struct {
ConsoleBaseAddress string `yaml:"consoleBaseAddress,omitempty"`
ConsoleBasePath string `yaml:"consoleBasePath,omitempty"`
MasterPublicURL string `yaml:"masterPublicURL,omitempty"`
CLIDownloadURLs *CLIDownloadURLs `yaml:"cliDownloadURLs,omitempty"`
}
// CLIDownloadURLs contains all the architertures that we are building CLI binaries for.
type CLIDownloadURLs struct {
Amd64 ArchPlatformsURL `yaml:"amd64,omitempty"`
}
// ArchPlatformsURL contains URLs for each of the platforms we provide CLI binary.
type ArchPlatformsURL struct {
Linux string `yaml:"linux"`
Mac string `yaml:"mac"`
Windows string `yaml:"windows"`
}Although Im not really sure about the CLIDownloadURLs, but its pretty generic and with the aditional architecture specified it kinda dioes make sense?
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.
Yup! Though I wonder if ArchPlatformsURL vs ArchPlatformURLs. As "one platform has many urls", and if you had many archs, you would []ArchPlatformURLs, which have many URLs but are named.
type CLIDownloadURLs struct {
Amd64 ArchPlatformURLs `yaml:"amd64,omitempty"`
Foo32 ArchPlatformURLs `yaml:"Foo32,omitempty"`
Bar64 ArchPlatformURLs `yaml:"Bar64,omitempty"`
}Since we expect 3+ URLs for archs added.
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.
But if we tan to chain it like you mentioned in your previous comment it cant be an array.
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.
+1 on ArchPlatformURLs
pkg/console/subresource/util/util.go
Outdated
| secured := fmt.Sprintf("%s%s", protocol, host) | ||
| return secured | ||
| } | ||
|
|
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 you can keep this func in the configmap_builder.go file. It isn't shared elsewhere.
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.
Also, should we give it a unit test?
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.
will add !
pkg/api/api.go
Outdated
| @@ -1,5 +1,12 @@ | |||
| package api | |||
|
|
|||
| const ( | |||
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'm inclined to move these into the configmap_builder.go file, since they are only used in one place.
pkg/console/operator/sync_v400.go
Outdated
| return nil, false, "FailedGetDownloadsRoute", err | ||
| } | ||
|
|
||
| defaultConfigmap, _, err := configmapsub.DefaultConfigMap(operatorConfig, consoleConfig, managedConfig, infrastructureConfig, rt, downloadsRoute) |
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.
want to update the var name to consoleRoute, downloadsRoute?
| }, | ||
| }, | ||
| { | ||
| name: "Test openshift-console namespace without downloads route", |
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.
+1 for a test without the downloads route.
Test openshift-console namespace without downloads route - namespace? I'm a bit confused by the test name, however.
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.
Wasnt really sure how to name the test, other then this since the setup is nil download route. But really should be something like : Test getting URLs for downloading CLI, without downloads route. ... maybe ?
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.
The expectation is that there would be no downloads then, if there is no route, correct? I'm good with long tests names that clearly indicate everything, including expected output.
Perhaps Validate that there is no download CLI links when download route is nil``?
Out test naming convention isn't super strong, so if we have to break it for clarity, thats fine. We could always go back and improve the names of the other tests if you have something that works better.
| }, | ||
| }, | ||
| { | ||
| name: "Test operator config with Statuspage pageID", |
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 believe we already had this test, trying to figure out why its showing up as new.
| } | ||
| func (b *ConsoleServerCLIConfigBuilder) CLIDownloadURL(cliDownloadURL string) *ConsoleServerCLIConfigBuilder { | ||
| if cliDownloadURL != "" { | ||
| b.cliDownloadURLs = &CLIDownloadURLs{ |
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.
See my other comment about dropping the DownloadURL redundancy. I think we can clean this up just a bit.
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.
makes sense !
benjaminapetersen
left a comment
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.
Couple minor things, thx!
|
@benjaminapetersen comments addressed. PTAL |
|
/retest |
|
@benjaminapetersen so was looking into the console side of this story and figured out that it might be better to create ConsoleCLIDownload CR that will represent the per architecture binaries for all the different platforms. Eg. I've created following CR : which will produce the third section in the below screenshot: With this I was thinking that instead of adding logic to operator and console, let the operator create the CR for each arch type, that will contain the binaries for all the platforms. cc'ing @spadgett for opinion |
|
Ha, I like this. leverages what we already built, no point in all the additional wiring. |
|
|
||
| func getCliDownloadUrl(downloadsRoute *routev1.Route) string { | ||
| if downloadsRoute != nil { | ||
| return downloadsRoute.Spec.Host |
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.
route.Spec.Host will actually be removed, we have a GetCanonicalHost() func that could be used instead.
|
If we're going to do this for Only potential downside I see is we can't give special handling to the different platforms (e.g., highlight the macos link if we detect you are on a mac). |
|
Something like this could be worth discussing: apiVersion: console.openshift.io/v1
kind: ConsoleCLIDownload
metadata:
name: example-oc
spec:
displayName: example-oc
description: >
This is a link with platforms
links:
- href: 'https://www.example.com'
name: oc for linux
platform: linux
- href: 'https://www.example.com'
name: oc for mac
platform: mac
- href: 'https://www.example.com'
name: oc for windows
platform: windows |
|
/hold As we investigate this other direction. |
|
Closing in favour of #306 |


PR for adding the URL for downloading CLI to the
console-configconfigmap, inclusterInfo.cliDownloadURLfield.Story: https://jira.coreos.com/browse/CONSOLE-1423
/assign @benjaminapetersen