diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..5d889646 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @karthik1729 @nxtcoder17 diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..d55e32c2 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +shout@kloudlite.io. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..341dcae1 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,42 @@ +Thank you for your interest in contributing to our project! Before you start working on your contribution, please review the following guidelines to ensure a smooth and efficient collaboration process. + +### Getting Started + +1. **Fork the repository**: Create a fork of the main repository to your personal GitHub account. This will allow you to make changes and create a pull request when you're ready to submit your contribution. + +2. **Create a branch**: In your fork, create a new branch for each feature or bugfix you're working on. This helps to keep your work organized and makes it easier for us to review your changes. Use a descriptive branch name, such as `feature/new-feature` or `bugfix/issue-123`. + +3. **Keep your fork in sync**: Regularly update your fork with the latest changes from the main repository to avoid merge conflicts. + + +### Code Standards + +Please adhere to the following code standards when contributing to the project: + +1. **Coding style**: Follow the project's coding style and conventions, which may include indentation, naming conventions, and code organization. If the project uses a linter or a code formatter (e.g., Prettier, ESLint), make sure to configure your development environment accordingly. + +2. **Comment your code**: Add comments to your code to explain its purpose, especially for complex or non-obvious implementations. This will help other contributors understand your work and make future maintenance easier. + +3. **Write tests**: Whenever possible, write tests for your changes to ensure that they work correctly and to prevent regressions. Make sure that all existing tests pass before submitting your pull request. + +4. **Commit messages**: Write meaningful commit messages that describe the changes you've made. Use the imperative mood ("Add feature" instead of "Added feature") and keep your commit messages concise but informative. + + +### Submitting a Pull Request + +When you're ready to submit your changes, follow these steps: + +1. **Ensure your code is up to date**: Merge the latest changes from the main repository into your branch to minimize the risk of merge conflicts. + +2. **Test your changes**: Run the project's test suite and verify that all tests pass. Make sure that your changes do not introduce new errors or warnings. + +3. **Submit a pull request**: Create a pull request (PR) from your branch to the main repository. In the PR description, provide a clear and concise explanation of your changes, including any issues or features they address. If your PR fixes a specific issue, reference it using the appropriate syntax (e.g., "Fixes #123"). + +4. **Respond to feedback**: After submitting your PR, the maintainers and other contributors may provide feedback or request changes. Be prepared to engage in a constructive discussion and address any concerns or suggestions they may have. + + +### Code of Conduct + +Please follow the project's Code of Conduct in all your interactions with the community. We expect all contributors to treat each other with respect and maintain a professional and inclusive environment. + +By following these guidelines, you'll help us maintain a high-quality codebase and foster a welcoming and collaborative community. We appreciate your contribution and look forward to working with you! diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..a9d17d4a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,37 @@ +## Description + +Please provide a brief summary of the changes. If it's a bug fix, describe the bug and how the changes fix it. If it's a new feature or enhancement, explain the motivation and context behind the changes. + +Fixes #(issue) + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +## How Has This Been Tested? + +Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. +- [ ] Test A +- [ ] Test B + +**Test Configuration**: +* OS: +* Version: +* Kubernetes Version: +* Kubernetes Distribution: + +## Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been merged and published in downstream modules diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..57a28a38 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,25 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 0.1.x | :white_check_mark: | + + +## Reporting a Vulnerability + +We take security issues seriously. If you discover a security vulnerability in our project, please follow these steps for responsible disclosure: + +1. Do not create a public issue on GitHub or discuss the vulnerability publicly. +2. Email the security team at security@kloudlite.io with the details of the vulnerability. +3. Provide a clear and detailed description of the vulnerability, including steps to reproduce the issue or any proof-of-concept code. +4. Allow the security team a reasonable amount of time to assess the vulnerability, develop a fix, and release a security update. + +We will acknowledge receipt of your vulnerability report within 48 hours and provide an estimated timeframe for a fix. In the meantime, please refrain from sharing any information about the vulnerability with others. + +If you follow these guidelines and responsibly disclose the vulnerability, we will credit you in the security update announcement. + +Thank you for helping to keep our project and its users secure. diff --git a/.github/workflows/build-helm-worker.yml b/.github/workflows/build-helm-worker.yml new file mode 100644 index 00000000..5a7fb071 --- /dev/null +++ b/.github/workflows/build-helm-worker.yml @@ -0,0 +1,22 @@ +name: Build Helm Worker + +on: + push: + paths: + - "operators/helm-charts/Containerfile.helm-job-runner" + +permissions: + contents: read + packages: write + +jobs: + helm-worker-build: + runs-on: ubuntu-latest + name: Build and push helm worker + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build Helm Job Runner + run: | + cd operators/helm-charts + docker buildx build -f ./Containerfile.helm-job-runner -t ghcr.io/kloudlite/operator-workers/helm-runner . --push \ No newline at end of file diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-operators.yml similarity index 98% rename from .github/workflows/build-container.yml rename to .github/workflows/build-operators.yml index 7e80b96e..eab3377f 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-operators.yml @@ -1,9 +1,6 @@ name: build-operators on: - repository_dispatch: - types: - - webhook push: paths: - "operators/**" @@ -21,7 +18,8 @@ permissions: packages: write jobs: - docker-builds: + + operator-builds: strategy: matrix: name: diff --git a/.github/workflows/build-tenant-agent.yml b/.github/workflows/build-tenant-agent.yml new file mode 100644 index 00000000..741cafaf --- /dev/null +++ b/.github/workflows/build-tenant-agent.yml @@ -0,0 +1,75 @@ +name: Build Agent + +on: + push: + paths: + - "operators/helm-charts/Containerfile.helm-job-runner" + +permissions: + contents: read + packages: write + +jobs: + build-agent: + runs-on: ubuntu-latest + name: Build and push helm worker + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Setup Golang caches + uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-golang- + + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: 1.21 + + - name: Install Task + uses: arduino/setup-task@v1 + with: + version: 3.x + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install UPX + run: | + curl -L0 https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-amd64_linux.tar.xz > upx.tar.xz + tar -xf upx.tar.xz + sudo mv upx-4.2.1-amd64_linux/upx /usr/local/bin + + - name: Build Binary + run: | + cd agent + task build Out=$PWD/../.github/workflows/container-build/app + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build & Push Image + if: startsWith(github.ref, 'refs/heads/release') + run: | + branch_name=${GITHUB_REF#refs/heads/} + version_string="v${branch_name#release-}-nightly" + + cd .github/workflows/container-build + + upx ./app + task go-container-build Image="ghcr.io/kloudlite/tenant/agent:$version_string" + task go-container-build Image="ghcr.io/kloudlite/tenant/agent:commit-${GITHUB_SHA}" \ No newline at end of file diff --git a/agent/main.go b/agent/main.go index 02668788..fbf3d550 100644 --- a/agent/main.go +++ b/agent/main.go @@ -279,7 +279,10 @@ func main() { cc, err := func() (*grpc.ClientConn, error) { if isDev { logger.Infof("attempting grpc connect over %s", ev.GrpcAddr) - return libGrpc.Connect(ev.GrpcAddr) + return libGrpc.Connect(ev.GrpcAddr, libGrpc.ConnectOpts{ + SecureConnect: false, + Timeout: 20 * time.Second, + }) } logger.Infof("attempting grpc connect over %s", ev.GrpcAddr) return libGrpc.ConnectSecure(ev.GrpcAddr)