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

Commit

Permalink
Merge pull request #62 from aidenkeating/INTLY-2346
Browse files Browse the repository at this point in the history
INTLY-2346 add openshift 4 support
  • Loading branch information
aidenkeating authored Aug 22, 2019
2 parents f3afb3e + c399299 commit 4d2af3d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions deploy/template/tutorial-web-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
12 changes: 10 additions & 2 deletions pkg/handlers/webhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package version

var (
Version = "0.0.26"
Version = "0.0.27"
)

0 comments on commit 4d2af3d

Please sign in to comment.