Skip to content

Commit

Permalink
Add endpoints to standard app
Browse files Browse the repository at this point in the history
* App currently does not know about itself so if it has multiple
  deployments, then it has no way to discover these.
* At the end of the Make phase, we now add in the app endpoints
  for the app itself.
  • Loading branch information
psav committed Mar 3, 2021
1 parent 3e53202 commit 6a13ff5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ commands:
- script: jq -r '.data["cdappconfig.json"]' < /tmp/test-multiple-app-endpoints-b | base64 -d > /tmp/test-multiple-app-endpoints-json-b

# Positive searches
- script: jq -r '.endpoints[] | select(.app == "puptoo") | .name == "processor"' -e < /tmp/test-multiple-app-endpoints-json
- script: jq -r '.endpoints[] | select(.app == "puptoo-2") | .name == "processor-2"' -e < /tmp/test-multiple-app-endpoints-json

# Negative searches
- script: jq -r '.endpoints | length == 1' -e < /tmp/test-multiple-app-endpoints-json
- script: jq -r '.endpoints | length == 2' -e < /tmp/test-multiple-app-endpoints-json

# Positive searches
- script: jq -r '.endpoints[] | select(.app == "puptoo-b") | .name == "processor-b"' -e < /tmp/test-multiple-app-endpoints-json-b
- script: jq -r '.endpoints[] | select(.app == "puptoo-b-2") | .name == "processor-b-2"' -e < /tmp/test-multiple-app-endpoints-json-b

# Negative searches
- script: jq -r '.endpoints | length == 1' -e < /tmp/test-multiple-app-endpoints-json-b
- script: jq -r '.endpoints | length == 2' -e < /tmp/test-multiple-app-endpoints-json-b
15 changes: 9 additions & 6 deletions controllers/cloud.redhat.com/makers/maker.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

//DependencyMaker makes the DependencyConfig object
type DependencyMaker struct {
*Maker
config []config.DependencyEndpoint
}

//Maker struct for passing variables into SubMakers
type Maker struct {
App *crd.ClowdApp
Expand Down Expand Up @@ -679,6 +673,15 @@ func makeDepConfig(
missingDeps = processAppEndpoints(appMap, app.Spec.Dependencies, &depConfig, &privDepConfig, webPort, privatePort)
_ = processAppEndpoints(appMap, app.Spec.OptionalDependencies, &depConfig, &privDepConfig, webPort, privatePort)

processAppEndpoints(
map[string]crd.ClowdApp{app.Name: *app},
[]string{app.Name},
&(depConfig),
&(privDepConfig),
webPort,
privatePort,
)

return depConfig, privDepConfig, missingDeps
}

Expand Down

0 comments on commit 6a13ff5

Please sign in to comment.