Skip to content

Commit

Permalink
CAP Operator: Initial open source version created
Browse files Browse the repository at this point in the history
Initial Open Source version of the CAP Operator.

Change-Id: I51258701067d3b05b9a79dbff0d37101c2dac1e8
  • Loading branch information
Pavan-SAP committed Aug 25, 2023
1 parent 1a6f52a commit c54204b
Show file tree
Hide file tree
Showing 461 changed files with 49,701 additions and 62 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
testbin/
32 changes: 32 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Go (Build & Unit test)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:

build:
name: Build
runs-on: ubuntu-22.04
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.21
cache: true

- name: Get dependencies
run: go get -v -t -d ./...

- name: Build all relevant packages
run: CGO_ENABLED=0 go build -v ./cmd/...

- name: Test relevant packages
run: CGO_ENABLED=0 go test -v ./...
79 changes: 79 additions & 0 deletions .github/workflows/publish-website.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish Website

on:
push:
branches:
- main
paths:
- website/**
- .github/workflows/publish-website.yaml
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.21
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.115.2"
extended: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Update dependencies
run: |
cd website
npm ci
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
cd website
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: website/public

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
needs: build

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
local/
.kubeconfig

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
bin
testbin/*

# Test binary, build with `go test -c`
*.test

# OS specific
.DS_Store

# Hugo artifacts
.hugo_build.lock
/website/resources
/website/node_modules
/website/public

# /tmp
tmp/
20 changes: 6 additions & 14 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: <YOUR-REPO-NAME>
Upstream-Contact: <YOUR-CONTACT (MAIL ADDRESS ETC.)>
Source: <https://github.com/sap/YOUR-REPO-NAME>
Upstream-Name: cap-operator
Upstream-Contact: cap-operator@sap.com
Source: <https://github.com/sap/cap-operator>
Disclaimer: The code in this project may include calls to APIs ("API Calls") of
SAP or third-party products or services developed outside of this project
("External Products").
Expand All @@ -24,14 +24,6 @@ Disclaimer: The code in this project may include calls to APIs ("API Calls") of
you any rights to use or access any SAP External Product, or provide any third
parties the right to use of access any SAP External Product, through API Calls.

Files: <YOUR-FILE-OR-FOLDER-LIST>
Copyright: <YEARS-RELEVANT-FOR-YOUR-PROJECT> SAP SE or an SAP affiliate company and <YOUR-PROJECT-NAME> contributors
License: Apache-2.0

Files: <THIRD-PARTY-FILE-OR-FOLDER-LIST>
Copyright: <COPYRIGHT-OF-THIRD-PARTY-CODE>
License: <LICENSE-OF-THIRD-PARTY-CODE>

Files: <ANOTHER-THIRD-PARTY-FILE-OR-FOLDER-LIST>
Copyright: <COPYRIGHT-OF-ANOTHER-THIRD-PARTY-CODE>
License: <LICENSE-OF-ANOTHER- THIRD-PARTY-CODE>
Files: **
Copyright: 2023 SAP SE or an SAP affiliate company and cap-operator contributors
License: Apache-2.0
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Controller",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/controller"
}
]
}
27 changes: 1 addition & 26 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -173,29 +173,4 @@
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
END OF TERMS AND CONDITIONS
32 changes: 10 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
# SAP Repository Template
# [CAP Operator](https://sap.github.io/cap-operator/)

Default templates for SAP open source repositories, including LICENSE, .reuse/dep5, Code of Conduct, etc... All repositories on github.com/SAP will be created based on this template.
CAP Operator manages the lifecycle operations involved in running multi-tenant CAP applications on Kubernetes clusters, primarily SAP Gardener managed clusters.

## To-Do
#### Documentation
Visit the [Documentation](https://sap.github.io/cap-operator/docs) to find out how to install and use the CAP Operator

In case you are the maintainer of a new SAP open source project, these are the steps to do with the template files:
#### Helm Chart
The local version of the [helm chart](https://github.com/sap/cap-operator-lifecycle/tree/release/chart) is now part of [CAP Operator Lifecycle](https://github.com/sap/cap-operator-lifecycle) repo.

- Check if the default license (Apache 2.0) also applies to your project. A license change should only be required in exceptional cases. If this is the case, please change the [license file](LICENSE).
- Enter the correct metadata for the REUSE tool. See our [wiki page](https://wiki.wdf.sap.corp/wiki/display/ospodocs/Using+the+Reuse+Tool+of+FSFE+for+Copyright+and+License+Information) for details how to do it. You can find an initial .reuse/dep5 file to build on. Please replace the parts inside the single angle quotation marks < > by the specific information for your repository and be sure to run the REUSE tool to validate that the metadata is correct.
- Adjust the contribution guidelines (e.g. add coding style guidelines, pull request checklists, different license if needed etc.)
- Add information about your project to this README (name, description, requirements etc). Especially take care for the <your-project> placeholders - those ones need to be replaced with your project name. See the sections below the horizontal line and [our guidelines on our wiki page](https://wiki.wdf.sap.corp/wiki/display/ospodocs/Guidelines+for+README.md+file) what is required and recommended.
- Remove all content in this README above and including the horizontal line ;)
#### CRDs
CRDs for the CAP Operator can be applied from the [./crds](./crds) folder, these are also copied over to the [helm chart](https://github.com/sap/cap-operator-lifecycle/tree/main/chart) when updated.

***

# Our new open source project

## About this project

*Insert a short description of your project here...*

## Requirements and Setup

*Insert a short description what is required to get your project running...*

## Support, Feedback, Contributing

This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP/<your-project>/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).
This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP/cap-operator/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).

## Code of Conduct

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its [Code of Conduct](https://github.com/SAP/.github/blob/main/CODE_OF_CONDUCT.md) at all times.

## Licensing

Copyright (20xx-)20xx SAP SE or an SAP affiliate company and <your-project> contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/SAP/<your-project>).
Copyright 2023 SAP SE or an SAP affiliate company and cap-operator contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/SAP/cap-operator).
15 changes: 15 additions & 0 deletions build/controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build stage for go modules
FROM golang:1.21-alpine as build

WORKDIR /build

COPY . .

RUN CGO_ENABLED=0 go build -o bin/controller ./cmd/controller/

# Run Stage
FROM gcr.io/distroless/static AS final

ENTRYPOINT ["/app/controller"]

COPY --from=build /build/bin/controller /app/controller
15 changes: 15 additions & 0 deletions build/mtx-job/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build stage for go modules
FROM golang:1.21-alpine as build

WORKDIR /build

COPY . .

RUN CGO_ENABLED=0 go build -o ./bin/mtx-job ./cmd/mtx-job/main.go

# Run Stage
FROM gcr.io/distroless/static AS final

ENTRYPOINT ["/app/mtx-job"]

COPY --from=build /build/bin/mtx-job /app/mtx-job
15 changes: 15 additions & 0 deletions build/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build stage for go modules
FROM golang:1.21-alpine as build

WORKDIR /build

COPY . .

RUN CGO_ENABLED=0 go build -o bin/server ./cmd/server/

# Run Stage
FROM gcr.io/distroless/static AS final

ENTRYPOINT ["/app/server"]

COPY --from=build /build/bin/server /app/server
15 changes: 15 additions & 0 deletions build/web-hooks/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Build stage for go modules
FROM golang:1.21-alpine as build

WORKDIR /build

COPY . .

RUN CGO_ENABLED=0 go build -o ./bin/webhook ./cmd/web-hooks/main.go

# Run Stage
FROM gcr.io/distroless/static AS final

ENTRYPOINT ["/app/webhook"]

COPY --from=build /build/bin/webhook /app/webhook

0 comments on commit c54204b

Please sign in to comment.