OpenShift Dev Spaces Setup
Install the dev spaces operator
cat << EOF | oc apply --filename -
# Create a dedicated namespace for dev spaces
apiVersion: v1
kind: Namespace
metadata:
name: openshift-devspaces
---
# Create an operatorgroup resource for the devspaces namespace
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: devspaces-operator-group
namespace: openshift-devspaces
---
# Create a subscription for the dev spaces operator
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: openshift-devspaces
namespace: openshift-devspaces
spec:
channel: stable
installPlanApproval: Automatic
source: redhat-operators
sourceNamespace: openshift-marketplace
name: devspaces
EOF
Create the che cluster resource
cat << EOF | oc apply --filename -
apiVersion: org.eclipse.che/v2
kind: CheCluster
metadata:
name: devspaces
namespace: openshift-devspaces
spec:
components:
cheServer:
debug: false
logLevel: INFO
dashboard:
logLevel: ERROR
devWorkspace: {}
devfileRegistry: {}
imagePuller:
enable: false
spec: {}
metrics:
enable: true
pluginRegistry: {}
containerRegistry: {}
devEnvironments:
containerBuildConfiguration:
openShiftSecurityContextConstraint: container-build
defaultNamespace:
autoProvision: true
template: <username>-devspaces
maxNumberOfWorkspacesPerUser: 5
maxNumberOfRunningWorkspacesPerUser: 2
secondsOfInactivityBeforeIdling: 1800
secondsOfRunBeforeIdling: -1
security: {}
startTimeoutSeconds: 300
storage:
pvcStrategy: per-user
gitServices: {}
networking:
auth:
gateway:
configLabels:
app: che
component: che-gateway-config
kubeRbacProxy:
logLevel: 0
oAuthProxy:
cookieExpireSeconds: 86400
traefik:
logLevel: INFO
EOF
Create a custom devfile sample
# Create the configmap with sample json config
oc create configmap getting-started-samples --from-file=samples.json -n openshift-devspaces
# Label the configmap for use by dev spaces
oc label configmap getting-started-samples app.kubernetes.io/part-of=che.eclipse.org app.kubernetes.io/component=getting-started-samples -n openshift-devspaces
cat << EOF | oc apply --filename -
apiVersion: org.eclipse.che/v2
kind: CheCluster
metadata:
name: devspaces
namespace: openshift-devspaces
spec:
components:
devfileRegistry:
disableInternalRegistry: true
EOF
cat << EOF > extensions.json
{
"recommendations": [
"redhat.ansible",
"redhat.vscode-yaml",
"redhat.vscode-redhat-account"
]
}
EOF