Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Acting on behalf of Daimler TSS GmbH and licensed under the MIT License.
https://www.daimler-tss.com/en/imprint/
  • Loading branch information
ffurrer2 authored and Felix Furrer committed Sep 18, 2019
0 parents commit 58715fa
Show file tree
Hide file tree
Showing 24 changed files with 1,501 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SPDX-License-Identifier: MIT

name: CI Windows

on:
push:
branches:
- master
- feature/*

jobs:
local-build:
name: Local build
strategy:
matrix:
os: [windows-2019]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Set up task
env:
TASK_VERSION: 2.6.0
shell: powershell
run: |
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
scoop bucket add extras
scoop install task@$env:TASK_VERSION
- name: Checkout
uses: actions/checkout@v1
- name: Clean
run: |
%HOMEDRIVE%%HOMEPATH%/scoop/apps/task/current/task local:clean
- name: Prepare
run: |
%HOMEDRIVE%%HOMEPATH%/scoop/apps/task/current/task local:prepare
- name: Build
run: |
%HOMEDRIVE%%HOMEPATH%/scoop/apps/task/current/task local:build
- name: Test
run: |
%HOMEDRIVE%%HOMEPATH%/scoop/apps/task/current/task local:test
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# SPDX-License-Identifier: MIT

name: CI

on:
push:
branches:
- master
- feature/*

jobs:
docker-build:
name: Docker build
strategy:
matrix:
os: [ubuntu-16.04, ubuntu-18.04]
runs-on: ${{ matrix.os }}
steps:
- name: Set up task
env:
TASK_VERSION: 2.6.0
run: |
sudo bash -c "curl -sL https://taskfile.dev/install.sh | bash -s -- -b /usr/local/bin v${TASK_VERSION}"
- name: Checkout
uses: actions/checkout@v1
- name: Build
run: |
task docker:build
- name: Test
run: |
task docker:test
local-build:
name: Local build
strategy:
matrix:
os: [ubuntu-16.04, ubuntu-18.04]
go: [1.11, 1.12, 1.13]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- name: Set up task
env:
TASK_VERSION: 2.6.0
run: |
sudo bash -c "curl -sL https://taskfile.dev/install.sh | bash -s -- -b /usr/local/bin v${TASK_VERSION}"
- name: Checkout
uses: actions/checkout@v1
- name: Clean
run: |
task local:clean
- name: Prepare
run: |
task local:prepare
- name: Build
run: |
task local:build
- name: Test
run: |
task local:test
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: MIT

.idea/
.vscode/

build/
vendor/

/config
/demo.cast
/namespace-provisioning-networkpolicy.yaml
/namespace-provisioner.yaml
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- SPDX-License-Identifier: MIT -->
# Contributing

This document explains how to contribute to this project.
By contributing you will agree that your contribution will be put under the same license as this repository.

## Table of Contents

- [Contributing](#contributing)
- [Table of Contents](#table-of-contents)
- [CLA](#cla)
- [Communication](#communication)
- [Contributions](#contributions)
- [Quality](#quality)

## CLA

Before you can contribute, you will need to sign our [Contributor License Agreement](https://raw.githubusercontent.com/Daimler/daimler-foss/master/cla/2019-09-11_Daimler_FOSS_CLA_DaimlerTSS.pdf) and send the signed CLA to [[email protected]](mailto:[email protected]).

## Communication

For communication please respect our [FOSS Code of Conduct](https://github.com/Daimler/daimler-foss/blob/master/CODE_OF_CONDUCT.md).

The following communication channels exist for this project:

- GitHub for reporting and claiming issues: <https://github.com/Daimler/namespace-provisioner>

Transparent and open communication is important to us.
Thus, all project-related communication should happen only through these channels and in English.
Issue-related communication should happen within the concerned issue.

## Contributions

If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request.

When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible.

If you are new to contributing in GitHub, [First Contributions](https://github.com/firstcontributions/first-contributions) might be a good starting point.

## Quality

Please ensure that for all contributions, the corresponding documentation is in-sync and up-to-date. All documentation should be in English language.

We assume that for every non-trivial contribution, the project has been built and tested prior to the contribution.
82 changes: 82 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# SPDX-License-Identifier: MIT

# Conventions:
# WORKDIR = /workdir
# Build and test results should be in /workdir/build

###############################################################################
# SET UP BUILD-ENV
###############################################################################
FROM golang:1.13.0 as build-env

ARG TASK_VERSION=2.6.0

# Install Task
WORKDIR /tmp
RUN curl -sLSfo task.tgz https://github.com/go-task/task/releases/download/v${TASK_VERSION}/task_linux_amd64.tar.gz && \
mkdir -p task && \
tar xvf task.tgz -C task && \
mv task/task /usr/local/bin/ && \
rm -rf task*

WORKDIR /workdir
COPY go.mod go.mod
COPY go.sum go.sum
COPY ./tasks/BuildTasks.yml Taskfile.yml
RUN task prepare

###############################################################################
# BUILD
###############################################################################
FROM build-env as build

ARG GO_BUILD_ENV="GOOS=linux GOARCH=amd64 CGO_ENABLED=0"

COPY pkg/controllers pkg/controllers/
COPY pkg/util pkg/util/
COPY main.go main.go
RUN task build GO_BUILD_ENV="${GO_BUILD_ENV}"

###############################################################################
# TEST
###############################################################################
FROM build as test
ARG BUILD_DATE
RUN task test

###############################################################################
# FINAL IMAGE
###############################################################################
FROM alpine:latest

ARG BUILD_TAG
ARG BUILD_DATE
ARG BUILD_VERSION
ARG VCS_REF

LABEL org.opencontainers.image.authors="Daimler TSS GmbH" \
org.opencontainers.image.vendor="Daimler TSS GmbH" \
org.opencontainers.image.title="namespace-provisioner:${BUILD_TAG}" \
org.opencontainers.image.description="A Kubernetes operator creating k8s resources by annotating namespaces." \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.version="${BUILD_VERSION}" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.url="https://github.com/Daimler/namespace-provisioner" \
org.opencontainers.image.documentation="https://github.com/Daimler/namespace-provisioner/blob/master/README.md" \
org.opencontainers.image.source="https://github.com/Daimler/namespace-provisioner" \
org.opencontainers.image.licenses="MIT"

ENV VERSION=${BUILD_VERSION}

WORKDIR /app

COPY --from=build /workdir/build/bin/namespace-provisioner .

COPY LICENSE /LICENSE

RUN chown -R 100:100 . && \
chmod +x namespace-provisioner

USER 100

ENTRYPOINT ["./namespace-provisioner"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Daimler TSS GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 58715fa

Please sign in to comment.