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

Change default installation namespace on OpenShift #5441

Merged
merged 3 commits into from
Feb 24, 2022
Merged
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
15 changes: 8 additions & 7 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion operator/docs/forwarding_logs_to_gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ metadata:
name: lokistack-dev-tenant-logs-role
rules:
- apiGroups:
- 'loki.openshift.io'
- 'loki.grafana.com'
resources:
- application
- infrastructure
Expand Down
12 changes: 9 additions & 3 deletions operator/docs/hack_loki_operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions operator/docs/storage_size_calculator.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions operator/internal/manifests/gateway_tenants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
{
Expand Down Expand Up @@ -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{
{
Expand Down Expand Up @@ -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{
{
Expand Down
2 changes: 1 addition & 1 deletion operator/internal/manifests/openshift/opa_openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down