Change default installation namespace on OpenShift (#5441)

pull/5467/head
Sashank Agarwal 4 years ago committed by GitHub
parent e3db2671f4
commit 56cebfcbae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      operator/Makefile
  2. 2
      operator/docs/forwarding_logs_to_gateway.md
  3. 12
      operator/docs/hack_loki_operator.md
  4. 6
      operator/docs/storage_size_calculator.md
  5. 18
      operator/internal/manifests/gateway_tenants_test.go
  6. 2
      operator/internal/manifests/openshift/opa_openshift.go

@ -12,9 +12,10 @@ default: all
# Updates this value when a new version of the product should include this operator and its bundle.
CLUSTER_LOGGING_VERSION ?= 5.1.preview.1
# CLUSTER_LOGGING_NS
# defines the default namespace of the OpenShift Cluster Logging product.
CLUSTER_LOGGING_NS ?= openshift-logging
# LOKI_OPERATOR_NS
# defines the default namespace of the Loki Operator in OpenShift.
# Loki Operator will be installed in this namespace.
LOKI_OPERATOR_NS ?= openshift-operators-redhat
# VERSION
# defines the project version for the bundle.
@ -178,15 +179,15 @@ olm-deploy: ## Deploy the operator bundle and the operator via OLM into an Kube
$(error Set variable REGISTRY_ORG to use a custom container registry org account for local development)
else
olm-deploy: olm-deploy-bundle olm-deploy-operator $(OPERATOR_SDK)
kubectl create ns $(CLUSTER_LOGGING_NS)
kubectl label ns/$(CLUSTER_LOGGING_NS) openshift.io/cluster-monitoring=true --overwrite
$(OPERATOR_SDK) run bundle -n $(CLUSTER_LOGGING_NS) --install-mode OwnNamespace $(BUNDLE_IMG)
kubectl create ns $(LOKI_OPERATOR_NS)
kubectl label ns/$(LOKI_OPERATOR_NS) openshift.io/cluster-monitoring=true --overwrite
$(OPERATOR_SDK) run bundle -n $(LOKI_OPERATOR_NS) --install-mode OwnNamespace $(BUNDLE_IMG)
endif
.PHONY: olm-undeploy
olm-undeploy: $(OPERATOR_SDK) ## Cleanup deployments of the operator bundle and the operator via OLM on an OpenShift cluster selected via KUBECONFIG.
$(OPERATOR_SDK) cleanup loki-operator
kubectl delete ns $(CLUSTER_LOGGING_NS)
kubectl delete ns $(LOKI_OPERATOR_NS)
.PHONY: deploy-size-calculator
ifeq ($(findstring openshift-logging,$(CALCULATOR_IMG)),openshift-logging)

@ -36,7 +36,7 @@ metadata:
name: lokistack-dev-tenant-logs-role
rules:
- apiGroups:
- 'loki.openshift.io'
- 'loki.grafana.com'
resources:
- application
- infrastructure

@ -93,12 +93,18 @@ It will undeploy controller from the configured Kubernetes cluster in [~/.kube/c
where `$YOUR_QUAY_ORG` is your personal [quay.io](http://quay.io/) account where you can push container images and `$VERSION` can be any random version number such as `v0.0.1`.
The above command will deploy the operator to your active Openshift cluster defined by your local [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/). The operator will be running in the `openshift-logging` namespace.
The above command will deploy the operator to your active Openshift cluster defined by your local [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/). The operator will be running in the `openshift-operators-redhat` namespace.
* You can confirm that the operator is up and running using:
```console
kubectl -n openshift-logging get pods
kubectl -n openshift-operators-redhat get pods
```
* Next step is to create the `openshift-logging` namespace in the cluster:
```console
kubectl create ns openshift-logging
```
* Now you need to create a storage secret for the operator. This can be done using:
@ -157,7 +163,7 @@ It will undeploy controller from the configured Kubernetes cluster in [~/.kube/c
If you don't want `lokistack-gateway` component [1] then you can skip it by removing the `--with-lokistack-gateway` args from the `loki-operator-controller-manager` deployment:
```console
kubectl -n openshift-logging edit deployment/loki-operator-controller-manager
kubectl -n openshift-operators-redhat edit deployment/loki-operator-controller-manager
```
Delete the flag `--with-lokistack-gateway` from the `args` section and save the file. This will update the deployment and now you can create LokiStack instance using:

@ -17,6 +17,12 @@ Storage Size Calculator is used to have an idea on how to properly size a Loki c
* Deploy the [Loki Operator](https://github.com/grafana/loki/blob/master/operator/docs/hack_loki_operator.md#hacking-on-loki-operator-on-openshift) to the cluster.
* Create the `openshift-logging` namespace in the cluster:
```console
kubectl create ns openshift-logging
```
* Deploy the storage size calculator by executing following command in the terminal:
```console

@ -203,9 +203,9 @@ func TestConfigureDeploymentForMode(t *testing.T) {
"--web.listen=:8082",
"--web.internal.listen=:8083",
"--web.healthchecks.url=http://localhost:8082",
`--openshift.mappings=application=loki.openshift.io`,
`--openshift.mappings=infrastructure=loki.openshift.io`,
`--openshift.mappings=audit=loki.openshift.io`,
`--openshift.mappings=application=loki.grafana.com`,
`--openshift.mappings=infrastructure=loki.grafana.com`,
`--openshift.mappings=audit=loki.grafana.com`,
},
Ports: []corev1.ContainerPort{
{
@ -298,9 +298,9 @@ func TestConfigureDeploymentForMode(t *testing.T) {
"--web.healthchecks.url=http://localhost:8082",
"--tls.internal.server.cert-file=/var/run/tls/tls.crt",
"--tls.internal.server.key-file=/var/run/tls/tls.key",
`--openshift.mappings=application=loki.openshift.io`,
`--openshift.mappings=infrastructure=loki.openshift.io`,
`--openshift.mappings=audit=loki.openshift.io`,
`--openshift.mappings=application=loki.grafana.com`,
`--openshift.mappings=infrastructure=loki.grafana.com`,
`--openshift.mappings=audit=loki.grafana.com`,
},
Ports: []corev1.ContainerPort{
{
@ -435,9 +435,9 @@ func TestConfigureDeploymentForMode(t *testing.T) {
"--web.healthchecks.url=http://localhost:8082",
"--tls.internal.server.cert-file=/var/run/tls/tls.crt",
"--tls.internal.server.key-file=/var/run/tls/tls.key",
`--openshift.mappings=application=loki.openshift.io`,
`--openshift.mappings=infrastructure=loki.openshift.io`,
`--openshift.mappings=audit=loki.openshift.io`,
`--openshift.mappings=application=loki.grafana.com`,
`--openshift.mappings=infrastructure=loki.grafana.com`,
`--openshift.mappings=audit=loki.grafana.com`,
},
Ports: []corev1.ContainerPort{
{

@ -14,7 +14,7 @@ const (
defaultOPAImage = "quay.io/observatorium/opa-openshift:latest"
opaContainerName = "opa"
opaDefaultPackage = "lokistack"
opaDefaultAPIGroup = "loki.openshift.io"
opaDefaultAPIGroup = "loki.grafana.com"
opaMetricsPortName = "opa-metrics"
)

Loading…
Cancel
Save