mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
60 lines
1.8 KiB
Plaintext
60 lines
1.8 KiB
Plaintext
[id="osdk-cli-reference-up_{context}"]
|
|
= up
|
|
|
|
The `operator-sdk up` command has subcommands that can launch the Operator in
|
|
various ways.
|
|
|
|
== local
|
|
|
|
The `local` subcommand launches the Operator on the local machine by building
|
|
the Operator binary with the ability to access a Kubernetes cluster using a
|
|
`kubeconfig` file.
|
|
|
|
.`up local` arguments
|
|
[options="header",cols="1,3"]
|
|
|===
|
|
|Arguments |Description
|
|
|
|
|`--kubeconfig` (string)
|
|
|The file path to a Kubernetes configuration file. Defaults: `$HOME/.kube/config`
|
|
|
|
|`--namespace` (string)
|
|
|The namespace where the Operator watches for changes. Default: `default`
|
|
|
|
|`--operator-flags`
|
|
|Flags that the local Operator may need. Example: `--flag1 value1 --flag2=value2`
|
|
|
|
|`-h, --help`
|
|
|Usage help output.
|
|
|===
|
|
|
|
.Example output
|
|
----
|
|
$ operator-sdk up local \
|
|
--kubeconfig "mycluster.kubecfg" \
|
|
--namespace "default" \
|
|
--operator-flags "--flag1 value1 --flag2=value2"
|
|
----
|
|
|
|
The following example uses the default `kubeconfig`, the default namespace
|
|
environment variable, and passes in flags for the Operator. To use the Operator
|
|
flags, your Operator must know how to handle the option. For example, for an
|
|
Operator that understands the `resync-interval` flag:
|
|
|
|
----
|
|
$ operator-sdk up local --operator-flags "--resync-interval 10"
|
|
----
|
|
|
|
If you are planning on using a different namespace than the default, use the
|
|
`--namespace` flag to change where the Operator is watching for Custom Resources (CRs)
|
|
to be created:
|
|
|
|
----
|
|
$ operator-sdk up local --namespace "testing"
|
|
----
|
|
|
|
For this to work, your Operator must handle the `WATCH_NAMESPACE`
|
|
environment variable. This can be accomplished using the
|
|
link:https://github.com/operator-framework/operator-sdk/blob/89bf021063d18b6769bdc551ed08fc37027939d5/pkg/util/k8sutil/k8sutil.go#L140[utility function]
|
|
`k8sutil.GetWatchNamespace` in your Operator.
|