-
Notifications
You must be signed in to change notification settings - Fork 86
[WIP] migrate WIT to use proxy for all deployments API requests #2284
base: master
Are you sure you want to change the base?
Conversation
This patch renames some more types that were missed in PR fabric8-services#1868
The /apps API has been replaced by the JSON-API conformant version /deployments. Fixes fabric8-services#1889
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.
Hi Simon, this is looking good and it's nice to be able to simplify things. Just a couple comments below.
|
||
// GetEnvironmentMapping returns a map whose keys are environment names, and values are the Kubernetes namespaces | ||
// that represent those environments | ||
func (up *tenantURLProvider) GetEnvironmentMapping() map[string]string { |
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 will still need this method to translate environment names to Kubernetes namespaces using the information in Tenant.
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.
Unfortunately, I was hoping to get rid of Tenant in our code, but it seems it's not possible.
I think this API as is is unusable because of the issues @ebaron pointed out, so I propose withdrawing it. The current code will work via the proxy if so configured; this was mainly a cleanup PR. A proper refactoring would leave most of this PR as I have it here (i.e. simplify the URLProvider code), but also add a TenantClient that provides the mapping we reuire from the Tenant service.
var internalNamespaceTypes = map[string]struct{}{"user": {}, "che": {}, "jenkins": {}} | ||
|
||
// CanDeploy returns true if the environment type provided can be deployed to as part of a pipeline | ||
func (up *tenantURLProvider) CanDeploy(envType string) bool { |
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 this one too, to filter out environments we want to hide like che and jenkins.
Codecov Report
@@ Coverage Diff @@
## master #2284 +/- ##
==========================================
+ Coverage 70.13% 72.35% +2.21%
==========================================
Files 174 177 +3
Lines 16784 18529 +1745
==========================================
+ Hits 11771 13406 +1635
- Misses 3880 3945 +65
- Partials 1133 1178 +45
Continue to review full report at Codecov.
|
This change removes the "cleverness" in the deployments code (URL provider) to implement multicloster support. Instead, all k8s requests are routed through the OSIO proxy service.
Addresses OSIO issue openshiftio/openshift.io#2096
Once this change is implemented, the deployments API will always need to use the proxy - currently it is optional.