-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: bootstrap the repository content (#1)
Signed-off-by: Mehdi Bechiri <[email protected]>
- Loading branch information
Showing
6 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'Dockerfile' | ||
- 'entrypoint.sh' | ||
- '.github/workflows/docker.yaml' | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'Dockerfile' | ||
- 'entrypoint.sh' | ||
- '.github/workflows/docker.yaml' | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'git:checkout' | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: "docker:meta" | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
flavor: latest=true | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
- name: "docker:login:ghcr.io" | ||
if: github.ref_type == 'tag' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
- name: "docker:buildx" | ||
uses: docker/setup-buildx-action@v2 | ||
- name: "docker:build-push" | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: ${{ github.ref_type == 'tag' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This is a comment. | ||
# Each line is a file pattern followed by one or more owners. | ||
|
||
# These owners will be the default owners for everything in the repo. | ||
# Unless a later match takes precedence, @cebidhem | ||
# will be requested for review when someone opens a pull request. | ||
* @cebidhem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM alpine:3.18 as base | ||
RUN apk add --no-cache curl openssl | ||
RUN addgroup -g 1001 app && \ | ||
adduser -D -G app -u 1001 app | ||
|
||
FROM base as builder | ||
ENV KUBECTL_VERSION=1.26.4 | ||
ARG TARGETPLATFORM | ||
RUN curl -LO https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/${TARGETPLATFORM}/kubectl && \ | ||
chmod +x ./kubectl && \ | ||
curl -LO https://run.linkerd.io/install && \ | ||
chmod +x ./install && \ | ||
sh install | ||
|
||
FROM base as final | ||
COPY --chown=app:app --from=builder kubectl /usr/local/bin/kubectl | ||
COPY --chown=app:app --from=builder /root/.linkerd2/bin/linkerd /usr/local/bin/linkerd | ||
ADD --chown=app:app entrypoint.sh /app/entrypoint.sh | ||
WORKDIR /app | ||
USER app | ||
ENTRYPOINT ["./entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
# linkerd-sp-swagger-sync | ||
|
||
Applying Linkerd ServiceProfiles generated from Swagger automatically | ||
|
||
### Goal | ||
|
||
Linkerd allows to create ServiceProfiles from a Swagger file. This is great when you can generate it locally, or include it somehow in your deployments (Helm, Flux, etc...) | ||
|
||
In my case, I want to reconfigure the ServiceProfile of my backends each time I deploy it in Kubernetes, without wondering if my routes have been updated this time or not. Obviously, several version live at the same time in different clusters, I just don't want to track that. | ||
|
||
This docker image aims at getting a Swagger documentation online, process it with linkerd commands to generate the ServiceProfile and apply it in cluster. | ||
|
||
In my case, I'll run it as a Helm post-upgrade hook. | ||
|
||
### Non Goals | ||
|
||
This fulfills a very specific use-case and yours may be different. If your contributions are welcomed, please note that this is a side project that I'll maintain on my free time on a best effort basis. | ||
|
||
Of course, feel also free to fork the project: it's under the [MIT license](LICENSE). | ||
|
||
### How to run it ? | ||
|
||
Work In Progress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env sh | ||
|
||
SWAGGER_URL=$1 | ||
SERVICE=$2 | ||
|
||
curl "${SWAGGER_URL}" | linkerd profile --open-api - "${SERVICE}" | kubectl apply -f - |