Skip to content

Commit 651bd0e

Browse files
author
orannahoum
committed
the operator will now look for KUBECONFIG if not defined in $HOME/.kube/config
1 parent 71cf9f7 commit 651bd0e

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

README.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ To set up this operator follow the instructions below:
1818
* An openshift cluster
1919
* If you wish to run this locally by using kind please
2020
check [KindInstallationREADME.md](hack/KindInstallationREADME.md)
21-
21+
2222
### Installation - Open-Shift
2323

2424
run the script (make sure you are logged into open shift cluster):
@@ -27,6 +27,13 @@ run the script (make sure you are logged into open shift cluster):
2727
./deploy_skydive_operator_on_openshift.sh
2828
```
2929

30+
If for some reason you have changed your KUBECONFIG default location please update the KUBECONFIG environment variable
31+
by using this command:
32+
33+
```bash
34+
export KUBECONFIG=$PATH_TO_YOUR_KUBECONFIG
35+
```
36+
3037
#### Analyzer UI
3138

3239
1a. Check that all the pods, services and routes are running and afterwards run the following command:
@@ -60,7 +67,7 @@ for deployment developing using minio run: (don't forget to kill the old flow_ex
6067
./hack/deploy_skydive_flow_exporter_dev_operator.sh
6168
```
6269

63-
#### Prometheus Connector
70+
#### Prometheus Connector
6471

6572
After a successful deployment of skydive operator run the script:
6673

@@ -76,9 +83,10 @@ field), the options are as follows:
7683
* Skydive agents
7784
* Skydive analyzer
7885
* Service route
79-
86+
8087
You can provide the skydive operator with environments variables in order to customize your skydive deployment.
81-
Checkout [this example](config/skydive_v1_skydive_env_example.yaml) of crd to get started with providing environment
82-
variables to the skydive operator, full list of acceptable enviorment variables are listed [here](https://github.com/skydive-project/skydive/blob/master/etc/skydive.yml.default)
88+
Checkout [this example](config/skydive_v1_skydive_env_example.yaml) of crd to get started with providing environment
89+
variables to the skydive operator, full list of acceptable enviorment variables are
90+
listed [here](https://github.com/skydive-project/skydive/blob/master/etc/skydive.yml.default)
8391

8492
Choose your logging level (defaults to DEBUG)

hack/KindInstallationREADME.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,32 @@ To set up this operator on a kind follow the instructions below:
1818
* Kind installed
1919

2020
### Modyfing the CRD
21-
Modify the file config/skydive_v1_skydive.yaml and pick what you wish to deploy (insert true or false in the relevant field), the options are as follows:
21+
22+
Modify the file config/skydive_v1_skydive.yaml and pick what you wish to deploy (insert true or false in the relevant
23+
field), the options are as follows:
24+
2225
* Skydive agents
2326
* Skydive analyzer
2427
* Service route
25-
2628

2729
### Installation
2830

2931
#### Kind
30-
Install kind on your machine, use [this](https://kind.sigs.k8s.io/docs/user/quick-start/) quick start guide for help,
32+
33+
Install kind on your machine, use [this](https://kind.sigs.k8s.io/docs/user/quick-start/) quick start guide for help,
3134
make sure that your have a running kind cluster and that kubectl commands refer to relevant context.
3235

33-
After installing and running the Kind cluster, make sure the env var KUBECONFIG is set to the correct kubeConfig file,
34-
it usually defaults to $HOME/.kube/config, run this command:
36+
If for some reason you have changed your KUBECONFIG default location please update the KUBECONFIG environment variable
37+
by using this command:
3538

3639
```bash
37-
export KUBECONFIG=~/.kube/config
40+
export KUBECONFIG=$PATH_TO_YOUR_KUBECONFIG
3841
```
3942

4043
run the script :
4144

4245
```./deploy_operator_on_kind.sh```
4346

44-
*if you get an error
45-
4647
### Customize skydive deployment / CRD
4748

4849
Modify the current config/skydive_v1_skydive.yaml and pick what you wish to deploy (insert true or false in the relevant
@@ -52,11 +53,12 @@ field), the options are as follows:
5253
* Skydive analyzer
5354

5455
You can provide the skydive operator with environments variables in order to customize your skydive deployment.
55-
Checkout [this example](config/skydive_v1_skydive_env_example.yaml) of crd to get started with providing environment
56-
variables to the skydive operator, full list of acceptable enviorment variables are listed [here](https://github.com/skydive-project/skydive/blob/master/etc/skydive.yml.default)
57-
56+
Checkout [this example](../config/skydive_v1_skydive_env_example.yaml) of crd to get started with providing environment
57+
variables to the skydive operator, full list of acceptable enviorment variables are
58+
listed [here](https://github.com/skydive-project/skydive/blob/master/etc/skydive.yml.default)
5859

5960
#### Analyzer UI
61+
6062
1. Check that all the pods and services are running and afterwards run the following command:
6163

6264
```sh

pkg/config/config.go

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ func GetConfig() (*rest.Config, error) {
1111
var err error
1212
if kubeConfig := os.Getenv("KUBECONFIG"); kubeConfig != "" {
1313
config, err = clientcmd.BuildConfigFromFlags("", kubeConfig)
14+
} else if homePath := os.Getenv("HOME"); homePath != "" {
15+
config, err = clientcmd.BuildConfigFromFlags("", homePath+"/.kube/config")
16+
if err != nil {
17+
config, err = rest.InClusterConfig()
18+
}
1419
} else {
1520
config, err = rest.InClusterConfig()
1621
}

0 commit comments

Comments
 (0)