Skip to content

Commit 267c996

Browse files
committed
implement working docker extension for kanvas
Signed-off-by: aabidsofi19 <[email protected]>
1 parent 0fa3505 commit 267c996

File tree

85 files changed

+40223
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+40223
-88
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ui/node_modules
2+
# **/node_modules
3+
# npm-debug.log
4+
# Dockerfile*
5+
# .dockerignore
6+
# .git
7+
# .gitignore
8+
# README.md
9+
# LICENSE
10+
# .vscode

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto

.github/build/Makefile.core.mk

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
GIT_VERSION = $(shell git describe --tags `git rev-list --tags --max-count=1`)
1919
GIT_COMMITSHA = $(shell git rev-list -1 HEAD)
2020
GIT_STRIPPED_VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1` | cut -c 2-)
21-
22-
# Extension Point for remote provider . Add your provider here.
2321
REMOTE_PROVIDER="Layer5"
24-
2522
LOCAL_PROVIDER="None"
2623
GOVERSION = 1.23
2724
GOPATH = $(shell go env GOPATH)
@@ -39,17 +36,12 @@ SHELL := /usr/bin/env bash -o pipefail
3936
ADAPTER_URLS := "localhost:10000 localhost:10001 localhost:10012 localhost:10013"
4037

4138
#-----------------------------------------------------------------------------
42-
# Providers (Add your provider here. See https://docs.meshery.io/extensibility/providers)
39+
# Providers
4340
#-----------------------------------------------------------------------------
4441
REMOTE_PROVIDER_LOCAL="http://localhost:9876"
45-
EQUINIX_DEV="http://meshery.console.equinix.com"
46-
EQUINIX_DEV2="http://meshery-2.console.equinix.com"
4742
MESHERY_CLOUD_DEV="http://localhost:9876"
4843
MESHERY_CLOUD_PROD="https://cloud.layer5.io"
4944
MESHERY_CLOUD_STAGING="https://staging-cloud.layer5.io"
50-
EXOSCALE_PROD="https://sks.exoscale.com"
51-
EXOSCALE_STG="https://stg-sks.exoscale.com"
52-
EXOSCALE_DEV="https://dev-sks.exoscale.com"
5345

5446
#-----------------------------------------------------------------------------
5547
# Server
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# See <https://gist.github.com/klmr/575726c7e05d8780505a> for explanation.
33
.PHONY: show-help
44
show-help:
5-
@echo "$$(tput bold)Please specify a build target. The choices are:$$(tput sgr0)";echo;sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|LC_ALL='C' sort -f|awk -F --- -v n=$$(tput cols) -v i=19 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'|more $(shell test $(shell uname) == Darwin && echo '-Xr')
5+
@echo "$$(tput bold)Please specify a build target. The choices are:$$(tput sgr0)";echo;sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|LC_ALL='C' sort -f|awk -F --- -v n=$$(tput cols) -v i=19 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'|more $(shell test $(shell uname) == Darwin && echo '-Xr')

Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM golang:1.23-alpine AS builder
2+
ENV CGO_ENABLED=0
3+
RUN apk update && apk add gcc libc-dev make
4+
WORKDIR /backend
5+
COPY go.* .
6+
ARG TARGETARCH
7+
RUN --mount=type=cache,target=/go/pkg/mod \
8+
--mount=type=cache,target=/root/.cache/go-build \
9+
go mod download
10+
COPY . .
11+
RUN --mount=type=cache,target=/go/pkg/mod \
12+
--mount=type=cache,target=/root/.cache/go-build \
13+
make bin
14+
15+
FROM node:14.17-alpine3.13 AS client-builder
16+
WORKDIR /ui
17+
# cache packages in layer
18+
COPY ui/package.json ui/package-lock.json ./
19+
ARG TARGETARCH
20+
RUN --mount=type=cache,target=/root/.npm \
21+
npm ci
22+
# install
23+
COPY ui /ui
24+
RUN npm run build
25+
26+
FROM alpine
27+
ARG GIT_STRIPPED_VERSION
28+
ARG GIT_VERSION
29+
ARG RELEASE_CHANNEL
30+
LABEL org.opencontainers.image.title="Meshery" \
31+
org.opencontainers.image.description="Meshery, the collaborative Kubernetes manager. Go multi-player as you design and operate your cloud native infrastructure with teammates." \
32+
org.opencontainers.image.vendor="Layer5, Inc." \
33+
com.docker.desktop.extension.api.version=">= 0.2.0" \
34+
com.docker.extension.screenshots="[ \
35+
{ \
36+
\"alt\": \"Meshery Docker Extension\", \
37+
\"url\": \"https://raw.githubusercontent.com/meshery/meshery/master/install/docker-extension/docs/img/meshmap-docker-extension-for-meshery.png\" \
38+
},{ \
39+
\"alt\": \"Meshery Docker Extension\", \
40+
\"url\": \"https://raw.githubusercontent.com/meshery/meshery/master/install/docker-extension/docs/img/Docker-extension-meshery.png\" \
41+
} \
42+
]" \
43+
com.docker.extension.detailed-description="\
44+
<h2>Visually and collaboratively design and operate your Kubernetes clusters (<a href='https://meshery.io/catalog'>video</a>).</h2> \
45+
<p>The Meshery Docker Extension is your cloud native infrastructure designer, complete with multi-cluster Kubernetes management. Meshery provides cloud native engineers with visual and collaborative interface to designing and operating cloud native infrastructure.</p> \
46+
<ul> \
47+
<li><b>Discovery of your Kubernetes environments</b> - Meshery is a multi-cluster manager and will scan your kubeconfig, allowing you to select which of your Kubernetes contexts to connect. Switch from one K8s cluster to the next or manage multiple concurrently.</li> \
48+
<li><b>Support for your Docker Compose apps -</b> Import your Docker Compose apps. Configure and deploy them to Kubernetes.</li> \
49+
<li><b>Visual designer for Docker Compose apps, Helm charts, and Kubernetes manifests -</b> No code, visual topology for designing Docker Compose applications, operating Kubernetes and their workloads.</li> \
50+
<li><b>Save time with design patterns - </b>Turbo-charge your infrastructure with best practice cloud native design patterns from the <a href='https://meshery.io/catalog'>Meshery Catalog</a>.</li> \
51+
<li><b>Single-click deployment of all cloud native infrastructure -</b> Support for hundreds of different cloud native infrastructure tools right at your fingertips.</li> \
52+
</ul>" \
53+
com.docker.desktop.extension.icon="https://raw.githubusercontent.com/meshery/meshery/master/install/docker-extension/docs/img/meshery-logo-light.svg" \
54+
com.docker.extension.publisher-url="https://meshery.io" \
55+
com.docker.extension.additional-urls="[{\"title\":\"Documentation\",\"url\":\"https://docs.meshery.io\"},{\"title\":\"Project\",\"url\":\"https://layer5.io/meshery\"},{\"title\":\"Slack\",\"url\":\"https://slack.meshery.io\"},{\"title\":\"Discussion Forum\",\"url\":\"https://meshery.io/community#community-forums\"}]"
56+
COPY --from=builder /backend/bin/service /
57+
COPY docker-compose.yaml .
58+
COPY metadata.json .
59+
COPY meshery-logo-light.svg .
60+
COPY --from=client-builder /ui/build ui
61+
EXPOSE 7877/tcp
62+
CMD ["./service"]

GOVERNANCE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Meshery Governance
2+
3+
See the https://github.com/meshery/meshery repository GOVERNANCE.md document, which defines governance policies for the Meshery project.

MAINTAINERS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Meshery Maintainers
2+
3+
See the https://github.com/meshery/meshery repository MAINTAINERS.md document, which defines governance policies for the Meshery project.

Makefile

Lines changed: 76 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,76 @@
1-
# Copyright Layer5, Inc.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
15-
include .github/build/Makefile.show-help.mk
16-
17-
## Install docs.layer5.io dependencies on your local machine.
18-
## See https://gohugo.io/categories/installation
19-
setup:
20-
npm install
21-
22-
## Run docs.layer5.io on your local machine with draft and future content enabled.
23-
site: check-go
24-
hugo server -D -F
25-
26-
## Run docs.layer5.io on your local machine. Alternate method.
27-
site-fast:
28-
gatsby develop
29-
30-
## Build docs.layer5.io on your local machine.
31-
build:
32-
hugo
33-
34-
## Empty build cache and run docs.layer5.io on your local machine.
35-
clean:
36-
hugo --cleanDestinationDir
37-
make site
38-
39-
.PHONY: setup build site clean site-fast check-go
40-
41-
check-go:
42-
@echo "Checking if Go is installed..."
43-
@command -v go > /dev/null || (echo "Go is not installed. Please install it before proceeding."; exit 1)
44-
@echo "Go is installed."
45-
46-
docker:
47-
docker compose watch
1+
2+
# include ../Makefile.core.mk
3+
# include ../Makefile.show-help.mk
4+
5+
IMAGE?=layer5/kanvas-docker-extension:edge-latest
6+
NAME?=layer5/kanvas-docker-extension
7+
8+
BUILDER=buildx-multi-arch
9+
STATIC_FLAGS=CGO_ENABLED=0
10+
LDFLAGS="-s -w"
11+
GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
12+
13+
GIT_VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`)
14+
GIT_STRIPPED_VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1` | cut -c 2-)
15+
GIT_REF=$(shell git symbolic-ref HEAD)
16+
RELEASE_CHANNEL=$(shell ./release_channel.sh)
17+
18+
release-channel:
19+
GIT_VERSION=$(GIT_VERSION)
20+
GIT_STRIPPED_VERSION=$(GIT_STRIPPED_VERSION)
21+
GIT_REF=$(GIT_REF)
22+
RELEASE_CHANNEL=$(RELEASE_CHANNEL)
23+
24+
## Build the binary for the current platform
25+
bin:
26+
@echo "$(INFO_COLOR)Building...$(NO_COLOR)"
27+
$(GO_BUILD) -o bin/service ./vm
28+
29+
## Build service image to be deployed as a Docker extension
30+
extension:
31+
docker build --tag=$(IMAGE) --build-arg GIT_VERSION=$(GIT_VERSION) --build-arg GIT_STRIPPED_VERSION=$(GIT_STRIPPED_VERSION) .
32+
33+
extension-no-cache:
34+
docker build --tag=$(IMAGE) --no-cache --build-arg GIT_VERSION=$(GIT_VERSION) --build-arg GIT_STRIPPED_VERSION=$(GIT_STRIPPED_VERSION) .
35+
36+
## Create buildx builder for multi-arch build.
37+
prepare-buildx:
38+
docker buildx inspect $(BUILDER) || docker buildx create --name=$(BUILDER) --driver=docker-container --driver-opt=network=host
39+
40+
## Build & Upload extension image to hub. Do not push if tag already exists.
41+
push-extension: prepare-buildx
42+
docker pull $(IMAGE):$(RELEASE_CHANNEL)-$(GIT_VERSION) && echo "Failure: Tag already exists" || \
43+
docker buildx build --push \
44+
--builder=$(BUILDER) --platform=linux/amd64,linux/arm64 \
45+
--build-arg RELEASE_CHANNEL=$(RELEASE_CHANNEL) \
46+
--build-arg GIT_VERSION=$(GIT_VERSION) \
47+
--build-arg GIT_STRIPPED_VERSION=$(GIT_STRIPPED_VERSION) \
48+
--tag=$(IMAGE):$(RELEASE_CHANNEL)-latest \
49+
--tag=$(IMAGE):$(RELEASE_CHANNEL)-$(GIT_VERSION)
50+
--tag=$(GIT_VERSION) .
51+
52+
ui-build:
53+
cd ui/src; npm install; npm run build; cd ../..;
54+
55+
ui:
56+
cd ui/src; npm run start; cd ../..;
57+
# Make easier to debug the UI
58+
link:
59+
docker extension dev ui-source $(IMAGE) http://localhost:3000
60+
docker extension dev debug $(NAME)
61+
reset:
62+
docker extension dev reset $(IMAGE)
63+
64+
install-extension:
65+
docker extension install $(IMAGE) --force
66+
67+
remove-extension:
68+
docker extension remove $(IMAGE) || true
69+
70+
71+
enable-debug-mode:
72+
docker extension dev debug $(NAME)
73+
74+
build-dev: remove-extension extension install-extension enable-debug-mode
75+
76+
.PHONY: prepare-buildx push-extension extension ui bin build-dev enable-debug-mode install-extension

0 commit comments

Comments
 (0)