Skip to content

Commit

Permalink
Merge pull request openshift#393 from danwinship/sdn-consolidated-image
Browse files Browse the repository at this point in the history
Use consolidated sdn-node/sdn-controller image
  • Loading branch information
openshift-merge-robot committed Nov 13, 2019
2 parents def4c64 + 8399c10 commit 4981873
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 37 deletions.
26 changes: 7 additions & 19 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ hack/build-go.sh

```
export CLUSTER_DIR=<your cluster directory>
hack/run-locally.sh -n OpenShiftSDN -m "docker.io/myawesome/origin-node:latest"
hack/run-locally.sh -n OpenShiftSDN -m "docker.io/myawesome/origin-sdn:latest"
```

It will print status messages as it waits for the installer to make progress.
Expand Down Expand Up @@ -138,36 +138,24 @@ export HACK_MINIMIZE=1
Origin images are difficult to build correctly. If you want to test some binary changes with openshift-sdn, there's an easier way.

#### One-time setup:
1. Set up your API credentials:
Set up your API credentials:
- Log on to https://api.ci.openshift.org/ with your GitHub credentials
- On the top right, click copy login command. Execute it in a terminal
- Execute `oc registry login`, which will install credentials for your local podman and docker clients
2. Create the following dockerfile in your origin repo:
```
cat <<EOF > Dockerfile.node-hacking
FROM docker.io/openshift/origin-node:v4.0.0
COPY _output/local/bin/linux/amd64/openshift-sdn /usr/bin/openshift-sdn
EOF
```

#### Building a development sdn image
1. Pick a registry. You can use the Openshift CI one if you are a member of the organization.
```
export REGISTRY=registry.svc.ci.openshift.org/<YOUR-GITHUB-USERNAME>
```

2. Build the sdn process
```
make WHAT=./cmd/openshift-sdn
```

3. Build and push the node image
2. Build and push the sdn image
```
podman build -t ${REGISTRY}/origin-node:latest -f Dockerfile.node-hacking .
podman push ${REGISTRY}/origin-node:latest
podman build -t ${REGISTRY}/origin-sdn:latest -f images/sdn/Dockerfile.fedora .
podman push ${REGISTRY}/origin-sdn:latest
```

4. Follow the steps above, but override the node image reference in step 3.
3. Follow the steps above, using the `-m` option to override the image:
```
echo "NODE_IMAGE=${REGISTRY}/origin-node:latest" >> ${CLUSTER_DIR}/env.sh
hack/run-locally.sh -m ${REGISTRY}/origin-sdn:latest
```
4 changes: 2 additions & 2 deletions bindata/network/openshift-sdn/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ spec:
spec:
containers:
- name: sdn-controller
image: {{.SDNControllerImage}}
command: ["network-controller"]
image: {{.SDNImage}}
command: ["openshift-sdn-controller"]
resources:
requests:
cpu: 10m
Expand Down
2 changes: 1 addition & 1 deletion bindata/network/openshift-sdn/sdn-ovs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
priorityClassName: system-node-critical
containers:
- name: openvswitch
image: {{.NodeImage}}
image: {{.SDNImage}}
command:
- /bin/bash
- -c
Expand Down
4 changes: 2 additions & 2 deletions bindata/network/openshift-sdn/sdn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ spec:
privileged: true
containers:
- name: sdn
image: {{.NodeImage}}
image: {{.SDNImage}}
command:
- /bin/bash
- -c
Expand Down Expand Up @@ -96,7 +96,7 @@ spec:
cp -f /opt/cni/bin/openshift-sdn /host/opt/cni/bin/
# Launch the network process
exec /usr/bin/openshift-sdn --proxy-config=/config/kube-proxy-config.yaml --url-only-kubeconfig=/etc/kubernetes/kubeconfig --v=${DEBUG_LOGLEVEL:-2}
exec /usr/bin/openshift-sdn-node --proxy-config=/config/kube-proxy-config.yaml --url-only-kubeconfig=/etc/kubernetes/kubeconfig --v=${DEBUG_LOGLEVEL:-2}
securityContext:
privileged: true
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion hack/run-locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ The following environment variables are honored:

PLUGIN_IMAGE="${PLUGIN_IMAGE:-}"
NETWORK_PLUGIN="OpenShiftSDN"
IMAGE_ENV_KEY="NODE_IMAGE"
IMAGE_ENV_KEY="SDN_IMAGE"
CLUSTER_DIR="${CLUSTER_DIR:-}"
INSTALLER_PATH="${INSTALLER_PATH:-}"
INSTALL_CONFIG="${INSTALL_CONFIG:-}"
Expand Down
6 changes: 2 additions & 4 deletions manifests/0000_70_cluster-network-operator_03_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ spec:
env:
- name: RELEASE_VERSION
value: "0.0.1-snapshot"
- name: NODE_IMAGE
value: "quay.io/openshift/origin-node:4.3"
- name: SDN_CONTROLLER_IMAGE
value: "quay.io/openshift/origin-sdn-controller:4.3"
- name: SDN_IMAGE
value: "quay.io/openshift/origin-sdn:4.3"
- name: KUBE_PROXY_IMAGE
value: "quay.io/openshift/origin-kube-proxy:4.3"
- name: MULTUS_IMAGE
Expand Down
8 changes: 2 additions & 6 deletions manifests/image-references
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ spec:
from:
kind: DockerImage
name: quay.io/openshift/origin-cluster-network-operator:4.3
- name: node
- name: sdn
from:
kind: DockerImage
name: quay.io/openshift/origin-node:4.3
name: quay.io/openshift/origin-sdn:4.3
- name: kube-proxy
from:
kind: DockerImage
name: quay.io/openshift/origin-kube-proxy:4.3
- name: sdn-controller
from:
kind: DockerImage
name: quay.io/openshift/origin-sdn-controller:4.3
- name: multus-cni
from:
kind: DockerImage
Expand Down
3 changes: 1 addition & 2 deletions pkg/network/openshift_sdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ func renderOpenShiftSDN(conf *operv1.NetworkSpec, manifestDir string) ([]*uns.Un
data := render.MakeRenderData()
data.Data["ReleaseVersion"] = os.Getenv("RELEASE_VERSION")
data.Data["InstallOVS"] = (c.UseExternalOpenvswitch == nil || *c.UseExternalOpenvswitch == false)
data.Data["NodeImage"] = os.Getenv("NODE_IMAGE")
data.Data["SDNImage"] = os.Getenv("SDN_IMAGE")
data.Data["CNIPluginsImage"] = os.Getenv("CNI_PLUGINS_IMAGE")
data.Data["SDNControllerImage"] = os.Getenv("SDN_CONTROLLER_IMAGE")
data.Data["KUBERNETES_SERVICE_HOST"] = os.Getenv("KUBERNETES_SERVICE_HOST")
data.Data["KUBERNETES_SERVICE_PORT"] = os.Getenv("KUBERNETES_SERVICE_PORT")
data.Data["Mode"] = c.Mode
Expand Down

0 comments on commit 4981873

Please sign in to comment.