Skip to content

Commit

Permalink
ci(actions): start minikube & install tackle
Browse files Browse the repository at this point in the history
Re-usable actions suitable for starting minikube and installing tackle.
  • Loading branch information
djzager committed Sep 2, 2022
1 parent a087c37 commit 28832af
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/actions/install-tackle/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Install tackle operator
description: |
Install Tackle Operator.
inputs:
tackle-operator-index-image:
description: "image url for operator index"
required: false
default: "quay.io/konveyor/tackle2-operator-index:latest"
tackle-hub-image:
description: "image url for tackle-hub"
required: false
default: "quay.io/konveyor/tackle2-hub:latest"
tackle-pathfinder-image:
description: "image url for pathfinder image"
required: false
default: "quay.io/konveyor/tackle-pathfinder:1.3.0-native"
tackle-ui-image:
description: "image url for tackle-ui"
required: false
default: "quay.io/konveyor/tackle2-ui:latest"
tackle-addon-admin-image:
description: "image urd for admin addon"
required: false
default: "quay.io/konveyor/tackle2-addon:latest"
tackle-addon-windup-image:
description: "image url for windup addon"
required: false
default: "quay.io/konveyor/tackle2-addon-windup:latest"
# TODO(djzager): uncomment when supported
# tackle-operator-container-image:
# description: "image url for operator container"
# required: false
# default: "quay.io/konveyor/tackle2-operator:latest"
runs:
using: "composite"
steps:
# TODO(djzager): Need to figure out overriding operator image
# or maybe just installing manager via kustomize.
- name: Install tackle
run: |
export TACKLE_OPERATOR_INDEX_IMAGE="${{ inputs.tackle-operator-index-image }}"
export TACKLE_HUB_IMAGE="${{ inputs.tackle_hub_image }}"
export TACKLE_PATHFINDER_IMAGE="${{ inputs.tackle_pathfinder_image }}"
export TACKLE_UI_IMAGE="${{ inputs.tackle_ui_image }}"
export TACKLE_ADDON_ADMIN_IMAGE="${{ inputs.tackle_addon_admin_image }}"
export TACKLE_ADDON_WINDUP_IMAGE="${{ inputs.tackle_addon_windup_image }}"
make install-tackle
working-directory: ${{ github.action_path }}/../../..
shell: bash
45 changes: 45 additions & 0 deletions .github/actions/start-minikube/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Start minikube
description: |
Start minikube and prepare it for Tackle.
inputs:
driver:
description: 'Choose a specific driver, one of: docker, none, podman, virtualbox, parallels, vmwarefusion, hyperkit, vmware, ssh'
required: false
default: ''
container-runtime:
description: 'Choose a specific container-runtime, one of: docker, containerd, cri-o'
required: false
default: ''
kubernetes-version:
description: 'Choose a specific version of Kubernetes, "stable" for the latest stable build, or "latest" for the latest development build'
required: false
default: ''
cpus:
description: 'Number of CPUs allocated to Kubernetes. Use "max" to use the maximum number of CPUs.'
required: false
default: ''
memory:
description: 'Amount of RAM to allocate to Kubernetes (format: <number>[<unit>], where unit = b, k, m or g). Use "max" to use the maximum amount of memory.'
required: false
default: ''
cni:
description: 'CNI plug-in to use. Valid options: auto, bridge, calico, cilium, flannel, kindnet, or path to a CNI manifest'
required: false
default: 'auto'
runs:
using: "composite"
steps:
- name: Setup minikube
uses: medyagh/setup-minikube@master
with:
driver: ${{ inputs.driver }}
container-runtime: ${{ inputs.container-runtime }}
kubernetes-version: ${{ inputs.kubernetes-version }}
cpus: ${{ inputs.cpus }}
memory: ${{ inputs.memory }}
cni: ${{ inputs.cni }}
# Don't pass minikube start ${ARGS} as they are handled in setup-minikube
- name: Start minikube
run: make start-minikube
working-directory: ${{ github.action_path }}/../../..
shell: bash
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,11 @@ catalog-build: opm ## Build a catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)

.PHONY: start-minikube
start-minikube:
export PATH=$(shell pwd)/bin:$$PATH; $(shell pwd)/hack/start-minikube.sh

.PHONY: install-tackle
install-tackle:
export PATH=$(shell pwd)/bin:$$PATH; $(shell pwd)/hack/install-tackle.sh
91 changes: 91 additions & 0 deletions hack/install-tackle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash

set -e
set -x

TACKLE_OPERATOR_INDEX_IMAGE="${TACKLE_OPERATOR_INDEX_IMAGE:-quay.io/konveyor/tackle2-operator-index:latest}"
TACKLE_HUB_IMAGE="${TACKLE_HUB_IMAGE:-quay.io/konveyor/tackle2-hub:latest}"
TACKLE_PATHFINDER_IMAGE="${TACKLE_PATHFINDER_IMAGE:-quay.io/konveyor/tackle-pathfinder:1.3.0-native}"
TACKLE_UI_IMAGE="${TACKLE_UI_IMAGE:-quay.io/konveyor/tackle2-ui:latest}"
TACKLE_ADDON_ADMIN_IMAGE="${TACKLE_ADDON_ADMIN_IMAGE:-quay.io/konveyor/tackle2-addon:latest}"
TACKLE_ADDON_WINDUP_IMAGE="${TACKLE_ADDON_WINDUP_IMAGE:-quay.io/konveyor/tackle2-addon-windup:latest}"

TACKLE_FEATURE_AUTH_REQUIRED="${TACKLE_FEATURE_AUTH_REQUIRED:-false}"

if ! command -v kubectl >/dev/null 2>&1; then
echo "Please install kubectl"
exit 1
fi

# Create namespace
cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Namespace
metadata:
name: konveyor-tackle
EOF

# Create catalogsource
cat << EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: konveyor-tackle
namespace: konveyor-tackle
spec:
displayName: Tackle Operator
publisher: Konveyor
sourceType: grpc
image: ${TACKLE_OPERATOR_INDEX_IMAGE}
EOF

# Create operatorgroup
cat << EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: konveyor-tackle
namespace: konveyor-tackle
spec:
targetNamespaces:
- konveyor-tackle
EOF

# Create, and wait for, subscription
cat << EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: tackle-operator
namespace: konveyor-tackle
spec:
channel: development
installPlanApproval: Automatic
name: tackle-operator
source: konveyor-tackle
sourceNamespace: konveyor-tackle
EOF
timeout 300s bash -c 'kubectl --namespace=konveyor-tackle get subscriptions.operators.coreos.com tackle-operator'

# Create, and wait for, tackle
kubectl --namespace konveyor-tackle wait \
--for=condition=established \
customresourcedefinitions.apiextensions.k8s.io/tackles.tackle.konveyor.io
cat <<EOF | kubectl apply -f -
kind: Tackle
apiVersion: tackle.konveyor.io/v1alpha1
metadata:
name: tackle
namespace: konveyor-tackle
spec:
feature_auth_required: ${TACKLE_FEATURE_AUTH_REQUIRED}
hub_image_fqin: ${TACKLE_HUB_IMAGE}
pathfinder_image_fqin: ${TACKLE_PATHFINDER_IMAGE}
ui_image_fqin: ${TACKLE_UI_IMAGE}
admin_fqin: ${TACKLE_ADDON_ADMIN_IMAGE}
windup_fqin: ${TACKLE_ADDON_WINDUP_IMAGE}
EOF
kubectl --namespace konveyor-tackle wait \
--for=condition=Successful \
--timeout=300s \
tackle.tackle.konveyor.io/tackle
42 changes: 42 additions & 0 deletions hack/start-minikube.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set +x

# Inputs via environment variables
MINIKUBE_DRIVER="${MINIKUBE_DRIVER:-}"
MINIKUBE_CONTAINER_RUNTIME="${MINIKUBE_CONTAINER_RUNTIME:-}"
MINIKUBE_KUBERNETES_VERSION="${MINIKUBE_KUBERNETES_VERSION:-}"
MINIKUBE_CPUS="${MINIKUBE_CPUS:-}"
MINIKUBE_MEMORY="${MINIKUBE_MEMORY:-}"
MINIKUBE_CNI="${MINIKUBE_CNI:-}"

# Check pre-reqs
# May want to leave this for the user to install
if ! command -v minikube >/dev/null 2>&1; then
echo "Please install minikube"
exit 1
fi

# Start minikube if not already started
if ! minikube status; then
ARGS=""
[ -z "${MINIKUBE_DRIVER}" ] || \
ARGS+=" --driver=${MINIKUBE_DRIVER}"
[ -z "${MINIKUBE_CONTAINER_RUNTIME}" ] || \
ARGS+=" --container-runtime=${MINIKUBE_CONTAINER_RUNTIME}"
[ -z "${MINIKUBE_KUBERNETES_VERSION}" ] || \
ARGS+=" --kubernetes-version=${MINIKUBE_KUBERNETES_VERSION}"
[ -z "${MINIKUBE_CPUS}" ] || \
ARGS+=" --cpus=${MINIKUBE_CPUS}"
[ -z "${MINIKUBE_MEMORY}" ] || \
ARGS+=" --memory=${MINIKUBE_MEMORY}"
[ -z "${MINIKUBE_CNI}" ] || \
ARGS+=" --cni=${MINIKUBE_CNI}"
set -x
minikube start ${ARGS}
fi

# Enable ingress
minikube addons enable ingress

# Enable OLM
minikube addons enable olm

0 comments on commit 28832af

Please sign in to comment.