Merge pull request #1 from teoyaomiqui/dev-env
Add development env automation and documentation
This commit is contained in:
commit
932baf0979
20
Makefile
20
Makefile
@ -6,6 +6,9 @@ IMG ?= quay.io/jezogwza/airship:sip.v2
|
|||||||
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
|
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
|
||||||
CRD_OPTIONS ?= "crd:trivialVersions=true"
|
CRD_OPTIONS ?= "crd:trivialVersions=true"
|
||||||
|
|
||||||
|
# Name of the kind cluster that will be created by kind-create target
|
||||||
|
KIND_CLUSTER_NAME ?= sip-cluster
|
||||||
|
|
||||||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
|
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
|
||||||
ifeq (,$(shell go env GOBIN))
|
ifeq (,$(shell go env GOBIN))
|
||||||
GOBIN=$(shell go env GOPATH)/bin
|
GOBIN=$(shell go env GOPATH)/bin
|
||||||
@ -13,6 +16,11 @@ else
|
|||||||
GOBIN=$(shell go env GOBIN)
|
GOBIN=$(shell go env GOBIN)
|
||||||
endif
|
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
|
all: manager
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
@ -57,14 +65,22 @@ generate: controller-gen
|
|||||||
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
|
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
|
||||||
|
|
||||||
# Build the docker image
|
# Build the docker image
|
||||||
#docker-build: test
|
# If DOCKER_PROXY_FLAGS values are empty, we are fine with that
|
||||||
docker-build:
|
docker-build:
|
||||||
docker build . -t ${IMG}
|
docker build ${DOCKER_PROXY_FLAGS} . -t ${IMG}
|
||||||
|
|
||||||
# Push the docker image
|
# Push the docker image
|
||||||
docker-push:
|
docker-push:
|
||||||
docker push ${IMG}
|
docker push ${IMG}
|
||||||
|
|
||||||
|
# Create kind cluster
|
||||||
|
kind-create:
|
||||||
|
kind create cluster --name ${KIND_CLUSTER_NAME}
|
||||||
|
|
||||||
|
# Build docker container and load it into running kind cluster
|
||||||
|
kind-load-image: docker-build
|
||||||
|
kind load docker-image ${IMG} --name ${KIND_CLUSTER_NAME}
|
||||||
|
|
||||||
# find or download controller-gen
|
# find or download controller-gen
|
||||||
# download controller-gen if necessary
|
# download controller-gen if necessary
|
||||||
controller-gen:
|
controller-gen:
|
||||||
|
43
README.md
43
README.md
@ -68,3 +68,46 @@ Pseudo Algorithm at a high level after reading the `SIPCluster` CR:
|
|||||||
|
|
||||||
SIPCluster CR will exists within the Control phase for a Tenant cluster.
|
SIPCluster CR will exists within the Control phase for a Tenant cluster.
|
||||||
|
|
||||||
|
## Development environment
|
||||||
|
|
||||||
|
### Kind kubernetes cluster
|
||||||
|
Fastest way to set up a k8s cluster for development env is to use kind to set it up
|
||||||
|
|
||||||
|
#### Install kind on linux (amd64 arch)
|
||||||
|
|
||||||
|
```
|
||||||
|
# curl -Lo kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64
|
||||||
|
# sudo install -m 755 --owner=root --group=root kind /usr/local/bin
|
||||||
|
# rm kind
|
||||||
|
```
|
||||||
|
|
||||||
|
More information on how to install kind binary can be found be found [here](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
|
||||||
|
|
||||||
|
#### Create k8s cluster with kind
|
||||||
|
|
||||||
|
```
|
||||||
|
# make kind-create
|
||||||
|
# kubectl get nodes
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deploy sip operator on top of kind cluster
|
||||||
|
kind-load-image target will build docker image from the current state of your local
|
||||||
|
git repository and upload it to kind cluster to be available for kubelet.
|
||||||
|
|
||||||
|
```
|
||||||
|
# make kind-load-image
|
||||||
|
# make deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you have a working k8s cluster with sip installed on it with your changes to SIP operator
|
||||||
|
|
||||||
|
### Deliver sip CRs to kubernetes
|
||||||
|
|
||||||
|
Use kubectl apply to deliver SIP CRs and BaremetalHost CRDs to kubernetes cluster
|
||||||
|
|
||||||
|
```
|
||||||
|
# kubectl apply -f config/samples/airship_v1beta1_sipcluster.yaml
|
||||||
|
# kubectl apply -f config/samples/bmh/baremetalhosts.metal3.io.yaml
|
||||||
|
```
|
||||||
|
Now you are ready to craft and add BaremetalHost CRs into cluster, check samples directory
|
||||||
|
to find BaremetalHost examples there.
|
||||||
|
@ -28,7 +28,7 @@ spec:
|
|||||||
args:
|
args:
|
||||||
- --enable-leader-election
|
- --enable-leader-election
|
||||||
image: quay.io/jezogwza/airship:sip.v1
|
image: quay.io/jezogwza/airship:sip.v1
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: IfNotPresent
|
||||||
name: manager
|
name: manager
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
|
@ -2,7 +2,7 @@ apiVersion: airship.airshipit.org/v1
|
|||||||
kind: SIPCluster
|
kind: SIPCluster
|
||||||
metadata:
|
metadata:
|
||||||
name: sipcluster-test1
|
name: sipcluster-test1
|
||||||
namespace: sip-cluster-system
|
namespace: sipcluster-system
|
||||||
spec:
|
spec:
|
||||||
config:
|
config:
|
||||||
cluster-name: cname
|
cluster-name: cname
|
||||||
|
Loading…
x
Reference in New Issue
Block a user