Skip to content

Commit

Permalink
Merge pull request #87 from vprashar2929/remove-micorshift
Browse files Browse the repository at this point in the history
chore: remove microshift installation
  • Loading branch information
SamYuan1990 authored Jun 21, 2024
2 parents 04139fd + f773231 commit a3aaeb6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 205 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/TagReminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
with:
title: AutoBumpUpVersionReminder
body: |-
:wave: Hi maintainers, please remind to bump version for kind, microshift or any dependency for github action!
:wave: Hi maintainers, please remind to bump version for kind or any dependency for github action!
pinned: true
12 changes: 0 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ jobs:
GRAFANA_ENABLE: true
TEKTON_ENABLE: true
LOADPROMETHEUSIMAGE: true
- cluster_provider: microshift
prometheus_operator_version: v0.12.0
PROMETHEUS_ENABLE: false
GRAFANA_ENABLE: false
TEKTON_ENABLE: false
LOADPROMETHEUSIMAGE: true
- cluster_provider: microshift
prometheus_operator_version: v0.12.0
PROMETHEUS_ENABLE: true
GRAFANA_ENABLE: true
TEKTON_ENABLE: false
LOADPROMETHEUSIMAGE: true
steps:
- uses: actions/checkout@v3
- name: start from local
Expand Down
22 changes: 3 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![GitHub](https://img.shields.io/github/license/sustainable-computing-io/local-dev-cluster)
[![units-test](https://github.com/sustainable-computing-io/local-dev-cluster/actions/workflows/test.yml/badge.svg)](https://github.com/sustainable-computing-io/local-dev-cluster/actions/workflows/test.yml)

This repo provides the scripts to create a local [kubernetes](kind/kind.sh)/[openshift](microshift/microshift.sh)
This repo provides the scripts to create a local [kubernetes](kind/kind.sh)
cluster to be used for development or integration tests. It is also used in
[Github action](https://github.com/sustainable-computing-io/kepler-action) for kepler.

Expand Down Expand Up @@ -39,23 +39,13 @@ Will setup container runtime on your host instance.

1. Modify kind [config](./kind/manifests/kind.yml) to make sure `extraMounts:` cover
the linux header and BCC.
1. Export `CLUSTER_PROVIDER` env variable:

```bash
export CLUSTER_PROVIDER=kind

or

export CLUSTER_PROVIDER=microshift
```

1. To setup local env run:
2. To setup local env run:

```bash
./main.sh up
```

1. To tear down local env run:
3. To tear down local env run:

```bash
./main.sh down
Expand All @@ -67,8 +57,6 @@ Will setup container runtime on your host instance.
```sh
#.env
CLUSTER_PROVIDER=microshift
CLUSTER_NAME=microshift
PROMETHEUS_ENABLE=false
GRAFANA_ENABLE=false
TEKTON_ENABLE=false
Expand All @@ -81,10 +69,6 @@ Will setup container runtime on your host instance.
./main.sh up
```

1. kubeconfig

Following the hint on your terminal to find out the kubeconfig.

## Container registry

There's a container registry available which is exposed at `localhost:5001`.
Expand Down
28 changes: 12 additions & 16 deletions lib/prometheus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare -r MONITORING_NS="monitoring"
declare -r DASHBOARD_DIR="$KUBE_PROM_DIR/grafana-dashboards"
declare KEPLER_EXPORTER_GRAFANA_DASHBOARD_JSON

KEPLER_EXPORTER_GRAFANA_DASHBOARD_JSON=$( curl -fsSL https://raw.githubusercontent.com/sustainable-computing-io/kepler/main/grafana-dashboards/Kepler-Exporter.json | sed '1 ! s/^/ /' )
KEPLER_EXPORTER_GRAFANA_DASHBOARD_JSON=$(curl -fsSL https://raw.githubusercontent.com/sustainable-computing-io/kepler/main/grafana-dashboards/Kepler-Exporter.json | sed '1 ! s/^/ /')

deploy_prometheus_operator() {

Expand Down Expand Up @@ -96,11 +96,7 @@ _load_prometheus_operator_images_to_local_registry() {

header "Load prometheus operator images to local registry"
local registry
if [[ "$CLUSTER_PROVIDER" == "kind" ]]; then
registry="localhost:${REGISTRY_PORT}"
else
registry="${MICROSHIFT_REGISTRY_NAME}:5000"
fi
registry="localhost:${REGISTRY_PORT}"

local updated_image
for img in $(_get_prometheus_operator_images); do
Expand All @@ -118,13 +114,13 @@ _load_prometheus_operator_images_to_local_registry() {
done
}

_setup_dashboard_configmap(){
_setup_dashboard_configmap() {
if [ -f "$DASHBOARD_DIR/grafana-dashboards/kepler-exporter-configmap.yaml" ]; then
return 0
else
header "Create Dashboard Configmap"
mkdir -p "$DASHBOARD_DIR/grafana-dashboards/"
cat - > "$DASHBOARD_DIR/grafana-dashboards/kepler-exporter-configmap.yaml" << EOF
header "Create Dashboard Configmap"
mkdir -p "$DASHBOARD_DIR/grafana-dashboards/"
cat - >"$DASHBOARD_DIR/grafana-dashboards/kepler-exporter-configmap.yaml" <<EOF
apiVersion: v1
data:
kepler-exporter.json: |-
Expand All @@ -139,22 +135,22 @@ metadata:
name: grafana-dashboard-kepler-exporter
namespace: monitoring
EOF
fi
ok "Create Dashboard Configmap"
fi
ok "Create Dashboard Configmap"
}

_add_dashboard_to_grafana() {
header "Edit Kepler Grafana Dashboard "
header "Edit Kepler Grafana Dashboard "
f="$DASHBOARD_DIR/grafana-dashboards/kepler-exporter-configmap.yaml" \
yq -i e '.items += [load(env(f))]' "$KUBE_PROM_DIR"/manifests/grafana-dashboardDefinitions.yaml;
yq -i e '.items += [load(env(f))]' "$KUBE_PROM_DIR"/manifests/grafana-dashboardDefinitions.yaml
yq -i e '.spec.template.spec.containers.0.volumeMounts += [ {"mountPath": "/grafana-dashboard-definitions/0/kepler-exporter", "name": "grafana-dashboard-kepler-exporter", "readOnly": false} ]' "$KUBE_PROM_DIR"/manifests/grafana-deployment.yaml
yq -i e '.spec.template.spec.volumes += [ {"configMap": {"name": "grafana-dashboard-kepler-exporter"}, "name": "grafana-dashboard-kepler-exporter"} ]' "$KUBE_PROM_DIR"/manifests/grafana-deployment.yaml;
yq -i e '.spec.template.spec.volumes += [ {"configMap": {"name": "grafana-dashboard-kepler-exporter"}, "name": "grafana-dashboard-kepler-exporter"} ]' "$KUBE_PROM_DIR"/manifests/grafana-deployment.yaml
ok "Dashboard setup complete"
}

_deploy_grafana() {
header "Deploy Grafana"
find kube-prometheus/manifests -name 'grafana-*.yaml' -type f \
-exec kubectl create -f {} \;
-exec kubectl create -f {} \;
ok "Grafana deployed"
}
12 changes: 5 additions & 7 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ declare -r PROJECT_ROOT CALLER_PROJECT_ROOT
# NOTE: define environment variables in this file to set the defaults
#
# CTR_CMD=podman
# CLUSTER_PROVIDER=microshift
#
# # 💡 tip: honor env variables if set explicitly using the technique below
# # This allows PROMETHEUS_ENABLE=true ./main.sh up to override the
Expand Down Expand Up @@ -72,7 +71,7 @@ config_cluster() {
if is_set "$TEKTON_ENABLE"; then
kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
rollout_ns_status tekton-pipelines
rollout_ns_status tekton-pipelines-resolvers
rollout_ns_status tekton-pipelines-resolvers
fi

# install kubevirt per https://kubevirt.io/quickstart_kind/
Expand Down Expand Up @@ -156,7 +155,7 @@ linuxHeader() {

ebpf() {
if [ -f /usr/bin/apt-get ]; then
sudo apt-get install -y binutils-dev build-essential pkg-config libelf-dev
sudo apt-get install -y binutils-dev build-essential pkg-config libelf-dev
mkdir -p temp-libbpf
cd temp-libbpf
git clone -b "$LIBBPF_VERSION" https://github.com/libbpf/libbpf
Expand Down Expand Up @@ -217,9 +216,9 @@ containerruntime() {
chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" |
tee /etc/apt/sources.list.d/docker.list >/dev/null
apt-get update -y
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
fi
Expand All @@ -245,7 +244,6 @@ main() {
}

# shellcheck source=providers/kind/kind.sh
# shellcheck source=providers/microshift/microshift.sh

case "$1" in
prerequisites)
Expand Down
150 changes: 0 additions & 150 deletions providers/microshift/microshift.sh

This file was deleted.

0 comments on commit a3aaeb6

Please sign in to comment.