Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<username>-che as default namespace #156

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# NOTE: using registry.redhat.io/rhel8/go-toolset requires login, which complicates automation
# NOTE: since updateBaseImages.sh does not support other registries than RHCC, update to RHEL8
# https://access.redhat.com/containers/?tab=tags#/registry.access.redhat.com/devtools/go-toolset-rhel7
FROM registry.access.redhat.com/devtools/go-toolset-rhel7:1.12.12-3 as builder
FROM registry.access.redhat.com/devtools/go-toolset-rhel7:1.12.12-3 as builder
ENV PATH=/opt/rh/go-toolset-1.12/root/usr/bin:$PATH \
GOPATH=/go/

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Or you can build in a container:
docker run -ti -v /tmp:/tmp -v ${OPERATOR_REPO}:/opt/app-root/src/go/src/github.com/eclipse/che-operator registry.redhat.io/devtools/go-toolset-rhel7:1.11.5-3 sh -c "OOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /tmp/run-tests /opt/app-root/src/go/src/github.com/eclipse/che-operator/e2e/*.go"
cp /tmp/run-tests ${OPERATOR_REPO}/run-tests
```
> Notice: if you don't have redhat subscription, use public image registry.access.redhat.com/devtools/go-toolset-rhel7:latest
Copy link
Contributor

@mmorhun mmorhun Feb 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is not right that we have links to private images in Che project.
But this is out of scope of this PR.


### How to run tests

Expand Down
11 changes: 10 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ BASE_DIR=$(cd "$(dirname "$0")"; pwd)
oc apply -f ${BASE_DIR}/deploy/service_account.yaml
oc apply -f ${BASE_DIR}/deploy/role.yaml
oc apply -f ${BASE_DIR}/deploy/role_binding.yaml

oc apply -f ${BASE_DIR}/deploy/cluster_role.yaml
oc apply -f ${BASE_DIR}/deploy/cluster_role_che.yaml
oc apply -f ${BASE_DIR}/deploy/cluster_role_createns.yaml

oc apply -f ${BASE_DIR}/deploy/cluster_role_binding.yaml
oc apply -f ${BASE_DIR}/deploy/cluster_role_binding_che.yaml
oc apply -f ${BASE_DIR}/deploy/cluster_role_binding_createns.yaml

oc apply -f ${BASE_DIR}/deploy/crds/org_v1_che_crd.yaml
# sometimes the operator cannot get CRD right away
sleep 2
Expand All @@ -25,4 +34,4 @@ sleep 2
#oc apply -f ${BASE_DIR}/deploy/cluster_role.yaml -n=$1

oc apply -f ${BASE_DIR}/deploy/operator.yaml
oc apply -f ${BASE_DIR}/deploy/crds/org_v1_che_cr.yaml
oc apply -f ${BASE_DIR}/deploy/crds/org_v1_che_cr.yaml
39 changes: 39 additions & 0 deletions deploy/cluster_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,42 @@ rules:
- update
- patch
- delete
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterrolebindings
verbs:
- list
- watch
- create
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
verbs:
- create
- list
- watch
- apiGroups:
- authorization.openshift.io
- rbac.authorization.k8s.io
resources:
- roles
verbs:
- get
- create
- apiGroups:
- authorization.openshift.io
- rbac.authorization.k8s.io
resources:
- rolebindings
verbs:
- get
- update
- create
- apiGroups:
- org.eclipse.che
resources:
- checlusters/finalizers
verbs:
- '*'
2 changes: 1 addition & 1 deletion deploy/cluster_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ subjects:
roleRef:
kind: ClusterRole
name: che-operator
apiGroup: rbac.authorization.k8s.io
apiGroup: rbac.authorization.k8s.io
22 changes: 22 additions & 0 deletions deploy/cluster_role_binding_che.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: che-operator-che
subjects:
- kind: ServiceAccount
name: che-operator
namespace: che
roleRef:
kind: ClusterRole
name: che-manage-namespaces
apiGroup: rbac.authorization.k8s.io
22 changes: 22 additions & 0 deletions deploy/cluster_role_binding_createns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: che-operator-create-namespaces
subjects:
- kind: ServiceAccount
name: che-operator
namespace: che
roleRef:
kind: ClusterRole
name: che-create-namespaces
apiGroup: rbac.authorization.k8s.io
159 changes: 159 additions & 0 deletions deploy/cluster_role_che.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: che-manage-namespaces
labels:
app: che
component: che
rules:
- verbs:
- get
- create
apiGroups:
- authorization.openshift.io
- rbac.authorization.k8s.io
resources:
- roles
- verbs:
- get
- update
- create
apiGroups:
- authorization.openshift.io
- rbac.authorization.k8s.io
resources:
- rolebindings
- verbs:
- get
apiGroups:
- project.openshift.io
resources:
- projects
- verbs:
- get
- create
- watch
apiGroups:
- ''
resources:
- serviceaccounts
- verbs:
- create
apiGroups:
- ''
resources:
- pods/exec
- verbs:
- list
apiGroups:
- ''
resources:
- persistentvolumeclaims
- configmaps
- verbs:
- list
apiGroups:
- apps
resources:
- secrets
- verbs:
- list
- create
- delete
apiGroups:
- ''
resources:
- secrets
- verbs:
- create
- get
- watch
apiGroups:
- ''
resources:
- persistentvolumeclaims
- verbs:
- get
- list
- create
- watch
- delete
apiGroups:
- ''
resources:
- pods
- verbs:
- get
- list
- create
- patch
- watch
- delete
apiGroups:
- apps
resources:
- deployments
- verbs:
- list
- create
- delete
apiGroups:
- ''
resources:
- services
- verbs:
- create
- delete
apiGroups:
- ''
resources:
- configmaps
- verbs:
- list
- create
- delete
apiGroups:
- route.openshift.io
resources:
- routes
- verbs:
- watch
apiGroups:
- ''
resources:
- events
- verbs:
- list
- get
- patch
- delete
apiGroups:
- apps
resources:
- replicasets
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- list
- create
- watch
- get
- delete
- apiGroups:
- ''
resources:
- namespaces
verbs:
- get
32 changes: 32 additions & 0 deletions deploy/cluster_role_createns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Copyright (c) 2012-2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: che-create-namespaces
labels:
app: che
component: che
rules:
- verbs:
- create
- update
apiGroups:
- project.openshift.io
resources:
- projectrequests
- apiGroups:
- ""
resources:
- namespaces
verbs:
- create
- update
4 changes: 3 additions & 1 deletion deploy/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ rules:
- apiGroups:
- org.eclipse.che
resources:
- '*'
- checlusters
- checlusters/status
- checlusters/finalizers
verbs:
- '*'
41 changes: 41 additions & 0 deletions deploy_k8s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
#
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
set -e
set -x

if [ -z "${1}" ]; then
echo "missing namespace parameter './deploy_k8s.sh <che-namespace>'"
exit 1
fi
NAMESPACE=${1}

BASE_DIR=$(cd "$(dirname "$0")"; pwd)

kubectl apply -f "${BASE_DIR}"/deploy/service_account.yaml -n="${NAMESPACE}"
kubectl apply -f "${BASE_DIR}"/deploy/role.yaml -n="${NAMESPACE}"
kubectl apply -f "${BASE_DIR}"/deploy/role_binding.yaml -n="${NAMESPACE}"

kubectl apply -f "${BASE_DIR}"/deploy/cluster_role.yaml
kubectl apply -f "${BASE_DIR}"/deploy/cluster_role_che.yaml
kubectl apply -f "${BASE_DIR}"/deploy/cluster_role_createns.yaml

kubectl apply -f "${BASE_DIR}"/deploy/cluster_role_binding.yaml -n="${NAMESPACE}"
kubectl apply -f "${BASE_DIR}"/deploy/cluster_role_binding_che.yaml -n="${NAMESPACE}"
kubectl apply -f "${BASE_DIR}"/deploy/cluster_role_binding_createns.yaml -n="${NAMESPACE}"

kubectl apply -f "${BASE_DIR}"/deploy/crds/org_v1_che_crd.yaml -n="${NAMESPACE}"

# sometimes the operator cannot get CRD right away
sleep 2

kubectl apply -f "${BASE_DIR}"/deploy/operator.yaml -n="${NAMESPACE}"
kubectl apply -f "${BASE_DIR}"/deploy/crds/org_v1_che_cr.yaml -n="${NAMESPACE}"
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
role-paths: [ "generated/roles/role.yaml" ]
role-paths:
- "generated/roles/role.yaml"
- "../../deploy/cluster_role.yaml"
- "../../deploy/cluster_role_che.yaml"
- "../../deploy/cluster_role_createns.yaml"
operator-path: ../../deploy/operator.yaml
crd-cr-paths: ["../../deploy/crds/org_v1_che_crd.yaml"]
Loading