Skip to content

Commit

Permalink
Create function-runner Deployment (kptdev#2733)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmaly committed Feb 18, 2022
1 parent cee0229 commit 156bc76
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 7 deletions.
11 changes: 4 additions & 7 deletions porch/func/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,25 @@ func createResourceList(args []string) ([]byte, error) {
r := kio.LocalPackageReader{
PackagePath: *packageFlag,
IncludeSubpackages: true,
}
nodes, err := r.Read()
if err != nil {
return nil, fmt.Errorf("failed to read package: %w", err)
WrapBareSeqNode: true,
}

cfg, err := configmap(args)
if err != nil {
return nil, fmt.Errorf("failed to create function config: %w", err)
}

b := bytes.NewBuffer(nil)
var b bytes.Buffer
w := kio.ByteWriter{
Writer: b,
Writer: &b,
KeepReaderAnnotations: true,
Style: 0,
FunctionConfig: cfg,
WrappingKind: kio.ResourceListKind,
WrappingAPIVersion: kio.ResourceListAPIVersion,
}

if err := w.Write(nodes); err != nil {
if err := (kio.Pipeline{Inputs: []kio.Reader{r}, Outputs: []kio.Writer{w}}).Execute(); err != nil {
return nil, fmt.Errorf("failed to create serialized ResourceList: %w", err)
}

Expand Down
50 changes: 50 additions & 0 deletions porch/func/config/deploy/function-runner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: Deployment
metadata:
name: function-runner
namespace: porch-system
spec:
replicas: 2
selector:
matchLabels:
app: function-runner
template:
metadata:
labels:
app: function-runner
spec:
containers:
- name: function-runner
image: UPDATE_ME
imagePullPolicy: Always
ports:
- containerPort: 9445

---

apiVersion: v1
kind: Service
metadata:
name: function-runner
namespace: porch-system
spec:
selector:
app: function-runner
ports:
- port: 9445
protocol: TCP
targetPort: 9445
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 156bc76

Please sign in to comment.