diff --git a/Makefile b/Makefile index b3d77ee..af723f4 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SHELL=/bin/bash REG=quay.io ORG=integreatly IMAGE=tutorial-web-app-operator -TAG=0.0.26 +TAG=0.0.27 KUBE_CMD=oc apply -f DEPLOY_DIR=deploy OUT_STATIC_DIR=tmp/_output diff --git a/deploy/operator.yaml b/deploy/operator.yaml index 73ed789..848bd64 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: tutorial-web-app-operator containers: - name: tutorial-web-app-operator - image: quay.io/integreatly/tutorial-web-app-operator:v0.0.26 + image: quay.io/integreatly/tutorial-web-app-operator:v0.0.27 ports: - containerPort: 60000 name: metrics diff --git a/deploy/template/tutorial-web-app.yml b/deploy/template/tutorial-web-app.yml index 39c41a0..b8e3ffc 100644 --- a/deploy/template/tutorial-web-app.yml +++ b/deploy/template/tutorial-web-app.yml @@ -3,6 +3,16 @@ kind: Template metadata: name: tutorial-web-app parameters: + - name: OPENSHIFT_VERSION + description: The version of OpenShift that it will run in + displayName: OpenShift Version + value: '3' + required: true + - name: OPENSHIFT_API + description: The OpenShift clusters API URL (Required in OpenShift 4) + displayName: OpenShift API Host + value: openshift.default.svc + required: false - name: OPENSHIFT_OAUTHCLIENT_ID description: The OAuthClient id in OpenShift to use for auth displayName: OAuthClient ID @@ -33,7 +43,7 @@ parameters: required: false - name: WALKTHROUGH_LOCATIONS description: A comma separated list of git repositories or paths to walkthrough directories - value: https://github.com/integr8ly/tutorial-web-app-walkthroughs.git#v1.6.5 + value: https://github.com/integr8ly/tutorial-web-app-walkthroughs.git#v1.7.2 required: true - name: DATABASE_LOCATION description: The location of the user walkthroughs database in the filesystem @@ -76,6 +86,10 @@ objects: value: ${OPENSHIFT_OAUTHCLIENT_ID} - name: OPENSHIFT_HOST value: ${OPENSHIFT_HOST} + - name: OPENSHIFT_VERSION + value: ${OPENSHIFT_VERSION} + - name: OPENSHIFT_API + value: ${OPENSHIFT_API} - name: OPENSHIFT_OAUTH_HOST value: ${OPENSHIFT_OAUTH_HOST} - name: NODE_ENV @@ -90,7 +104,7 @@ objects: value: ${CLUSTER_TYPE} - name: DATABASE_LOCATION value: ${DATABASE_LOCATION} - image: quay.io/integreatly/tutorial-web-app:2.16.0 + image: quay.io/integreatly/tutorial-web-app:2.18.0 imagePullPolicy: Always name: tutorial-web-app ports: diff --git a/pkg/handlers/webhandler.go b/pkg/handlers/webhandler.go index 3411671..a45490b 100644 --- a/pkg/handlers/webhandler.go +++ b/pkg/handlers/webhandler.go @@ -24,12 +24,16 @@ const ( WTLocations = "WALKTHROUGH_LOCATIONS" IntegreatlyVersion = "INTEGREATLY_VERSION" ClusterType = "CLUSTER_TYPE" - WTLocationsDefault = "https://github.com/integr8ly/tutorial-web-app-walkthroughs#v1.6.5" + OpenShiftVersion = "OPENSHIFT_VERSION" + OpenShiftAPIHost = "OPENSHIFT_API" + WTLocationsDefault = "https://github.com/integr8ly/tutorial-web-app-walkthroughs#v1.7.2" IntegreatlyVersionDefault = "not set" ClusterTypeDefault = "not set" + OpenShiftVersionDefault = "3" + OpenShiftAPIHostDefault = "openshift.default.svc" ) -var webappParams = [...]string{"OPENSHIFT_OAUTHCLIENT_ID", "OPENSHIFT_HOST", "OPENSHIFT_OAUTH_HOST", "SSO_ROUTE", IntegreatlyVersion, WTLocations, ClusterType} +var webappParams = [...]string{"OPENSHIFT_OAUTHCLIENT_ID", "OPENSHIFT_HOST", "OPENSHIFT_OAUTH_HOST", "SSO_ROUTE", OpenShiftAPIHost, OpenShiftVersion, IntegreatlyVersion, WTLocations, ClusterType} func NewWebHandler(m *metrics.Metrics, osClient openshift.OSClientInterface, factory ClientFactory, cruder SdkCruder) AppHandler { return AppHandler{ @@ -113,6 +117,10 @@ func (h *AppHandler) reconcile(cr *v1alpha1.WebApp) error { updated, dc.Spec.Template.Spec.Containers[0] = updateOrCreateEnvVar(dc.Spec.Template.Spec.Containers[0], param, IntegreatlyVersionDefault) } else if param == ClusterType { updated, dc.Spec.Template.Spec.Containers[0] = updateOrCreateEnvVar(dc.Spec.Template.Spec.Containers[0], param, ClusterTypeDefault) + } else if param == OpenShiftVersion { + updated, dc.Spec.Template.Spec.Containers[0] = updateOrCreateEnvVar(dc.Spec.Template.Spec.Containers[0], param, OpenShiftVersionDefault) + } else if param == OpenShiftAPIHost { + updated, dc.Spec.Template.Spec.Containers[0] = updateOrCreateEnvVar(dc.Spec.Template.Spec.Containers[0], param, OpenShiftAPIHostDefault) } 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) diff --git a/version/version.go b/version/version.go index 332f1cb..ec42aec 100644 --- a/version/version.go +++ b/version/version.go @@ -1,5 +1,5 @@ package version var ( - Version = "0.0.26" + Version = "0.0.27" )