Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
make integreatly version available to webapp
  • Loading branch information
pb82 committed May 20, 2019
1 parent 66e92eb commit cdd017a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions deploy/template/tutorial-web-app.yml
Expand Up @@ -68,6 +68,8 @@ objects:
value: ${SSO_ROUTE}
- name: WALKTHROUGH_LOCATIONS
value: ${WALKTHROUGH_LOCATIONS}
- name: INTEGREATLY_VERSION
value: ${INTEGREATLY_VERSION}
image: quay.io/integreatly/tutorial-web-app:2.10.3
imagePullPolicy: Always
name: tutorial-web-app
Expand Down
12 changes: 8 additions & 4 deletions pkg/handlers/webhandler.go
Expand Up @@ -20,12 +20,14 @@ import (
)

const (
WebappVersion = "master"
WTLocations = "WALKTHROUGH_LOCATIONS"
WTLocationsDefault = "https://github.com/integr8ly/tutorial-web-app-walkthroughs#v1.6.4"
WebappVersion = "master"
WTLocations = "WALKTHROUGH_LOCATIONS"
IntegreatlyVersion = "INTEGREATLY_VERSION"
WTLocationsDefault = "https://github.com/integr8ly/tutorial-web-app-walkthroughs#v1.6.4"
IntegreatlyVersionDefault = "not set"
)

var webappParams = [...]string{"OPENSHIFT_OAUTHCLIENT_ID", "OPENSHIFT_HOST", "SSO_ROUTE", WTLocations}
var webappParams = [...]string{"OPENSHIFT_OAUTHCLIENT_ID", "OPENSHIFT_HOST", "SSO_ROUTE", IntegreatlyVersion, WTLocations}

func NewWebHandler(m *metrics.Metrics, osClient openshift.OSClientInterface, factory ClientFactory, cruder SdkCruder) AppHandler {
return AppHandler{
Expand Down Expand Up @@ -105,6 +107,8 @@ func (h *AppHandler) reconcile(cr *v1alpha1.WebApp) error {
// if WALKTHROUGH_LOCATIONS is not defined then use the default value
if param == WTLocations {
updated, dc.Spec.Template.Spec.Containers[0] = updateOrCreateEnvVar(dc.Spec.Template.Spec.Containers[0], param, WTLocationsDefault)
} else if param == IntegreatlyVersion {
updated, dc.Spec.Template.Spec.Containers[0] = updateOrCreateEnvVar(dc.Spec.Template.Spec.Containers[0], param, IntegreatlyVersionDefault)
} else {
//key does not exist in CR, ensure it is not present in the DC
updated, dc.Spec.Template.Spec.Containers[0] = deleteEnvVar(dc.Spec.Template.Spec.Containers[0], param)
Expand Down

0 comments on commit cdd017a

Please sign in to comment.