-
Notifications
You must be signed in to change notification settings - Fork 56
Building NGINX Ingress Controller
aborkar-ibm edited this page Nov 13, 2018
·
31 revisions
The instructions provided below specify the steps to build NGINX Ingress Controller version 0.20.0 on Linux on IBM Z for following distributions:
- RHEL (7.3, 7.4, 7.5)
- SLES (12 SP3, 15)
- Ubuntu (16.04, 18.04)
- For testing and deploying NGINX Ingress Controller, you must have Kubernetes installed. At the time of creation of these build instructions NGINX Ingress Controller was verified using Kubernetes version 1.12.2.
- You should also have a local configured copy of kubectl. Download Kubernetes binary from Kubernetes.
General Notes:
- When following the steps below please use a standard permission user unless otherwise specified.
- A directory
/<source_root>/
will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
-
RHEL (7.3, 7.4, 7.5)
sudo yum install -y git make
-
SLES (12 SP3, 15)
sudo zypper install -y git make
-
Ubuntu (16.04, 18.04)
sudo apt-get update sudo apt-get install git make golang-1.10 export PATH=/usr/lib/go-1.10/bin:$PATH
-
Go ( Only for RHEL and SLES ) -- Instructions for building Go can be found here
export GOPATH=/<source_root>/
export DOCKER=docker
mkdir -p $GOPATH/src/k8s.io/
cd $GOPATH/src/k8s.io/
git clone https://github.com/kubernetes/ingress-nginx.git
cd ingress-nginx/
git checkout nginx-0.20.0
- Make changes to
$GOPATH/src/k8s.io/ingress-nginx/images/e2e/Dockerfile
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM quay.io/kubernetes-ingress-controller/nginx-amd64:0.63
+FROM quay.io/kubernetes-ingress-controller/nginx-s390x:0.63
RUN clean-install \
g++ \
@@ -26,8 +26,8 @@
pkg-config
ENV GOLANG_VERSION 1.11
-ENV GO_ARCH linux-amd64
-ENV GOLANG_SHA b3fcf280ff86558e0559e185b601c9eade0fd24c900b4c63cd14d1d38613e499
+ENV GO_ARCH linux-s390x
+ENV GOLANG_SHA c113495fbb175d6beb1b881750de1dd034c7ae8657c30b3de8808032c9af0a15
RUN set -eux; \
url="https://golang.org/dl/go${GOLANG_VERSION}.${GO_ARCH}.tar.gz"; \
- Build e2e image for s390x
cd $GOPATH/src/k8s.io/ingress-nginx/images/e2e/
make docker-build
- Make changes to
$GOPATH/src/k8s.io/ingress-nginx/build/go-in-docker.sh
@@ -40,7 +40,8 @@
exit 1
fi
-E2E_IMAGE=quay.io/kubernetes-ingress-controller/e2e:v10042018-c8abff1
+IMAGE_TAG=$(sudo docker images | grep e2e | awk '{print $2}')
+E2E_IMAGE=quay.io/kubernetes-ingress-controller/e2e:$IMAGE_TAG
DOCKER_OPTS=${DOCKER_OPTS:-""}
- Build NGINX Ingress Controller with the new image
cd $GOPATH/src/k8s.io/ingress-nginx/
make build ARCH=s390x
- Make changes to
$GOPATH/src/k8s.io/ingress-nginx/build/test.sh
@@ -23,5 +23,5 @@
exit 1
fi
-go test -v -race -tags "cgo" \
+go test -v -tags "cgo" \
$(go list ${PKG}/... | grep -v vendor | grep -v '/test/e2e' | grep -v images | grep -v "docs/examples")
- Run test cases
cd $GOPATH/src/k8s.io/ingress-nginx/
make test ARCH=s390x
The following resources are required to deploy the ingress controller onto a cluster.
- Make changes to
$GOPATH/src/k8s.io/ingress-nginx/deploy/default-backend.yaml
@@ -24,7 +24,7 @@
# Any image is permissible as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
- image: k8s.gcr.io/defaultbackend-amd64:1.5
+ image: k8s.gcr.io/defaultbackend-s390x:1.4
livenessProbe:
httpGet:
path: /healthz
- Make changes to
$GOPATH/src/k8s.io/ingress-nginx/deploy/with-rbac.yaml
@@ -24,7 +24,7 @@
serviceAccountName: nginx-ingress-serviceaccount
containers:
- name: nginx-ingress-controller
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.20.0
+ image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller-s390x:0.20.0
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
- Deployment
cd $GOPATH/src/k8s.io/ingress-nginx/deploy/
kubectl apply -f namespace.yaml
kubectl apply -f default-backend.yaml
kubectl apply -f configmap.yaml
kubectl apply -f tcp-services-configmap.yaml
kubectl apply -f udp-services-configmap.yaml
- Install with RBAC roles
cd $GOPATH/src/k8s.io/ingress-nginx/deploy/
kubectl apply -f rbac.yaml
kubectl apply -f with-rbac.yaml
POD_NAMESPACE=ingress-nginx
POD_NAME=$(kubectl get pods --all-namespaces | grep nginx-ingress-controller | awk '{print $2}')
kubectl exec -it $POD_NAME -n $POD_NAMESPACE -- /nginx-ingress-controller --version
Output should be:
-------------------------------------------------------------------------------
NGINX Ingress controller
Release: 0.20.0
Build: git-e8d8103
Repository: https://github.com/kubernetes/ingress-nginx.git
-------------------------------------------------------------------------------
After execution of above steps, below images will be created:
quay.io/kubernetes-ingress-controller/e2e
k8s.gcr.io/defaultbackend-s390x
quay.io/kubernetes-ingress-controller/nginx-ingress-controller-s390x
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.