Skip to content

OWLS-73891 part3 - add FAQ entry for managing namespaces #1264

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

Merged
merged 18 commits into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from 12 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
137 changes: 137 additions & 0 deletions docs-source/content/faq/namespace-management.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
title: "Managing Domain Namespaces"
date: 2019-09-19
draft: false
---

Each WebLogic operator deployment manages a number of Kubernetes namespaces (for more information about setting domain namespaces, see [Operator Helm configuration values]({{<relref "/userguide/managing-operators/using-the-operator/using-helm.md#operator-helm-configuration-values">}}). A couple of Kubernetes resources
have to be present in a namespace before any WebLogic domain custom resources can be successfully
deployed into it.
Those Kubernetes resources are either created as part of the installation
of the operator's helm chart, or created by the operator at runtime.
Copy link
Member

Choose a reason for hiding this comment

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

helm -> Helm (always capitalized except when used in a command)


This documentation describes a couple of things that you need to be aware when you manage the namespaces while the WebLogic operator is running. For example,
* Add a namespace for the operator to manage,
* Delete a namespace from the operator's domain namespace list, or
* Delete and recreate a Kubernetes namespace that the WebLogic operator manages.

See more in [Common Mistakes and Solutions]({{<relref "/userguide/managing-operators/using-the-operator/using-helm.md#common-mistakes-and-solutions">}}).

Choose a reason for hiding this comment

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

General comments:

  • This is all helpful information IMO.
  • Consider asking Rosemary to do an edit pass
  • Each of the above three bullets at lines 14, 15, and 16 could be turned into a link to its corresponding section below
  • Maybe add a new bullet and corresponding new section that explain how to get the list of the namespaces that a running Operator is already monitoring. Namely, use helm ls to get the list of running operators, and helm get values my-operator-name to show the namespaces a particular running operator is monitoring.
  • IMO, instead of making it a FAQ entry, this new document looks like it would slot more smoothly into the documentation as a new section in 'using-helm.md' itself (I suspect Rosemary could do this for you if you agree this would be helpful...).

Copy link
Member Author

@doxiao doxiao Sep 23, 2019

Choose a reason for hiding this comment

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

Thanks, Tom, for reviewing the doc. Those are all great comments. I'll add links from the introduction area to the individual sections, and add the section for getting the current value of domainNamespaces.
I also feel that the content here fit better in the user guide, instead of the FAQ section.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the doc to address item #3 and #4.
@rosemarymarano Rosemary, I have done with updating the doc, and you can start working on it anytime.
I'll leave it to Ryan @rjeberhard and Mark @markxnelson to decide where the content should go.

Copy link
Member

Choose a reason for hiding this comment

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

I am ok either way.


#### Adding a Kubernetes namespace to the operator
If you want a WebLogic operator deployment to manage a namespace, you need to add the namespace to the operator's `domainNamespaces` list. Note that the namespace has to be pre-created, say using the `kubectl create` command.
Copy link
Member

Choose a reason for hiding this comment

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

pre-created, say using -> precreated, for example, using


By adding a namespace to the `domainNamespaces` list, it tells the operator deployment or runtime
Copy link
Member

Choose a reason for hiding this comment

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

By adding a namespace to the domainNamespaces list, it tells the operator -> Adding a namespace to the domainNamespaces list tells the operator

to initialize the necessary Kubernetes resources for the namespace so that the operator is ready to host WebLogic domain resources in that namespace.

When the operator is running and managing the `default` namespace, the following example helm command adds namespace `ns1` to the `domainNamespaces` list, where `weblogic-operator` is the release name of the operator, and `kubernetes/charts/weblogic-operator` is the location of the operator's helm charts.
Copy link
Member

Choose a reason for hiding this comment

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

adds namespace -> adds the namespace


```
$ helm upgrade \
--reuse-values \
--set "domainNamespaces={default,ns1}" \
--wait \
--force \
weblogic-operator \
kubernetes/charts/weblogic-operator
```

{{% notice note %}}
Changes to the `domainNamespaces` list may not be picked up by the operator right away because the operator
Copy link
Member

Choose a reason for hiding this comment

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

list may not be picked up -> list might not be picked up

checks the changes to the setting periodically. The operator becomes ready to host domain resources in
a namespace only after the required `configmap` (namely `weblogic-domain-cm`) is initialized in the namespace.
{{% /notice %}}

You can verify if the operator is ready to host domain resources in a namespace by checking the existence of the required `configmap` resource.

```
$ kubetctl get cm -n <namespace>
```

For example, the following example shows that the domain `configmap` resource exists in namespace `ns1`.

```
bash-4.2$ kubectl get cm -n ns1

NAME DATA AGE

weblogic-domain-cm 14 12m
```

#### Deleting a Kubernetes namespace from the operator
When a namespace is not supposed to be managed by an operator any more, it needs to be removed from
Copy link
Member

Choose a reason for hiding this comment

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

is not supposed to be managed by an operator any more, -> is no longer supposed to be managed by an operator,

the operator's `domainNamespaces` list so that the corresponding Kubernetes resources that are
associated with the namespace can be cleaned up.

While the operator is running and managing the `default` and `ns1` namespaces, the following example helm
command removes namespace `ns1` from the `domainNamespaces` list, where `weblogic-operator` is the release
Copy link
Member

Choose a reason for hiding this comment

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

removes namespace -> removes the namespace

name of the operator, and `kubernetes/charts/weblogic-operator` is the location of the helm charts of the operator.

```
$ helm upgrade \
--reuse-values \
--set "domainNamespaces={default}" \
--wait \
--force \
weblogic-operator \
kubernetes/charts/weblogic-operator

```

#### Recreating a previously deleted Kubernetes namespace

If you need to delete a namespace (and the resources in it) and then recreate it,
remember to remove the namespace from the operator's `domainNamespaces` list
after you deleted the namespace, and add it back to the `domainNamespaces` list after you recreated the namespace
Copy link
Member

Choose a reason for hiding this comment

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

after you deleted the namespace -> after you delete the namespace
after you recreated the namespace -> after you recreate the namespace

using the `helm upgrade` commands that have been illustrated above.

{{% notice note %}}
Make sure that you wait a sufficient period of time between deleting and recreating the
namespace because it takes time for the resources in a namespace to go way after the namespace is deleted.
Copy link
Member

Choose a reason for hiding this comment

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

to go way -> to go away

In addition, as we have mentioned above, changes to the `domainNamespaces` setting is checked by the operator
Copy link
Member

Choose a reason for hiding this comment

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

as we have mentioned above -> as mentioned above
checked by the operator -> monitored by the operator

periodically, and the operator becomes ready to host domain resources only after the required domain
`configmap` (namely `weblogic-domain-cm`) is initialized in the namespace.
{{% /notice %}}

If a domain custom resource is created before the namespace is ready, you may see that the introspector job pod
fails to start with a warning event like the following when you check the description of the introspector pod.
Copy link
Member

Choose a reason for hiding this comment

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

fails to start with a warning event like the following when you check the description -> fails to start, with a warning event like the following, when you review the description

Note that `domain1` is the name of the domain in the following example output.

```
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 1m default-scheduler Successfully assigned domain1-introspect-domain-job-bz6rw to slc16ffk

Normal SuccessfulMountVolume 1m kubelet, slc16ffk MountVolume.SetUp succeeded for volume "weblogic-credentials-volume"

Normal SuccessfulMountVolume 1m kubelet, slc16ffk MountVolume.SetUp succeeded for volume "default-token-jzblm"

Warning FailedMount 27s (x8 over 1m) kubelet, slc16ffk MountVolume.SetUp failed for volume "weblogic-domain-cm-volume" : configmaps "weblogic-domain-cm" not found

```

If you run into situations where a new domain that is created after its namespace is deleted and recreated
does not come up successfully, you can restart the operator pod as shown in the following examples, where
the operator itself is running in the namespace `weblogic-operator-namespace` with a release name
of `weblogic-operator`.

* Killing the operator pod, and let Kubernetes restart it

```
$ kubectl delete pod/weblogic-operator-65b95bc5b5-jw4hh -n weblogic-operator-namespace
```

* Scaling the operator deployment to `0` and then back to `1` by changing the value of the `replicas`.

```
$ kubectl scale deployment.apps/weblogic-operator -n weblogic-operator-namespace --replicas=0
```

```
$ kubectl scale deployment.apps/weblogic-operator -n weblogic-operator-namespace --replicas=1
```

{{% notice note %}}
Restarting an operator pod interrupts not just the domain resources in the namespace that is to be re-initialized,
but all domain resources managed by the operator deployment. Therefore, this can only be used as the last resort.
Copy link
Member

Choose a reason for hiding this comment

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

as the last resort -> as a last resort

{{% /notice %}}:
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ $ helm upgrade \
kubernetes/charts/weblogic-operator
```

Refer to [Domain Namespace Management] ({{<relref "/faq/namespace-management.md">}}) for more information about managing `domainNamespaces`.

### Operator Helm configuration values

This section describes the details of the operator Helm chart's available configuration values.
Expand Down