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

Update entrypoint scripts and document to align with new CLI #1097

Merged
merged 5 commits into from
Dec 8, 2017
Merged

Update entrypoint scripts and document to align with new CLI #1097

merged 5 commits into from
Dec 8, 2017

Conversation

tiewei
Copy link
Contributor

@tiewei tiewei commented Dec 5, 2017

Update entrypoint scripts for k8s, docker v2plugin to align with
new CLI, update documents, k8s config yaml.
Drive by update vagrantfile, kubeadm_test, utils/configs.go to make
codes more readable.

Signed-off-by: Wei Tie wtie@cisco.com

Update entrypoint scripts for k8s, docker v2plugin to align with
new CLI, update documents, k8s config yaml.
Drive by update vagrantfile, kubeadm_test, utils/configs.go to make
codes more readable.

Signed-off-by: Wei Tie <wtie@cisco.com>
@tiewei
Copy link
Contributor Author

tiewei commented Dec 6, 2017

build PR

```
### docker hub
Developer release of v2plugin from contiv repo is also pushed to docker hub
Please update mode, forward modemode, net mode according to your deployment.
Copy link
Contributor

Choose a reason for hiding this comment

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

modemode -> mode

@@ -49,8 +73,11 @@ make demo-v2plugin

## Contiv plugin-roles
Contiv plugin runs both netplugin and netmaster by default. Contiv v2plugin can be run with only netplugin by setting the plugin_role to worker.
Please update mode, forward modemode, net mode according to your deployment.
Copy link
Contributor

Choose a reason for hiding this comment

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

modemode -> mode

if [ "$log_dir" == "" ]; then
log_dir="/var/log/contiv"
# setting up logs
if [ ! -z "$CONTIV_LOG_DIR" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

-n ?

Copy link
Contributor

Choose a reason for hiding this comment

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

-z ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isn't ! -z "" == -n "" ? is it a concern ?

Copy link
Contributor

Choose a reason for hiding this comment

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

just a minor nitpick... you can avoid negation by using the opposing operator

Copy link
Contributor

Choose a reason for hiding this comment

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

[chrisplo:~] $ 
$ CONTIV_LOG_DIR=foo
[chrisplo:~] $ 
$ if [ ! -z "$CONTIV_LOG_DIR" ]; then echo setting log dir; fi
setting log dir
[chrisplo:~] $ 
$ unset CONTIV_LOG_DIR
[chrisplo:~] $ 
$ if [ ! -z "$CONTIV_LOG_DIR" ]; then echo setting log dir; fi
[chrisplo:~] $ 

the logic is wrong I think, drop the !


if [ $cleanup == true ]; then
exit 0
if [ ! -z "$CONTIV_MODE" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

-n ?

(and the others here)

mkdir -p /var/contiv/config
echo ${CONTIV_CONFIG} >/var/contiv/config/contiv.json
cp /var/contiv/config/contiv.json /opt/contiv/config/contiv.json
if [ -d /var/contiv/log ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Could both of these dirs even even exist at the same time? I think that implies both bindmounts are active... and in that case, the mv here is moving a bindmount onto another bindmount (gonna fail)

I think moving the contents will work, but moving the dir (possibly mountpoint) is not safe

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah I see these are both bindmounts... you'll need to mv the contents (or cp -r), not the directory (which is actually a mountpoint)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to use cp -a

@unclejack
Copy link
Contributor

build PR

# The location of your cluster store. This is set to the
# avdertise-client value below from the contiv-etcd service.
# Change it to an external etcd/consul instance if required.
cluster_store: "etcd://__NETMASTER_IP__:6666"
contiv_etcd: "http://__NETMASTER_IP__:6666"
Copy link
Contributor

Choose a reason for hiding this comment

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

were changing these three to have contiv_ necessary since we're in a contiv.yaml file? for example I see that calico doesn't namespace:
https://github.com/projectcalico/calico/blob/master/v2.6/getting-started/kubernetes/installation/hosted/calico.yaml#L19

same q for other deployments like contiv_devtest.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's just to make it more readable, it's useful when we split the yaml file to several yamls


ARG : DESCRIPTION : DEFAULT VALUE
----------------------------------:---------------------------------------------------------------------------:----------------------
CONTIV_ROLE : contiv net service net, options: [netmaster, netplugin] : ""
Copy link
Contributor

Choose a reason for hiding this comment

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

why not default to netplugin? that should line up when we eventually pull out netmaster from the container . .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

default to netplugin will not bring up netmaster, is it what we wanted ?

Copy link
Contributor

Choose a reason for hiding this comment

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

my thinking was that all nodes will be running netplugin (now and after we split)
the netmaster are special, as there are only 3 (or so) of them, and it seems to make more sense to tag the special ones?

CONTIV_ROLE : contiv net service net, options: [netmaster, netplugin] : ""
CONTIV_LOG_DIR : contiv log file directory : "/var/log/contiv"
CONTIV_NETPLUGIN_CONSUL_ENDPOINTS : a comma-delimited list of netplugin consul endpoints : ""
CONTIV_NETPLUGIN_ETCD_ENDPOINTS : a comma-delimited list of netplugin etcd endpoints : ""
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sad we lost the etcd default, what if we:

  • default etcd to http://localhost:2379, consul to ""
  • if consul is set and etcd is default value, then use consul
  • if both explicitly set, error

Copy link
Contributor Author

@tiewei tiewei Dec 6, 2017

Choose a reason for hiding this comment

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

that introduce extra layer in the startcontiv.sh and i'm trying to avoid it ...
we can default to use etcd http://127.0.0.1:2379 if none of them are set, but it needs to be in configs.go instead of startcontiv.sh. thought ?

Copy link
Contributor

Choose a reason for hiding this comment

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

if you meant "none" instead of "one" . . seems good, we can still document the default as etcd even if it's not done in startcontiv?

if [ "$log_dir" == "" ]; then
log_dir="/var/log/contiv"
# setting up logs
if [ ! -z "$CONTIV_LOG_DIR" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

-z ?

if [[ "$cluster_store" =~ ^etcd://.+ ]]; then
store_arg="--etcd-endpoints $(echo $cluster_store | sed s/etcd/http/)"
mkdir -p /var/run/openvswitch
mkdir -p /var/log/contiv/
Copy link
Contributor

Choose a reason for hiding this comment

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

not blocking, mkdir can take multiple args I think

--private-key=db:Open_vSwitch,SSL,private_key \
--certificate=db:Open_vSwitch,SSL,certificate \
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
--log-file=/var/log/contiv/ovs-db.log -vsyslog:info -vfile:info \
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't vsyslog and vfile be based on the CLI setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not for ovs log, there was a PR to set to use info level specifically, this is just to make it align between docker and k8s

Copy link
Contributor

Choose a reason for hiding this comment

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

k

set -x
/contiv/bin/netmaster "$@" &> "$CONTIV_LOG_DIR/netmaster.log"
set +x
echo "ERROR: Contiv netmaster has exited, restarting in 5s"
Copy link
Contributor

Choose a reason for hiding this comment

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

did log rotation happen elsewhere now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, there's no log rotation today

Copy link
Contributor

Choose a reason for hiding this comment

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

if [ "$i" -ge "10" ]; then
echo "netmaster port not open (needed to set forwarding mode), plugin failed"
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we getting rid of the wait for the listen port?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

b/c the fwd config are in passed CLI, don't have to wait for it's ready

Copy link
Contributor

Choose a reason for hiding this comment

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

k

@@ -1,14 +1,15 @@
#!/bin/bash
#Start OVS in the Contiv container

set -euo pipefail
Copy link
Contributor

Choose a reason for hiding this comment

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

the modprobe will not trigger pipefail, leave here?

#!/bin/bash
set -eo pipefail
(exit 1) || echo i am fine

@@ -554,7 +554,8 @@ func (k *kubePod) startNetmaster(args string) error {
if k.node.suite.basicInfo.AciMode == "on" {
infraType = " --infra aci "
}
netmasterStartCmd := k.node.suite.basicInfo.BinPath + `/netmaster` + infraType + k.commonArgs() + args + ` > ` + netmasterLogLocation + ` 2>&1`
// unset CONTIV_NETMASTER_ETCD_ENDPOINTS to be able to use other endpoint
netmasterStartCmd := "unset CONTIV_NETMASTER_ETCD_ENDPOINTS && " + k.node.suite.basicInfo.BinPath + `/netmaster` + infraType + k.commonArgs() + args + ` > ` + netmasterLogLocation + ` 2>&1`
Copy link
Contributor

Choose a reason for hiding this comment

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

wrapping on these 2 plz?

@tiewei
Copy link
Contributor Author

tiewei commented Dec 6, 2017

build PR

1 similar comment
@unclejack
Copy link
Contributor

build PR

This commit make netplugin and netmaster to use etcd at http://127.0.0.1:2379
if neither etcd or consul endpoints are provided.
Also make v2plugin by default as netplugin role.

Signed-off-by: Wei Tie <wtie@cisco.com>
@tiewei
Copy link
Contributor Author

tiewei commented Dec 7, 2017

build PR

if [ "$log_dir" == "" ]; then
log_dir="/var/log/contiv"
# setting up logs
if [ ! -z "$CONTIV_LOG_DIR" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

[chrisplo:~] $ 
$ CONTIV_LOG_DIR=foo
[chrisplo:~] $ 
$ if [ ! -z "$CONTIV_LOG_DIR" ]; then echo setting log dir; fi
setting log dir
[chrisplo:~] $ 
$ unset CONTIV_LOG_DIR
[chrisplo:~] $ 
$ if [ ! -z "$CONTIV_LOG_DIR" ]; then echo setting log dir; fi
[chrisplo:~] $ 

the logic is wrong I think, drop the !

@tiewei
Copy link
Contributor Author

tiewei commented Dec 7, 2017

build PR

@@ -14,7 +14,9 @@ data:
# The location of your cluster store. This is set to the
# avdertise-client value below from the contiv-etcd service.
# Change it to an external etcd/consul instance if required.
contiv_etcd: "http://__NETMASTER_IP__:6666"
# this is not required for dev test, etcd or consul endpoints
Copy link
Contributor

Choose a reason for hiding this comment

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

i read this like A, B, or C . . . maybe dev test: etcd or ...

Copy link
Contributor

@chrisplo chrisplo left a comment

Choose a reason for hiding this comment

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

i think there is a README or two that need the updated parameter for netmaster i found you did that already

@chrisplo chrisplo dismissed their stale review December 7, 2017 18:41

problem was fixed

@unclejack
Copy link
Contributor

build PR

2 similar comments
@tiewei
Copy link
Contributor Author

tiewei commented Dec 7, 2017

build PR

@tiewei
Copy link
Contributor Author

tiewei commented Dec 8, 2017

build PR

@tiewei tiewei merged commit 38d2d9f into contiv:master Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants