Skip to content

Added example manifest of function pod service in function runner page of porch documentation #249

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
92 changes: 65 additions & 27 deletions content/en/docs/porch/function-runner-pod-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@ spec:
...
```

Additionally, porch-fn-runner pod needs to be have access to read this pod template configmap. Assuming porch-fn-runner pod is running in porch-system namespace, following Role and Rolebindings needs to be added to porch deployment manifests.

```yaml
kind: Role
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This RBAC should be added to the catalog and deployments/porch pkgs

apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: porch-fn-runner
namespace: porch-system
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: porch-fn-runner
namespace: porch-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: porch-fn-runner
subjects:
- kind: ServiceAccount
name: porch-fn-runner
```

## Example pod template

The below pod template ConfigMap matches the default behavior:
Expand All @@ -68,31 +95,42 @@ metadata:
name: kpt-function-eval-pod-template
data:
template: |
apiVersion: v1
kind: Pod
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: true
spec:
initContainers:
- name: copy-wrapper-server
image: gcr.io/example-google-project-id/porch-wrapper-server:latest
command:
- cp
- -a
- /wrapper-server/.
- /wrapper-server-tools
volumeMounts:
- name: wrapper-server-tools
mountPath: /wrapper-server-tools
containers:
- name: function
image: image-replaced-by-kpt-func-image
command:
- /wrapper-server-tools/wrapper-server
volumeMounts:
- name: wrapper-server-tools
mountPath: /wrapper-server-tools
volumes:
- name: wrapper-server-tools
emptyDir: {}
apiVersion: v1
kind: Pod
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: true
spec:
initContainers:
- name: copy-wrapper-server
image: docker.io/nephio/porch-wrapper-server:latest
command:
- cp
- -a
- /wrapper-server/.
- /wrapper-server-tools
volumeMounts:
- name: wrapper-server-tools
mountPath: /wrapper-server-tools
containers:
- name: function
image: image-replaced-by-kpt-func-image
command:
- /wrapper-server-tools/wrapper-server
volumeMounts:
- name: wrapper-server-tools
mountPath: /wrapper-server-tools
volumes:
- name: wrapper-server-tools
emptyDir: {}
serviceTemplate: |
apiVersion: v1
kind: Service
spec:
ports:
- port: 9446
protocol: TCP
targetPort: 9446
selector:
fn.kpt.dev/image: to-be-replaced
type: ClusterIP
```
Loading