Skip to content

Commit

Permalink
allow webconsole to discover cluster information
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Jan 11, 2018
1 parent 40c7741 commit 98b9fa6
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 0 deletions.
38 changes: 38 additions & 0 deletions install/origin-web-console/rbac-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: web-console-server-rbac
parameters:
- name: NAMESPACE
# This namespace cannot be changed. Only `openshift-web-console` is supported.
value: openshift-web-console
objects:


# allow grant powers to the webconsole server for cluster inspection
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: system:openshift:web-console-server
rules:
- apiGroups:
- "servicecatalog.k8s.io"
resources:
- clusterservicebrokers
verbs:
- get
- list
- watch

# Grant the service account for the web console
- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: system:openshift:web-console-server
roleRef:
kind: ClusterRole
name: system:openshift:web-console-server
subjects:
- kind: ServiceAccount
namespace: ${NAMESPACE}
name: webconsole
58 changes: 58 additions & 0 deletions pkg/oc/bootstrap/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/oc/bootstrap/docker/openshift/webconsole.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

const (
consoleNamespace = "openshift-web-console"
consoleRBACTemplateName = "web-console-server-rbac"
consoleAPIServerTemplateName = "openshift-web-console"
consoleAssetConfigFile = "install/origin-web-console/console-config.yaml"
)
Expand All @@ -41,6 +42,10 @@ func (h *Helper) InstallWebConsole(f *clientcmd.Factory, imageFormat string, ser
return errors.NewError("cannot create web console project").WithCause(err)
}

if err = instantiateTemplate(templateClient.Template(), f, OpenshiftInfraNamespace, consoleRBACTemplateName, consoleNamespace, map[string]string{}, true); err != nil {
return errors.NewError("cannot instantiate template service broker permissions").WithCause(err)
}

// read in the asset config YAML file like the installer
assetConfigYaml, err := bootstrap.Asset(consoleAssetConfigFile)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/oc/bootstrap/docker/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ var (
// the cluster version.
internalCurrentTemplateLocations = map[string]string{
"web console server template": "install/origin-web-console/console-template.yaml",
"web console server rbac": "install/origin-web-console/rbac-template.yaml",
"template service broker apiserver": "install/templateservicebroker/apiserver-template.yaml",
}
// internalPreviousTemplateLocations are templates that will be registered in an internal namespace.
Expand Down
58 changes: 58 additions & 0 deletions test/extended/testdata/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 98b9fa6

Please sign in to comment.