Documentation for dev env setup

This change:
- Updates the README with an explanation of SIP and ViNO, and steps
  to setting up a development environment for ViNO using the Airship
  charts/tools/gate/deploy-k8s.sh script
- Updates the Dockerfile to create a working ViNO image
- Updates the management Deployment to use the new image, and only
  pull that image if it is not present

Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
Change-Id: I6fbdd3302d49a65f05b20ec9593f500df23f1b33
This commit is contained in:
Alexander Hughes 2020-12-21 12:45:08 -05:00
parent d4686cebe5
commit f4336c9336
5 changed files with 141 additions and 7 deletions

View File

@ -1,5 +1,7 @@
# Build the manager binary
FROM golang:1.13 as builder
FROM gcr.io/gcp-runtimes/go1-builder:1.13 as builder
ENV PATH "/usr/local/go/bin:$PATH"
WORKDIR /workspace
# Copy the Go Modules manifests
@ -14,6 +16,7 @@ COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go

View File

@ -1,6 +1,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# IMG ?= controller:latest
IMG ?= quay.io/airshipit/vino
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
@ -17,6 +18,11 @@ else
GOBIN=$(shell go env GOBIN)
endif
# Docker proxy flags
DOCKER_PROXY_FLAGS := --build-arg http_proxy=$(HTTP_PROXY)
DOCKER_PROXY_FLAGS += --build-arg https_proxy=$(HTTPS_PROXY)
DOCKER_PROXY_FLAGS += --build-arg NO_PROXY=$(NO_PROXY)
all: manager
# Run tests
@ -61,8 +67,9 @@ generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
# Build the docker image
docker-build: test
docker build . -t ${IMG}
# If DOCKER_PROXY_FLAGS values are empty, we are fine with that
docker-build:
docker build ${DOCKER_PROXY_FLAGS} . -t ${IMG}
# Push the docker image
docker-push:

120
README.md
View File

@ -1 +1,119 @@
# vino
# ViNO Cluster Operator
[![Docker Repository on Quay](https://quay.io/repository/airshipit/vino/status "Docker Repository on Quay")](https://quay.io/repository/airshipit/vino)
## Overview
The lifecycle of the Virtual Machines and their relationship to the Kubernetes cluster will be
managed using two operators: vNode-Operator(ViNO), and the Support Infra Provider Operator (SIP).
## Description
ViNO is responsible for setting up VM infrastructure, such as:
- per-node vino pod:
* libvirt init, e.g.
* setup vm-infra bridge
* provisioning tftp/dhcp definition
* libvirt launch
* sushi pod
- libvirt domains
- networking
- bmh objects, with labels:
* location - i.e. `rack: 8` and `node: rdm8r008c002` - should follow k8s semi-standard
* vm role - i.e. `node-type: worker`
* vm flavor - i.e `node-flavor: foobar`
* networks - i.e. `networks: [foo, bar]`
and the details for ViNO can be found [here](https://hackmd.io/KSu8p4QeTc2kXIjlrso2eA)
The Cluster Support Infrastructure Provider, or SIP, is responsible for the lifecycle of:
- identifying the correct `BareMetalHost` resources to label (or unlabel) based on scheduling
constraints.
- extract IP address information from `BareMetalHost` objects to use in the creation of supporting
infrastructure.
- creating support infra for the tenant k8s cluster:
* load balancers (for tenant Kubernetes API)
* jump pod to access the cluster and nodes via ssh
* an OIDC provider for the tenant cluster, i.e. Dex
* potentially more in the future
## Development Environment
### Pre-requisites
#### Install Golang 1.15+
ViNO is a project written in Go, and the make targets used to deploy ViNO leverage both Go and
Kustomize commands which require Golang be installed.
For detailed installation instructions, please see the [Golang installation guide](https://golang.org/doc/install).
#### Install Kustomize v3.2.3+
In order to apply manifests to your cluster via Make targets we suggest the use of Kustomize.
For detailed installation instructions, please see the [Kustomize installation guide](https://kubectl.docs.kubernetes.io/installation/kustomize/).
#### Proxy Setup
If your organization requires development behind a proxy server, you will need to define the
following environment variables with your organization's information:
```
HTTP_PROXY=http://username:password@host:port
HTTPS_PROXY=http://username:password@host:port
NO_PROXY="localhost,127.0.0.1,10.96.0.0/12"
PROXY=http://username:password@host:port
USE_PROXY=true
```
10.96.0.0/12 is the Kubernetes service CIDR.
### Deploy ViNO
Airship projects often have to deploy Kubernetes, with common requirements such as supporting
network policies or working behind corporate proxies. To that end the community maintains a
Kubernetes deployment script and is the suggested way of deploying your Kubernetes cluster for
development purposes.
#### Deploy Kubernetes
```
# curl -Lo deploy-k8s.sh https://opendev.org/airship/charts/raw/branch/master/tools/gate/deploy-k8s.sh
# chmod +x deploy-k8s.sh
# sudo ./deploy-k8s.sh
```
#### Deploy ViNO
Once your cluster is up and running, you'll need to build the ViNO image to use, and to deploy the
operator on your cluster:
```
# make docker-build
# make deploy
```
Once these steps are completed, you should have a working cluster with ViNO deployed on top of it:
```
# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-7985fc4dd6-6q5l4 1/1 Running 0 3h7m
kube-system calico-node-lqzxp 1/1 Running 0 3h7m
kube-system coredns-f9fd979d6-gbdzl 1/1 Running 0 3h7m
kube-system etcd-ubuntu-virtualbox 1/1 Running 0 3h8m
kube-system kube-apiserver-ubuntu-virtualbox 1/1 Running 0 3h8m
kube-system kube-controller-manager-ubuntu-virtualbox 1/1 Running 0 3h8m
kube-system kube-proxy-ml4gd 1/1 Running 0 3h7m
kube-system kube-scheduler-ubuntu-virtualbox 1/1 Running 0 3h8m
kube-system storage-provisioner 1/1 Running 0 3h8m
vino-system vino-controller-manager-788b994c74-sbf26 2/2 Running 0 25m
```
## Get in Touch
For any questions on the ViNo, or other Airship projects, we encourage you to join the community on
Slack/IRC or by participating in the mailing list. Please see this [Wiki](https://wiki.openstack.org/wiki/Airship#Get_in_Touch) for
contact information, and the community meeting schedules.

View File

@ -1,2 +1,7 @@
resources:
- manager.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/airshipit/vino

View File

@ -27,7 +27,8 @@ spec:
- /manager
args:
- --enable-leader-election
image: controller:latest
image: quay.io/airshipit/vino
imagePullPolicy: IfNotPresent
name: manager
resources:
limits: