Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom resource definition manifest files #1

Merged
merged 4 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: siddhantprateek
19 changes: 19 additions & 0 deletions .github/workflows/yaml-validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Manifest Validation

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
validation:
runs-on: ubuntu-latest
steps:
- name: Checkout to Repository
uses: actions/checkout@v2
- name: Kubernetes yaml validation by kubeval
uses: makocchi-git/actions-k8s-manifests-validate-kubeval@v1.0.1
with:
files: difinition,resources
token: ${{ secrets.GITHUB_TOKEN }}
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# k8s-crds
# k8s-crds

Requirements:
- `Kubernetes` (minikube)


## Setting up

- Create custom resource defination
```bash
kubectl apply -f definition/custom-definition.yml
```

- Create custom resource
```bash
kubectl apply -f resources/*
```
35 changes: 35 additions & 0 deletions definition/custom-definition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: hotelbooking.hotels.com
spec:
scope: Namespaced
group: hotels.com
names:
kind: HotelBooking
singular: hotelbooking
plural: hotelbookings
shortNames:
- hb
versions:
- name: v1
served: true
storage: true

schema:
openAPIV3Schema:
type: Object
properties:
spec:
type: object
properties:
guestfrom:
type: string
guestName:
type: string
days:
type: integer
minimum: 1
maximum: 90


8 changes: 8 additions & 0 deletions resources/hotelbooking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: hotels.com/v1
kind: HotelBooking
metadata:
name: custom-hotel-booking
spec:
guestfrom: US
guestName: Anderson
days: 21
Loading