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

dind: add support for ovn-kubernetes network plugin #15756

Merged
merged 2 commits into from
Sep 7, 2017

Conversation

dcbw
Copy link
Contributor

@dcbw dcbw commented Aug 12, 2017

@rajatchopra here's the Origin part...

Operation:

  1. get a git checkout of ovn-kubernetes with my changes: go-controller: move scripts to Go code and add SSL support ovn-kubernetes/ovn-kubernetes#141
  2. rebuild your DIND images hack/dind-cluster.sh build-images
  3. OVN_ROOT=/path/to/ovn-kubernetes hack/dind-cluster.sh start -o

@openshift-merge-robot openshift-merge-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 12, 2017
@dcbw dcbw force-pushed the dind-ovn branch 2 times, most recently from 99dccf3 to 2b87ad4 Compare August 13, 2017 02:01
@tdawson tdawson removed their assignment Aug 14, 2017
@dcbw dcbw force-pushed the dind-ovn branch 2 times, most recently from 08b0549 to d19ce7f Compare August 31, 2017 20:38
@dcbw
Copy link
Contributor Author

dcbw commented Aug 31, 2017

@rajatchopra updated; we actually get pod IPs now even

@dcbw
Copy link
Contributor Author

dcbw commented Sep 1, 2017

@stevekuznetsov @danwinship review from you guys would be useful too, thanks!

@dcbw dcbw changed the title [RFC] dind: add support for ovn-kubernetes network plugin dind: add support for ovn-kubernetes network plugin Sep 1, 2017
Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

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

Most comments apply generally to all of the bash scripts

@@ -607,6 +642,17 @@ case "${1:-""}" in
esac
done

# OVN requires CNI network plugin and OVN_ROOT to be set
if [[ -n "${USE_OVN}" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

With set -o nounset these will fail, use "${USE_OVN:-}" etc for them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -94,6 +95,15 @@ function start() {
echo "OPENSHIFT_ADDITIONAL_ARGS='${additional_args}'" > "${config_root}/additional-args"
copy-runtime "${origin_root}" "${config_root}/"

ovn_kubernetes=
if [ -d "${ovn_root}" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer [[ over [

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

exit 1
fi
elif [[ -n "${OVN_ROOT}" ]]; then
OVN_ROOT=
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want this empty or unset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

function is-api-running() {
local config=$1

/usr/local/bin/oc --config="${kube_config}" get nodes &> /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

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

/usr/local/bin/oc --config="${kube_config}" get --raw /healthz/ready

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

/usr/local/bin/oadm --config="${kube_config}" policy add-scc-to-user anyuid -z ovn
fi

ovnsecret=$(/usr/local/bin/oc --config="${kube_config}" get secrets | grep ovn | tail -1 | awk '{ print $1 }')
Copy link
Contributor

Choose a reason for hiding this comment

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

oc sa get-token instead of these two lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

local config_dir=$1
local kube_config="${config_dir}/admin.kubeconfig"

ovnsecret=$(/usr/local/bin/oc --config="${kube_config}" get secrets | grep ovn | tail -1 | awk '{ print $1 }')
Copy link
Contributor

Choose a reason for hiding this comment

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

oc sa get-token

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

token=$(/usr/local/bin/oc --config="${kube_config}" describe secret $ovnsecret | grep "token:" | awk '{ print $2 }')

local master_config="${config_dir}/master-config.yaml"
cluster_cidr=$(grep clusterNetworkCIDR ${master_config} | cut -f 4 -d' ')
Copy link
Contributor

Choose a reason for hiding this comment

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

do you have python? might be better to use yaml.load() here -- no guarantee that the value is on the same line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, does that look any better?

OVN.md Outdated
@@ -0,0 +1,16 @@
ovn-kubernetes DIND
====================
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is intended to stick around it should probably go in docs/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

killed

@@ -765,6 +811,7 @@ start accepts the following options:
-i build container images before starting the cluster
-r remove an existing cluster
-s skip waiting for nodes to become ready
-o enable the OVN network plugin; implies "-n cni" and valid OVN_ROOT
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just make this be -n ovn? And while you're there, make -n subnet/multitenant/networkpolicy work too? There's no reason we have to make the user write out the full name of the plugin since we restrict it to a limited set of supported plugins anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, new commit for the plugin arg renames too

--ovn-south-db "tcp://${ovn_master_ip}:6642" \
--init-master `hostname` \
--net-controller
# --ovn-north-db "ssl://${ovn_nb_ip}:6641" \
Copy link
Contributor

Choose a reason for hiding this comment

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

what's all the commented-out stuff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@@ -25,8 +25,12 @@ RUN dnf -y update && dnf -y install\

# Upgrade to a newer OVS. (This can go away when the base image is upgraded to F26.)
RUN dnf -y install dnf-plugins-core &&\
dnf -y copr enable danw/origin-dind-ovs &&\
dnf -y update openvswitch
dnf -y copr enable leifmadsen/ovs-master &&\
Copy link
Contributor

Choose a reason for hiding this comment

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

Even though this is developer-only I feel like it would be better to use a COPR we maintain. I can update the packages in my COPR...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@danwinship if you could update the packages, that would be awesome.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, try danw/origin-dind-ovs-master.

@@ -25,8 +25,12 @@ RUN dnf -y update && dnf -y install\

# Upgrade to a newer OVS. (This can go away when the base image is upgraded to F26.)
Copy link
Contributor

Choose a reason for hiding this comment

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

"F26" there probably has to be "F27" now?

Actually, the original idea was that the previous RUN installs everything (including an out-of-date version of openvswitch), and then this RUN is just to handle the fact that Fedora's OVS is too old. But the patch below changes things so this RUN would still be necessary even if Fedora had the latest OVN (because we're not even installing OVN in the previous RUN). So either the installs should be rearranged to keep the old behavior, or else the comment should be rewritten to not imply that this section will eventually go away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@rajatchopra
Copy link
Contributor

OVN_ROOT=/path/to/ovn-kubernetes hack/dind-cluster.sh start -n cni

Needs a '-o' or OVN will not run.

@dcbw dcbw force-pushed the dind-ovn branch 2 times, most recently from 8111eba to fa767e5 Compare September 2, 2017 03:11
@dcbw
Copy link
Contributor Author

dcbw commented Sep 2, 2017

@stevekuznetsov @danwinship I believe I've addressed all your comments, PTAL thanks!

Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

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

Bash bits LGTM, one nit

fi

token=$(/usr/local/bin/oc --config="${kube_config}" sa get-token ovn)
echo "${token}" > ${config_dir}/ovn.token
Copy link
Contributor

Choose a reason for hiding this comment

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

Could collapse this

/usr/local/bin/oc --config="${kube_config}" sa get-token ovn > ${config_dir}/ovn.token

# OVN requires CNI network plugin and OVN_ROOT to be set
if [[ "${NETWORK_PLUGIN}" = "ovn" ]]; then
NETWORK_PLUGIN="cni"
if [[ -z "${OVN_ROOT}" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

If it can be unset use :- defaulting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevekuznetsov I defaulted it above:

ADDITIONAL_ARGS=""

OVN_ROOT="${OVN_ROOT:-}"

case "${1:-""}" in
  start)
    BUILD=

is that sufficent?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, sorry -- didn't catch that

Copy link
Contributor

@danwinship danwinship left a comment

Choose a reason for hiding this comment

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

Changes look good except for a bit of cruft.

Commit message still refers to OVN.md

copy-ovn-runtime "${ovn_root}" "${config_root}/"
ovn_kubernetes=1
else
ovn_kubernetes=
Copy link
Contributor

Choose a reason for hiding this comment

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

redundant, you already set it before the if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -576,7 +609,7 @@ case "${1:-""}" in
NETWORK_PLUGIN=
REMOVE_EXISTING_CLUSTER=
OPTIND=2
while getopts ":bin:rsN:" opt; do
while getopts ":boin:rsN:" opt; do
Copy link
Contributor

Choose a reason for hiding this comment

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

no more -o

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -765,6 +810,7 @@ start accepts the following options:
-i build container images before starting the cluster
-r remove an existing cluster
-s skip waiting for nodes to become ready
-o enable the OVN network plugin; implies "-n cni" and valid OVN_ROOT
Copy link
Contributor

Choose a reason for hiding this comment

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

drop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

dcbw added 2 commits September 6, 2017 13:52
-n now takes one of [ subnet | multitenant | networkpolicy | ovn | cni ]
@dcbw
Copy link
Contributor Author

dcbw commented Sep 6, 2017

@danwinship @stevekuznetsov one more PTAL, thanks!

Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

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

LGTM from a Bash perspective

Copy link
Contributor

@rajatchopra rajatchopra left a comment

Choose a reason for hiding this comment

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

I tested it locally and the cluster comes up fine.
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 6, 2017
@rajatchopra
Copy link
Contributor

/test end_to_end

@dcbw
Copy link
Contributor Author

dcbw commented Sep 7, 2017

@liggitt could we get an approve on this one? thanks!

@dcbw
Copy link
Contributor Author

dcbw commented Sep 7, 2017

@stevekuznetsov can you /approve?

@stevekuznetsov
Copy link
Contributor

/approve

@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dcbw, rajatchopra, stevekuznetsov

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 7, 2017
@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 14825, 15756, 16178, 16188, 16189)

@openshift-merge-robot openshift-merge-robot merged commit 2fee53c into openshift:master Sep 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants