Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
electrocucaracha committed Sep 26, 2023
0 parents commit b5d2983
Show file tree
Hide file tree
Showing 29 changed files with 1,295 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-20.04",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:1": {},
"ghcr.io/electrocucaracha/pkg-mgr_scripts/kubectl:latest": {
"pkg_krew_plugins_list": "ctx"
}
},
"hostRequirements": {
"cpus": 2,
"memory": "4gb"
},
"postCreateCommand": "cd scripts/; ./main.sh | tee ~/main.log",
"forwardPorts": [3000]
}
25 changes: 25 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
brightgreen
codespaces
Codespaces
dev
electrocucaracha
fsSL
href
https
img
initVagrant
kpt
KPT
Kubernetes
laobi
libvirt
Libvirt
ly
opensource
pre
repo
rubocop
src
svg
vagrantup
VirtualBox
35 changes: 35 additions & 0 deletions .github/actions/vagrant-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

name: Vagrant setup

runs:
using: "composite"
steps:
- name: Cache Vagrant boxes
uses: actions/[email protected]
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Apply workaround for VBoxHeadless issue on macOS (https://www.virtualbox.org/ticket/20636)
shell: bash
run: |
if [[ "$(VBoxManage --version)" == "6.1.28r147628" ]]; then
find . -type f -iname "Vagrantfile" -exec sed -i '.bak' 's|v.gui = .*|v.gui = true|g' {} \;
find . -type f -name "*.bak" -delete
fi
- name: Replace shorten links
shell: bash
run: find . -type f -iname "*sh" -exec sed -i '.bak' 's|http://bit.ly/install_pkg|https://raw.githubusercontent.com/electrocucaracha/pkg-mgr_scripts/master/install.sh|g' {} \;
- name: Install vagrant tool
shell: bash
run: brew install vagrant
29 changes: 29 additions & 0 deletions .github/actions/vagrant-up/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

name: Vagrant up
inputs:
memory:
description: 'Memory'
default: 12288
cpu:
description: 'CPU'
default: 3

runs:
using: "composite"
steps:
- name: Run vagrant box instance
shell: bash
env:
VAGRANT_DISABLE_VBOXSYMLINKCREATE: 1
MEMORY: ${{ inputs.memory }}
CPUS: ${{ inputs.cpu }}
run: vagrant up
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
41 changes: 41 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

name: Lint Code Base
# yamllint disable-line rule:truthy
on: [push, pull_request]

jobs:
check-broken-links:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Check broken links
uses: gaurav-nelson/[email protected]
check-super-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Check super-linter
uses: github/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_KUBERNETES_KUBEVAL: false
KUBERNETES_KUBECONFORM_OPTIONS: '-ignore-missing-schemas'
LINTER_RULES_PATH: /
check-tox:
name: Check syntax (tox)
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install tox
run: pip install tox
- name: Check tox
run: tox -e lint
68 changes: 68 additions & 0 deletions .github/workflows/on-demand_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

name: Check End-to-End (On Demand)
# yamllint disable-line rule:truthy
on:
push:
paths:
- '**.sh'
- '!.github/*'
pull_request_review:
types:
- submitted

jobs:
check-scripts-format:
if: >-
(
github.event_name == 'pull_request_review' &&
github.event.review.state == 'approved'
) ||
github.event_name != 'pull_request_review'
name: Check scripts format
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Run the sh-checker
uses: luizm/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHFMT_OPTS: -i 4 -s
with:
sh_checker_shellcheck_disable: true
smoke-test:
name: Check functional tests
needs: check-scripts-format
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- name: Deploy KPT services
working-directory: ./scripts
env:
DEBUG: true
ENABLE_FUNC_TEST: true
PROVISION_PHASES: install
run: ./main.sh
- name: Run KPT demo
working-directory: ./scripts
run: ./demo-kpt.sh
functional-test:
name: Check functional tests
needs: check-scripts-format
runs-on: macos-12
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/vagrant-setup
- name: Create vagrant box
env:
DEBUG: true
ENABLE_FUNC_TEST: true
uses: ./.github/actions/vagrant-up
37 changes: 37 additions & 0 deletions .github/workflows/spell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

name: Run misspell
# yamllint disable-line rule:truthy
on:
push:
paths:
- '**.md'
- '!.github/*'
pull_request_review:
types:
- submitted

jobs:
check-reviewdog:
name: Check spelling (reviewdog)
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.github_token }}
check-spellcheck:
name: Check spelling (pyspelling)
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: igsekor/[email protected]
name: Spellcheck
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vagrant
*.dic
21 changes: 21 additions & 0 deletions .spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

matrix:
- name: markdown
dictionary:
wordlists:
- .github/.wordlist.txt
pipeline:
- pyspelling.filters.markdown:
sources:
- '**/*.md'
aspell:
ignore-case: true
20 changes: 20 additions & 0 deletions .yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

extends: default

yaml-files:
- '*.yml'

ignore: |
.tox/
rules:
line-length: disable
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2022
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

DOCKER_CMD ?= $(shell which docker 2> /dev/null || which podman 2> /dev/null || echo docker)

.PHONY: lint
lint:
sudo -E $(DOCKER_CMD) run --rm -v $$(pwd):/tmp/lint \
-e RUN_LOCAL=true \
-e LINTER_RULES_PATH=/ \
-e KUBERNETES_KUBECONFORM_OPTIONS='-skip kind.x-k8s.io/v1alpha4/Cluster' \
-e VALIDATE_KUBERNETES_KUBEVAL=false \
-e VALIDATE_RUST_CLIPPY=false \
github/super-linter
tox -e lint

.PHONY: fmt
fmt:
sudo -E $(DOCKER_CMD) run --rm -u "$$(id -u):$$(id -g)" \
-v "$$(pwd):/mnt" -w /mnt mvdan/shfmt -l -w -i 4 -s .
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# KPT demo
<!-- markdown-link-check-disable-next-line -->
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
<!-- markdown-link-check-disable-next-line -->
![visitors](https://visitor-badge.laobi.icu/badge?page_id=electrocucaracha.k8s-KPT-demo)

## Summary

This project provides a Sandbox environment for testing [KPT project][1].

### KPT demo
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?repo=electrocucaracha/k8s-KPT-demo)

### Porch demo
![Porch](demo-porch.svg)

## Virtual Machines

The [Vagrant tool][2] can be used for provisioning an Ubuntu Focal
Virtual Machine. It's highly recommended to use the *setup.sh* script
of the [bootstrap-vagrant project][3] for installing Vagrant
dependencies and plugins required for this project. That script
supports two Virtualization providers (Libvirt and VirtualBox) which
are determine by the **PROVIDER** environment variable.

curl -fsSL http://bit.ly/initVagrant | PROVIDER=libvirt bash

Once Vagrant is installed, it's possible to provision a Virtual
Machine using the following instructions:

vagrant up

The provisioning process will take some time to install all
dependencies required by this project and perform a Kubernetes
deployment on it.

[1]: https://kpt.dev/
[2]: https://www.vagrantup.com/
[3]: https://github.com/electrocucaracha/bootstrap-vagrant
Loading

0 comments on commit b5d2983

Please sign in to comment.