Skip to content

Commit

Permalink
Merge pull request #14 from Nordix/starting-with-porch
Browse files Browse the repository at this point in the history
Added porch tutorial
  • Loading branch information
nephio-prow[bot] authored Feb 2, 2024
2 parents fb575a9 + f07190a commit 987b231
Show file tree
Hide file tree
Showing 18 changed files with 2,209 additions and 0 deletions.
1,946 changes: 1,946 additions & 0 deletions docs/tutorials/starting-with-porch/README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/tutorials/starting-with-porch/blueprints/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/.KptRevisionMetadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kpt.dev/v1
kind: Kptfile

metadata:
name: network-function-auto-namespace

info:
description: Network Function with automatic namespace setting Blueprint

pipeline:
mutators:
- image: gcr.io/kpt-fn/set-namespace:v0.4.1
configPath: package-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Network Function

## Description
Network Function with automatic namespace Blueprint

## Usage

### Fetch the package
```
kpt pkg get $GIT_HOST/$GIT_USERNAME/$GIT_BLUEPRINTS_REPO[@VERSION] network-function-auto-namespace
```
Details: https://kpt.dev/reference/cli/pkg/get/

### View package content
```
kpt pkg tree network-function-auto-namespace
```
Details: https://kpt.dev/reference/cli/pkg/tree/

### Apply the package
```
kpt live init network-function-auto-namespace
kpt live apply network-function-auto-namespace --reconcile-timeout=2m --output=table
```
Details: https://kpt.dev/reference/cli/live/
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: network-function-auto-namespace
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: network-function-auto-namespace
template:
metadata:
labels:
app.kubernetes.io/name: network-function-auto-namespace
spec:
containers:
- name: nginx
image: nginx:latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: kptfile.kpt.dev
annotations:
config.kubernetes.io/local-config: "true"
data:
name: default-namespace-name
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kpt.dev/v1
kind: Kptfile

metadata:
name: network-function

info:
description: Network Function Blueprint
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Network Function

## Description
Network Function Blueprint

## Usage

### Fetch the package
```
kpt pkg get $GIT_HOST/$GIT_USERNAME/$GIT_BLUEPRINTS_REPO[@VERSION] network-function
```
Details: https://kpt.dev/reference/cli/pkg/get/

### View package content
```
kpt pkg tree network-function
```
Details: https://kpt.dev/reference/cli/pkg/tree/

### Apply the package
```
kpt live init network-function
kpt live apply network-function --reconcile-timeout=2m --output=table
```
Details: https://kpt.dev/reference/cli/live/
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: network-function
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: network-function
template:
metadata:
labels:
app.kubernetes.io/name: network-function
spec:
containers:
- name: nginx
image: nginx:latest
14 changes: 14 additions & 0 deletions docs/tutorials/starting-with-porch/kind_edge1_cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4

name: edge1
networking:
apiServerAddress: 127.0.0.1
apiServerPort: 31001
podSubnet: 10.98.0.0/16
serviceSubnet: 10.198.0.0/16
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30000
hostPort: 32001
16 changes: 16 additions & 0 deletions docs/tutorials/starting-with-porch/kind_management_cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4

name: management
networking:
apiServerAddress: 127.0.0.1
apiServerPort: 31000
podSubnet: 10.97.0.0/16
serviceSubnet: 10.197.0.0/16
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 30000
hostPort: 32000
- containerPort: 3000 # Gitea NodePort
hostPort: 30600
2 changes: 2 additions & 0 deletions docs/tutorials/starting-with-porch/kpt_packages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
15 changes: 15 additions & 0 deletions docs/tutorials/starting-with-porch/metallb-conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: example
namespace: metallb-system
spec:
addresses:
- 172.18.255.200-172.18.255.250
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: empty
namespace: metallb-system

21 changes: 21 additions & 0 deletions docs/tutorials/starting-with-porch/name-namespace-variant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: config.porch.kpt.dev/v1alpha2
kind: PackageVariantSet

metadata:
name: network-function-auto-namespace
namespace: porch-demo

spec:
upstream:
repo: management
package: network-function-auto-namespace
revision: v1
targets:
- repositories:
- name: edge1
packageNames:
- network-function-auto-namespace-x
- network-function-auto-namespace-y
template:
downstream:
packageExpr: "target.package + '-cumulonimbus'"
59 changes: 59 additions & 0 deletions docs/tutorials/starting-with-porch/porch-repositories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: config.porch.kpt.dev/v1alpha1
kind: Repository

metadata:
name: edge1
namespace: porch-demo

spec:
description: edge1
content: Package
deployment: true
type: git
git:
repo: http://172.18.255.200:3000/nephio/edge1.git
directory: /
branch: main
createBranch: true
secretRef:
name: gitea

---

apiVersion: config.porch.kpt.dev/v1alpha1
kind: Repository

metadata:
name: management
namespace: porch-demo

spec:
description: management
content: Package
deployment: false
type: git
git:
repo: http://172.18.255.200:3000/nephio/management.git
directory: /
branch: main
secretRef:
name: gitea

---

apiVersion: config.porch.kpt.dev/v1alpha1
kind: Repository

metadata:
name: external-blueprints
namespace: porch-demo

spec:
description: External blueprints
content: Package
deployment: false
type: git
git:
repo: https://github.com/nephio-project/free5gc-packages.git
directory: /
branch: main
2 changes: 2 additions & 0 deletions docs/tutorials/starting-with-porch/repos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
18 changes: 18 additions & 0 deletions docs/tutorials/starting-with-porch/simple-variant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: config.porch.kpt.dev/v1alpha2
kind: PackageVariantSet

metadata:
name: network-function
namespace: porch-demo

spec:
upstream:
repo: management
package: network-function
revision: v1
targets:
- repositories:
- name: edge1
packageNames:
- network-function-b
- network-function-c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore

0 comments on commit 987b231

Please sign in to comment.