Skip to content

Commit

Permalink
parent 8ff74f4
Browse files Browse the repository at this point in the history
author Brian DeGeeter <[email protected]> 1673381173 -0800
committer Brian DeGeeter <[email protected]> 1684277785 -0700

parent 8ff74f4
author Brian DeGeeter <[email protected]> 1673381173 -0800
committer Brian DeGeeter <[email protected]> 1684277652 -0700

parent 8ff74f4
author Brian DeGeeter <[email protected]> 1673381173 -0800
committer Brian DeGeeter <[email protected]> 1684277541 -0700

chore: basic structure for grpc api

Signed-off-by: Brian DeGeeter <[email protected]>

chore: move make targets to mage

Signed-off-by: Brian DeGeeter <[email protected]>

wip: buf scaffolding

Signed-off-by: Steven Gettys <[email protected]>

chore: Added simple test client/server

chore: move grpc test under tests folder

Signed-off-by: Brian DeGeeter <[email protected]>

chore: add basic grpc server test

Signed-off-by: Brian DeGeeter <[email protected]>

chore: retire makefile

Signed-off-by: Brian DeGeeter <[email protected]>

chore: collab on failing porter integration

Signed-off-by: Brian DeGeeter <[email protected]>

Feat/add server to porter cmd (#2)

* wip: Saving state

* wip: Added per rpc connection

* chore: Removed debug prints

chore: Added server cli options

Signed-off-by: Steven Gettys <[email protected]>

chore: Fixed int viper conversion error

added grpc context for porter connection

feat: update proto file

chore: Generated new go grpc and moved test over to using the porter connection in the grpc context

chore: Added UT for grpc context package

Signed-off-by: Steven Gettys <[email protected]>

fill out installation list grpc response

use PorterTest for grpc integration tests

chore: Updated grpc integration tests to inject installations into the porter test client

Signed-off-by: Steven Gettys <[email protected]>

porter structs to grpc via json marshaling

chore: convert store install to display for grpc integ test

chore: Added UT for grpc context and installation packages

Signed-off-by: Steven Gettys <[email protected]>

chore: Consolidated duplicate test code for grpc installation service

chore: Refactored to use a single portergrpc package'

Signed-off-by: Steven Gettys <[email protected]>

chore: Renamed grpc PorterBundleServer to PorterServer

Signed-off-by: Steven Gettys <[email protected]>

chore: Checked in proto change

Signed-off-by: Steven Gettys <[email protected]>

chore: MOved around grpc package some

Signed-off-by: Steven Gettys <[email protected]>

chore: refactor grpc integ test

chore: remove porter-service cmd files

chore: refactor for integ testing

chore: add cred and param sets to installation proto

intial run outputs grpc func

refactor outputs proto to remove extra depth

chore: add test intallation opts for data driven grpc integ testing

chore: Testing out action (#3)

* chore: Testing out action

Signed-off-by: Steven Gettys <[email protected]>

* chore: Removed the DOCKER_BUILDKIT flag

Signed-off-by: Steven Gettys <[email protected]>

* chore: Removed docker buildkit

Signed-off-by: Steven Gettys <[email protected]>

* chore: Added default case

Signed-off-by: Steven Gettys <[email protected]>

---------

Signed-off-by: Steven Gettys <[email protected]>

Bump github.com/moby/buildkit from 0.10.6 to 0.11.0 (getporter#2520)

* Bump github.com/moby/buildkit from 0.10.6 to 0.11.0

Signed-off-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Yingrong Zhao <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yingrong Zhao <[email protected]>

Bump github.com/google/go-containerregistry from 0.12.1 to 0.13.0

Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.12.1 to 0.13.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](google/go-containerregistry@v0.12.1...v0.13.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Address go-restful CVE-2022-1996 (getporter#2547)

* Address go-restful CVE-2022-1996

* Upgrade go-restful to v3 which addresses CVE-2022-1996
* Upgrade containerd to v1.6.16
* Upgrade cnab-go to v1.25.0
* Upgrade docker to v23.0.0-rc.1
* Upgrade buildx to v0.10.2 which required some careful code changes to compile again

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Pin cnab-go to v0.25.0

Signed-off-by: Carolyn Van Slyck <[email protected]>

---------

Signed-off-by: Carolyn Van Slyck <[email protected]>

Bump github.com/stretchr/testify from 1.8.1 to 1.8.2

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.8.1...v1.8.2)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Bump github.com/grpc-ecosystem/go-grpc-middleware from 1.3.0 to 1.4.0

Bumps [github.com/grpc-ecosystem/go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/grpc-ecosystem/go-grpc-middleware/releases)
- [Commits](grpc-ecosystem/go-grpc-middleware@v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: github.com/grpc-ecosystem/go-grpc-middleware
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Bump github.com/spf13/afero from 1.9.4 to 1.9.5

Bumps [github.com/spf13/afero](https://github.com/spf13/afero) from 1.9.4 to 1.9.5.
- [Release notes](https://github.com/spf13/afero/releases)
- [Commits](spf13/afero@v1.9.4...v1.9.5)

---
updated-dependencies:
- dependency-name: github.com/spf13/afero
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Bump github.com/hashicorp/go-hclog from 1.4.0 to 1.5.0

Bumps [github.com/hashicorp/go-hclog](https://github.com/hashicorp/go-hclog) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/hashicorp/go-hclog/releases)
- [Commits](hashicorp/go-hclog@v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-hclog
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Bump github.com/google/go-containerregistry from 0.13.0 to 0.14.0

Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.13.0 to 0.14.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](google/go-containerregistry@v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Bump github.com/containerd/containerd from 1.6.19 to 1.7.0

Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.19 to 1.7.0.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](containerd/containerd@v1.6.19...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Revert "Merge pull request getporter#2653 from getporter/dependabot/go_modules/github.com/google/go-containerregistry-0.14.0"

This reverts commit 7ee355f, reversing
changes made to 09297d6.

Signed-off-by: Carolyn Van Slyck <[email protected]>

Bump go.mongodb.org/mongo-driver from 1.11.3 to 1.11.4

Bumps [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) from 1.11.3 to 1.11.4.
- [Release notes](https://github.com/mongodb/mongo-go-driver/releases)
- [Commits](mongodb/mongo-go-driver@v1.11.3...v1.11.4)

---
updated-dependencies:
- dependency-name: go.mongodb.org/mongo-driver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

chore: basic structure for grpc api

Signed-off-by: Brian DeGeeter <[email protected]>
Signed-off-by: Steven Gettys <[email protected]>

Co-authored-by: Brian DeGeeter <[email protected]>
Co-authored-by: Steven Gettys <[email protected]>

chore: fix tests after rebase

Signed-off-by: Brian DeGeeter <[email protected]>

chore: tidy up go.sum

Signed-off-by: Brian DeGeeter <[email protected]>

chore: remove wip file

Signed-off-by: Brian DeGeeter <[email protected]>
  • Loading branch information
Brian DeGeeter authored and bdegeeter committed May 16, 2023
1 parent 8ff74f4 commit 4afbc53
Show file tree
Hide file tree
Showing 40 changed files with 3,057 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*

!bin/dev/porter-linux-amd64
!bin/dev/porter-linux-arm64
!bin/dev/agent-linux-amd64
!bin/dev/agent-linux-arm64
!bin/mixins/exec/dev/exec-linux-amd64
!bin/mixins/exec/dev/exec-linux-arm64
36 changes: 36 additions & 0 deletions .github/workflows/build-publish-from-fork.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build-publish-from-fork
on:
workflow_dispatch: {}
push: {}
pull_request: {}

jobs:
build:
runs-on: ubuntu-latest
if: github.repository != 'getporter/porter'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Set up Mage
run: go run mage.go EnsureMage
- name: Publish
if: ${{ github.event_name != 'pull_request' }}
env:
PORTER_REGISTRY: ghcr.io/${{ github.repository }}
run: |
mage -v XBuildAll
mage -v PublishServerMultiArchImages
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ examples/**/Dockerfile
workshop/**/Dockerfile

.vscode
*.code-workspace
.idea
kind.config
grpc-porter-tls.crt
grpc-porter-tls.key
grpc-porter.csr
.grpcurl/
config.yaml
29 changes: 29 additions & 0 deletions build/images/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM alpine:3 as builder
WORKDIR /app/.porter
ARG TARGETARCH

RUN mkdir runtimes && \
mkdir -p mixins/exec/runtimes

# Install porter, agent, and the exec mixin, everything else
# must be mounted into the container
COPY bin/dev/porter-linux-${TARGETARCH} porter
COPY bin/dev/agent-linux-${TARGETARCH} agent
COPY bin/mixins/exec/dev/exec-linux-${TARGETARCH} mixins/exec/exec
RUN ln -s /app/.porter/porter runtimes/porter-runtime && \
ln -s /app/.porter/mixins/exec/exec mixins/exec/runtimes/exec-runtime

# Copy the porter installation into a distroless container
# Explicitly not using the nonroot tag because we don't want the user to exist so it is placed in the root group
# This allows us to run with a random UID, and access a mounted docker socket (which is only accessible via the root group)
FROM gcr.io/distroless/static
WORKDIR /app
COPY --from=builder --chown=65532:0 --chmod=770 /app/.porter /app/.porter
ENV PATH "$PATH:/app/.porter"
# This is where files that need to be copied into /app/.porter/ should be mounted
VOLUME /porter-config
ENV PORTER_HOME /app/.porter

# Run as a nonroot user
USER 65532
ENTRYPOINT ["/app/.porter/agent"]
5 changes: 5 additions & 0 deletions build/protoc.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM golang:1.19.0
RUN apt-get update && apt-get -y install protobuf-compiler
RUN go install google.golang.org/protobuf/cmd/[email protected]
RUN go install google.golang.org/grpc/cmd/[email protected]
WORKDIR /proto
1 change: 1 addition & 0 deletions cmd/porter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ Try our QuickStart https://getporter.org/quickstart to learn how to use Porter.
cmd.AddCommand(buildCredentialsCommands(p))
cmd.AddCommand(buildParametersCommands(p))
cmd.AddCommand(buildCompletionCommand(p))
cmd.AddCommand(buildServerCommands(p))

for _, alias := range buildAliasCommands(p) {
cmd.AddCommand(alias)
Expand Down
58 changes: 58 additions & 0 deletions cmd/porter/server.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package main

import (
"time"

grpc "get.porter.sh/porter/pkg/grpc"
"get.porter.sh/porter/pkg/porter"
"get.porter.sh/porter/pkg/signals"
"github.com/spf13/cobra"
)

func buildServerCommands(p *porter.Porter) *cobra.Command {
cmd := &cobra.Command{
Use: "server",
Short: "Server commands",
Long: "Command for working with the gRPC server for porter",
Hidden: true, // This is a hidden command and is currently only meant to be used by the porter operator
}
cmd.Annotations = map[string]string{
"group": "server",
}
cmd.AddCommand(buildServerRunCommand(p))
return cmd
}

func buildServerRunCommand(p *porter.Porter) *cobra.Command {
opts := porter.ServiceOptions{}
cmd := &cobra.Command{
Use: "run",
Short: "Run the gRPC server",
Long: `Run the gRPC server for porter.
This command starts the gRPC server for porter which is able to expose limited porter functionality via RPC.
Currently only data operations are supported, creation of resources such as installations, credential sets, or parameter sets is not supported.
A list of the supported RPCs can be found at <link?>
`,
PreRunE: func(cmd *cobra.Command, args []string) error {
return opts.Validate()
},
RunE: func(cmd *cobra.Command, args []string) error {
srv, err := grpc.NewServer(cmd.Context(), &opts)
if err != nil {
return err
}
grpcServer, err := srv.ListenAndServe()
stopCh := signals.SetupSignalHandler()
serverShutdownTimeout := time.Duration(time.Second * 30)
sd, _ := signals.NewShutdown(serverShutdownTimeout, cmd.Context())
sd.Graceful(stopCh, grpcServer, cmd.Context())
return err
},
}
f := cmd.Flags()
f.Int64VarP(&opts.Port, "port", "p", 3001, "Port to run the server on")
f.StringVarP(&opts.ServiceName, "service-name", "s", "grpc-server", "Server service name")
return cmd
}
19 changes: 19 additions & 0 deletions docker-bake.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"group": {
"default": {
"targets": [
"server"
]
}
},
"target": {
"server": {
"platforms": [
"linux/amd64",
"linux/arm64"
],
"dockerfile": "build/images/server/Dockerfile",
"context": "./"
}
}
}
Loading

0 comments on commit 4afbc53

Please sign in to comment.