Deploy Calico using Tigera Operator

* Migrate the Calico function in airshipctl to deploy the
  Tigera Operator, instead of raw manifests
* Added a new executor `kubernetes-apply-nowait` to run phase with nowait
* nowait had to be done for phase `initinfra-networking-<ephemeral/target>`
  because of an issue with phase status-check for a specific resource
  `installation` which is part of tigera operator CR

Change-Id: I748813667cdc5d05c9f0758d9c1e28082d79bdbe
Closes: #368
This commit is contained in:
Sirajudeen 2020-11-16 04:08:45 +00:00
parent 30e69fedf5
commit f212cfd55b
15 changed files with 4509 additions and 5 deletions

View File

@ -1,5 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../function/cni/calico/v3
- ../../function/cni/tigera-operator/v1.13.0
- ../../function/cert-manager/v1.1.0

View File

@ -0,0 +1,17 @@
Calico Operator
===============
This function contains a Kubernetes operator which manages the lifecycle of a Calico or Calico Enterprise installation on Kubernetes.
* Tigera Calico operator and custom resource definitions are defined in `tigera-operator.yaml`_.
* Calico is installed via tigera operator using `custom-resources.yaml`_ by specifying the default variant of product to be installed.
* The `tigera-operator.yaml`_ is taken from `GitHub URL`_.
* Included Operator version: v1.13.0
* Included Calico version: v3.17.0
To know more about tigera installtion see the `installation reference`_.
.. _tigera-operator.yaml: https://github.com/airshipit/airshipctl/tree/master/manifests/function/tigera-operator/v1.13.0/upstream/tigera-operator.yaml
.. _custom-resources.yaml: https://github.com/airshipit/airshipctl/tree/master/manifests/function/tigera-operator/v1.13.0/custom-resources.yaml
.. _GitHub URL: https://docs.projectcalico.org/manifests/tigera-operator.yaml
.. _installation reference: https://docs.projectcalico.org/getting-started/kubernetes/quickstart

View File

@ -0,0 +1,5 @@
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
name: default
spec: {}

View File

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- upstream
resources:
- custom-resources.yaml

View File

@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- tigera-operator.yaml

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,23 @@ config:
pruneOptions:
prune: false
---
# This is added to support phase with no-wait
# When there is a wait, then it does status-check and fails
# if the resource status(condition) is not met.
# There are cases where the resource do not have status
# field implemeneted. So a wait will fail with status check
apiVersion: airshipit.org/v1alpha1
kind: KubernetesApply
metadata:
labels:
airshipit.org/deploy-k8s: "false"
name: kubernetes-apply-nowait
config:
waitOptions:
timeout: 0
pruneOptions:
prune: false
---
apiVersion: airshipit.org/v1alpha1
kind: Clusterctl
metadata:

View File

@ -23,6 +23,18 @@ config:
---
apiVersion: airshipit.org/v1alpha1
kind: Phase
metadata:
name: initinfra-networking-ephemeral
clusterName: ephemeral-cluster
config:
executorRef:
apiVersion: airshipit.org/v1alpha1
kind: KubernetesApply
name: kubernetes-apply-nowait
documentEntryPoint: ephemeral/initinfra-networking
---
apiVersion: airshipit.org/v1alpha1
kind: Phase
metadata:
name: controlplane-ephemeral
clusterName: ephemeral-cluster
@ -48,6 +60,19 @@ config:
---
apiVersion: airshipit.org/v1alpha1
kind: Phase
metadata:
name: initinfra-networking-target
clusterName: target-cluster
config:
cluster: target-cluster
executorRef:
apiVersion: airshipit.org/v1alpha1
kind: KubernetesApply
name: kubernetes-apply-nowait
documentEntryPoint: target/initinfra-networking
---
apiVersion: airshipit.org/v1alpha1
kind: Phase
metadata:
name: controlplane-target
clusterName: target-cluster

View File

@ -6,9 +6,11 @@ phaseGroups:
- name: group1
phases:
- name: initinfra-ephemeral
- name: initinfra-networking-ephemeral
- name: clusterctl-init-ephemeral
- name: controlplane-ephemeral
- name: initinfra-target
- name: initinfra-networking-target
- name: workers-target
- name: workers-classification
- name: workload-target

View File

@ -0,0 +1,5 @@
resources:
- ../../../../composite/infra/
commonLabels:
airshipit.org/stage: initinfra

View File

@ -2,12 +2,10 @@ resources:
- ../../../../function/baremetal-operator
- ../../../../function/hwcc
- ../../../../function/clusterctl
- ../../../../composite/infra
- ../catalogues
commonLabels:
airshipit.org/stage: initinfra
transformers:
- ../../../../composite/infra/replacements
- ../../../../function/baremetal-operator/replacements

View File

@ -0,0 +1,5 @@
resources:
- ../../../../composite/infra/
commonLabels:
airshipit.org/stage: initinfra

View File

@ -3,14 +3,12 @@ resources:
- ../../../../function/hwcc
- ../../../../function/clusterctl
- ../../../../composite/flux-helm
- ../../../../composite/infra
- ../catalogues
commonLabels:
airshipit.org/stage: initinfra
transformers:
- ../../../../composite/infra/replacements
- ../../../../function/baremetal-operator/replacements
- ../../../../function/flux/source-controller/replacements
- ../../../../function/flux/helm-controller/replacements

View File

@ -17,6 +17,15 @@ set -xe
export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"}
export KUBECONFIG_EPHEMERAL_CONTEXT=${KUBECONFIG_EPHEMERAL_CONTEXT:-"ephemeral-cluster"}
echo "Deploy calico using tigera operator"
airshipctl phase run initinfra-networking-ephemeral --debug
echo "Wait for Calico to be deployed using tigera"
kubectl --kubeconfig $KUBECONFIG --context $KUBECONFIG_EPHEMERAL_CONTEXT wait --all-namespaces --for=condition=Ready pods --all --timeout=1000s
echo "Wait for Tigerastatus to be Available"
kubectl --kubeconfig $KUBECONFIG --context $KUBECONFIG_EPHEMERAL_CONTEXT wait --for=condition=Available tigerastatus --all --timeout=1000s -A
echo "Deploy metal3.io components to ephemeral node"
airshipctl phase run initinfra-ephemeral --debug

View File

@ -18,6 +18,15 @@ export KUBECONFIG=${KUBECONFIG:-"$HOME/.airship/kubeconfig"}
NODENAME="node01"
export KUBECONFIG_TARGET_CONTEXT=${KUBECONFIG_TARGET_CONTEXT:-"target-cluster"}
echo "Deploy calico using tigera operator"
airshipctl phase run initinfra-networking-target --debug
echo "Wait for Calico to be deployed using tigera"
kubectl --kubeconfig $KUBECONFIG --context $KUBECONFIG_TARGET_CONTEXT wait --all-namespaces --for=condition=Ready pods --all --timeout=600s
echo "Wait for Tigerastatus to be available"
kubectl --kubeconfig $KUBECONFIG --context $KUBECONFIG_TARGET_CONTEXT wait --for=condition=Available tigerastatus --all --timeout=600s -A
echo "Deploy infra to cluster"
airshipctl phase run initinfra-target --debug