Skip to content

Commit

Permalink
topology CM lookup, inject into console-plugin deployment (#920)
Browse files Browse the repository at this point in the history
* topology CM lookup, inject into console-plugin deployment

Signed-off-by: Jason Madigan <[email protected]>

* console-plugin: reuse topology configmap name and namespace (#929)

Signed-off-by: Eguzki Astiz Lezaun <[email protected]>

---------

Signed-off-by: Jason Madigan <[email protected]>
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
Co-authored-by: Eguzki Astiz Lezaun <[email protected]>
  • Loading branch information
jasonmadigan and eguzki authored Oct 10, 2024
1 parent 565274d commit df87130
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/consoleplugin_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (r *ConsolePluginReconciler) Run(eventCtx context.Context, _ []controller.R
}

// Deployment
deployment := consoleplugin.Deployment(r.namespace, ConsolePluginImageURL)
deployment := consoleplugin.Deployment(r.namespace, ConsolePluginImageURL, TopologyConfigMapName)
deploymentMutators := make([]reconcilers.DeploymentMutateFn, 0)
deploymentMutators = append(deploymentMutators, reconcilers.DeploymentImageMutator)
if !topologyExists {
Expand Down
6 changes: 5 additions & 1 deletion pkg/openshift/consoleplugin/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func DeploymentLabels(namespace string) map[string]string {
return result
}

func Deployment(ns, image string) *appsv1.Deployment {
func Deployment(ns, image, topologyName string) *appsv1.Deployment {
return &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{Kind: "Deployment", APIVersion: "apps/v1"},
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -108,6 +108,10 @@ func Deployment(ns, image string) *appsv1.Deployment {
},
ImagePullPolicy: corev1.PullAlways,
VolumeMounts: DeploymentVolumeMounts(),
Env: []corev1.EnvVar{
{Name: "TOPOLOGY_CONFIGMAP_NAME", Value: topologyName},
{Name: "TOPOLOGY_CONFIGMAP_NAMESPACE", Value: ns},
},
},
},
Volumes: DeploymentVolumes(),
Expand Down
3 changes: 3 additions & 0 deletions pkg/openshift/consoleplugin/nginx_configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ http {
location / {
root /usr/share/nginx/html;
}
location /config.js {
root /tmp;
}
}
}
`,
Expand Down

0 comments on commit df87130

Please sign in to comment.