Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jashandeep-sohi committed Aug 8, 2024
0 parents commit d2cfc4c
Show file tree
Hide file tree
Showing 11 changed files with 1,611 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

nix_direnv_watch_file flake.nix
nix_direnv_watch_file flake.lock

if ! use flake . --override-input devenv-root "file+file://"<(printf %s "$PWD")
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
39 changes: 39 additions & 0 deletions .github/workflows/build-containers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Contianers
on:
push:
branches:
- master
tags:
- v*

jobs:
build:
concurrency:
group: container

runs-on: ubuntu-latest
permissions:
id-token: "write"
contents: "read"
packages: write

steps:
- uses: docker/metadata-action@v5
id: meta
with:
tags: |
type=ref,event=branch
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{version}}
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: |-
for tag in $(jq -r '.tags[]' <<< "$DOCKER_METADATA_OUTPUT_JSON"); do
nix run .#sealContainer.copyTo --impure -- \
--dest-username ${{ github.actor}} \
--dest-password '${{ secrets.GITHUB_TOKEN }}' \
docker://ghcr.io/${{ github.repository }}:$tag
done
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.devenv
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# krm-fn-kustomize

[KRM](https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md) function
to run [Kustomize](https://kustomize.io/).

## Usage

By default this function will build the Kustomization and output it to `build.yaml`.

```shell
kpt fn eval --image ghcr.io/jashandeep-sohi/krm-fn-kustomize
```

You can override the kustomize command using the `cmd` option:

```shell
kpt fn eval --image ghcr.io/jashandeep-sohi/krm-fn-kustomize -- cmd='kustomize build --output test.yaml'
```

Or declaratively:

```yaml
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:

# This will build the Kustomization and output it to build.yaml
- image: ghcr.io/jashandeep-sohi/krm-fn-kustomize

# Override the command
- image: ghcr.io/jashandeep-sohi/krm-fn-kustomize
configMap:
cmd: kustomize build --output test.yaml
```
16 changes: 16 additions & 0 deletions example/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:

# This will build the Kustomization and output it to build.yaml
- image: ghcr.io/jashandeep-sohi/krm-fn-kustomize

# Override the command
- image: ghcr.io/jashandeep-sohi/krm-fn-kustomize
configMap:
cmd: kustomize build --output test.yaml
4 changes: 4 additions & 0 deletions example/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy
6 changes: 6 additions & 0 deletions example/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./deploy.yaml
namePrefix: prefix-
namespace: change
Loading

0 comments on commit d2cfc4c

Please sign in to comment.