Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: kumarabd <abishekkumar92@gmail.com>
  • Loading branch information
kumarabd committed Aug 9, 2020
1 parent dba80ce commit adef00b
Show file tree
Hide file tree
Showing 36 changed files with 1,310 additions and 287 deletions.
18 changes: 0 additions & 18 deletions .gitignore

This file was deleted.

73 changes: 0 additions & 73 deletions <adapter>/adapter.go

This file was deleted.

22 changes: 0 additions & 22 deletions <adapter>/client.go

This file was deleted.

5 changes: 0 additions & 5 deletions <adapter>/config_templates/namespace.yml

This file was deleted.

32 changes: 0 additions & 32 deletions <adapter>/supported_ops.go

This file was deleted.

2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@kumarabd
@leecalcote
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Contributing

You want to contribute to the project? Yay! We want you to! Visit our centralized instructions for [contributing](https://github.com/layer5io/meshery/blob/master/CONTRIBUTING.md#contributing).

26 changes: 13 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM golang:<go_version> as bd
RUN adduser --disabled-login appuser
WORKDIR /github.com/layer5io/meshery-<adapter>
ADD . .
RUN cd cmd; go build -ldflags="-w -s" -a -o /meshery-<adapter> .
RUN find . -name "*.go" -type f -delete; mv <adapter> /
FROM golang:1.14-alpine3.11 as build-img
ARG CONFIG_PROVIDER="viper"
RUN apk update && apk add --no-cache git libc-dev gcc pkgconf && mkdir /home/adaptor
COPY ${PWD} /go/src/github.com/layer5io/meshery-<adaptor-name>/
WORKDIR /go/src/github.com/layer5io/meshery-<adaptor-name>/
RUN go mod vendor && go build -ldflags="-w -s -X main.configProvider=$CONFIG_PROVIDER" -a -o /home/adaptor/<adaptor-name>

FROM alpine
RUN apk --update add ca-certificates
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
COPY --from=bd /meshery-<adapter> /app/
COPY --from=bd /<adapter> /app/<adapter>
COPY --from=bd /etc/passwd /etc/passwd
USER appuser
WORKDIR /app
CMD ./meshery-<adapter>
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 && \
mkdir ${HOME}/.<adaptor-name>/ && \
mkdir /home/adaptor/scripts/
COPY --from=bd /home/adaptor /home/
COPY --from=bd /go/src/github.com/layer5io/meshery-<adaptor-name>/scripts/** /home/adaptor/scripts/
WORKDIR /home/adaptor
CMD ./<adaptor-name>
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2019 Layer5, Inc.
Copyright 2019, 2020 Layer5, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
27 changes: 6 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
protoc-setup:
cd meshes
wget https://raw.githubusercontent.com/layer5io/meshery/master/meshes/meshops.proto

proto:
protoc -I meshes/ meshes/meshops.proto --go_out=plugins=grpc:./meshes/

docker:
docker build -t layer5/meshery-<adapter> .
docker build -t layer5/meshery-<adaptor-name> .

docker-run:
(docker rm -f meshery-<adapter>) || true
docker run --name meshery-<adapter> -d \
-p <port>:<port> \
(docker rm -f meshery-<adaptor-name>) || true
docker run --name meshery-<adaptor-name> -d \
-p 10007:10007 \
-e DEBUG=true \
layer5/meshery-<adapter>
layer5/meshery-<adaptor-name>

run:
DEBUG=true go run main.go

# setup-adapter sets up a new adapter with the given name & port
setup-adapter:
mv "<adapter>" ${ADAPTER}
find . -type f -exec sed -i '' -e 's/<adapter>/${ADAPTER}/g' {} +
find . -type f -exec sed -i '' -e 's/<port>/${PORT}/g' {} +
find . -type f -exec sed -i '' -e 's/<go_version>/${GO_VERSION}/g' {} +

DEBUG=true go run main.go
72 changes: 42 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
<p style="text-align:center;" align="center"><a href="https://layer5.io/meshery"><img align="center" style="margin-bottom:20px;" src="https://raw.githubusercontent.com/layer5io/layer5/master/assets/images/meshery/meshery-logo-tag-light-text-side.png" width="70%" /></a><br /><br /></p>

[![Docker Pulls](https://img.shields.io/docker/pulls/layer5/meshery.svg)](https://hub.docker.com/r/layer5/meshery)
[![Go Report Card](https://goreportcard.com/badge/github.com/layer5io/meshery)](https://goreportcard.com/report/github.com/layer5io/meshery)
[![Build Status](https://github.com/layer5io/meshery/workflows/Meshery/badge.svg)](https://github.com/layer5io/meshery/actions)
[![GitHub](https://img.shields.io/github/license/layer5io/meshery.svg)](LICENSE)
[![GitHub issues by-label](https://img.shields.io/github/issues/layer5io/meshery/help%20wanted.svg)](https://github.com/layer5io/meshery/issues?q=is%3Aopen+is%3Aissue+label%3A"help+wanted")
[![Website](https://img.shields.io/website/https/layer5.io/meshery.svg)](https://layer5.io/meshery/)
[![Twitter Follow](https://img.shields.io/twitter/follow/layer5.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=mesheryio)
# Meshery Adapter for Kuma

[![Docker Pulls](https://img.shields.io/docker/pulls/layer5/meshery-kuma.svg)](https://hub.docker.com/r/layer5/meshery-kuma)
[![Go Report Card](https://goreportcard.com/badge/github.com/layer5io/meshery-kuma)](https://goreportcard.com/report/github.com/layer5io/meshery-kuma)
[![Build Status](https://github.com/layer5io/meshery-kuma/workflows/Meshery-Kuma/badge.svg)](https://github.com/layer5io/meshery-kuma/actions)
[![GitHub](https://img.shields.io/github/license/layer5io/meshery-kuma.svg)](https://github.com/layer5io/meshery-kuma/blob/master/LICENSE)
[![GitHub issues by-label](https://img.shields.io/github/issues/layer5io/meshery-kuma/help%20wanted.svg)](https://github.com/layer5io/meshery-kuma/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![Website](https://img.shields.io/website/https/layer5.io/meshery.svg)](https://layer5.io/meshery)
[![Twitter Follow](https://img.shields.io/twitter/follow/layer5.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=layer5)
[![Slack](http://slack.layer5.io/badge.svg)](http://slack.layer5.io)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3564/badge)](https://bestpractices.coreinfrastructure.org/projects/3564)

<br />
<br />

# Setup
To setup the adapter from the template, we have a make command, which ONLY works on a Mac at the moment.
<p style="clear:both;">
<h2><a href="https://layer5.io/meshery">Meshery</a></h2>
<a href="https://meshery.io"><img src="img/readme/meshery-logo-light-text.svg"
style="margin:10px;" width="125px"
alt="Meshery - the Service Mesh Management Plane" align="left" /></a>
<a href="https://meshery.io">Meshery</a> is the multi-service mesh management plane offering lifecycle management of more types of service meshes than any other tool available today. Meshery facilitates adopting, configuring, operating and managing performance of different service meshes and incorporates the collection and display of metrics from applications running on top of any service mesh.
<br /><br /><p align="center"><i>If you’re using Meshery or if you like the project, please <a href="https://github.com/layer5io/meshery/stargazers">★</a> star this repository to show your support! 🤩</i></p>
</p>

The template command is:
```
make setup-adapter ADAPTER=<NAME OF THE ADAPTER> PORT=<PORT TO USE> GO_VERSION=<GO VERSION>
```
<br />

Example:
For an adapter with name `adapter`, port `12121` and Go version `1.13.4`, the command will be:
```
make setup-adapter ADAPTER=adapter PORT=12121 GO_VERSION=1.13.4
```
<p style="clear:both;">
<h2><a name="contributing"></a><a name="community"></a> <a href="http://slack.layer5.io">Community</a> and <a href="https://github.com/layer5io/layer5/blob/master/CONTRIBUTING.md">Contributing</a></h2>
Our projects are community-built and welcome collaboration. 👍 Be sure to see the <a href="https://docs.google.com/document/d/17OPtDE_rdnPQxmk2Kauhm3GwXF1R5dZ3Cj8qZLKdo5E/edit">Layer5 Community Welcome Guide</a> for a tour of resources available to you and jump into our <a href="http://slack.layer5.io">Slack</a>! Contributors are expected to adhere to the <a href="https://github.com/cncf/foundation/blob/master/code-of-conduct.md">CNCF Code of Conduct</a>.

__Please Note__: Do not include "meshery-" in the adapter name.
<a href="https://meshery.io/community"><img alt="Layer5 Service Mesh Community" src="img/readme/slack-128.png" style="margin-left:10px;padding-top:5px;" width="110px" align="right" /></a>

# meshery-\<adapter>
Meshery adapter for \<adapter>
<a href="http://slack.layer5.io"><img alt="Layer5 Service Mesh Community" src="img/readme/community.svg" style="margin-right:8px;padding-top:5px;" width="140px" align="left" /></a>

## [Meshery](https://layer5.io/meshery)
<p>
✔️ <em><strong>Join</strong></em> <a href="https://drive.google.com/open?id=1c07UO9dS7_tFD-ClCWHIrEzRnzUJoFQ10EzfJTpS7FY">weekly community meeting</a> on <a href="https://bit.ly/2SbrRhe">Fridays from 10am - 11am Central</a>.<br />
✔️ <em><strong>Watch</strong></em> community <a href="https://www.youtube.com/channel/UCFL1af7_wdnhHXL1InzaMvA?sub_confirmation=1">meeting recordings</a>.<br />
✔️ <em><strong>Access</strong></em> the <a href="https://drive.google.com/drive/u/4/folders/0ABH8aabN4WAKUk9PVA">community drive</a>.<br />
</p>
<p align="center">
<i>Not sure where to start?</i> Grab an open issue with the <a href="https://github.com/issues?utf8=✓&q=is%3Aopen+is%3Aissue+archived%3Afalse+org%3Alayer5io+label%3A%22help+wanted%22+">help-wanted label</a>.
</p>

A service mesh playground to faciliate learning about functionality and performance of different service meshes. Meshery incorporates the collection and display of metrics from applications running in the playground.
<br />
<br />

## Contributing
Please do! Contributions, updates, [discrepancy reports](/../../issues) and [pull requests](/../../pulls) are welcome. This project is community-built and welcomes collaboration. Contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## About Layer5

Not sure where to start? See the [newcomers welcome guide](https://docs.google.com/document/d/14Fofs9BysojB5igihXBI_SsFWoSUu-QRsGnnFqUvR0M/edit) for how, where and why to contribute. Or grab an open issue with the [help-wanted label](https://github.com/issues?utf8=✓&q=is%3Aopen+is%3Aissue+archived%3Afalse+org%3Alayer5io+label%3A%22help+wanted%22+) and jump in.
**Community First**
<p>The <a href="https://layer5.io">Layer5</a> community represents the largest collection of service mesh projects and their maintainers in the world.</p>

## License
**Open Source First**
<p>We build projects to provide learning environments, deployment and operational best practices, performance benchmarks, create documentation, share networking opportunities, and more. Our shared commitment to the open source spirit pushes Layer5 projects forward.</p>

This repository and site are available as open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).
**License**

#### About Layer5
[Layer5.io](https://layer5.io) is a service mesh community, serving as a repository for information pertaining to the surrounding technology ecosystem (service meshes, api gateways, edge proxies, ingress and egress controllers) of microservice management in cloud native environments.
This repository and site are available as open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).
29 changes: 29 additions & 0 deletions adaptor/adaptor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package adaptor

import (
"github.com/kumarabd/gokit/logger"
"github.com/layer5io/meshery-kuma/internal/config"
)

// Handler provides the methods supported by the adaptor
type Handler interface {
GetName() string
CreateInstance([]byte, string) error
ApplyOperation() error
ListOperations() (Operations, error)
Stream() error
}

// handler holds the dependencies for <adaptor-name>-adaptor
type handler struct {
config config.Handler
log logger.Handler
}

// New initializes email handler.
func New(c config.Handler, l logger.Handler) Handler {
return &handler{
config: c,
log: l,
}
}
7 changes: 7 additions & 0 deletions adaptor/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package adaptor

// CreateInstance installs and creates a mesh environment up and running
func (h *handler) CreateInstance(k8sconfig []byte, kubecontext string) error {
// Implementation for this method goes here.
return nil
}
12 changes: 12 additions & 0 deletions adaptor/error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package adaptor

import (
"fmt"

"github.com/kumarabd/gokit/errors"
)

// ErrCreateInstance is the error for install mesh
func ErrCreateInstance(err error) error {
return errors.New("1001", fmt.Sprintf("Error creating mesh intance: %s", err.Error()))
}
Loading

0 comments on commit adef00b

Please sign in to comment.