Skip to content

Commit ece17b1

Browse files
Merge pull request #1 from siddhantprateek/master-1
custom resource definition manifest files
2 parents 643257d + 51e9d15 commit ece17b1

File tree

5 files changed

+80
-1
lines changed

5 files changed

+80
-1
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: siddhantprateek

.github/workflows/yaml-validator.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Manifest Validation
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
validation:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout to Repository
14+
uses: actions/checkout@v2
15+
- name: Kubernetes yaml validation by kubeval
16+
uses: makocchi-git/actions-k8s-manifests-validate-kubeval@v1.0.1
17+
with:
18+
files: difinition,resources
19+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
# k8s-crds
1+
# k8s-crds
2+
3+
Requirements:
4+
- `Kubernetes` (minikube)
5+
6+
7+
## Setting up
8+
9+
- Create custom resource defination
10+
```bash
11+
kubectl apply -f definition/custom-definition.yml
12+
```
13+
14+
- Create custom resource
15+
```bash
16+
kubectl apply -f resources/*
17+
```

definition/custom-definition.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: hotelbooking.hotels.com
5+
spec:
6+
scope: Namespaced
7+
group: hotels.com
8+
names:
9+
kind: HotelBooking
10+
singular: hotelbooking
11+
plural: hotelbookings
12+
shortNames:
13+
- hb
14+
versions:
15+
- name: v1
16+
served: true
17+
storage: true
18+
19+
schema:
20+
openAPIV3Schema:
21+
type: Object
22+
properties:
23+
spec:
24+
type: object
25+
properties:
26+
guestfrom:
27+
type: string
28+
guestName:
29+
type: string
30+
days:
31+
type: integer
32+
minimum: 1
33+
maximum: 90
34+
35+

resources/hotelbooking.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: hotels.com/v1
2+
kind: HotelBooking
3+
metadata:
4+
name: custom-hotel-booking
5+
spec:
6+
guestfrom: US
7+
guestName: Anderson
8+
days: 21

0 commit comments

Comments
 (0)