-
Notifications
You must be signed in to change notification settings - Fork 199
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
PEP 006 outputs api #2763
Merged
Merged
PEP 006 outputs api #2763
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
2488fb1
parent 8ff74f4fdff39b83db963f23e64500d4ebf823cb
2c02d1f
chore: update arhive test shasum to account for containerregistry man…
bdegeeter dc1480e
chore: address lint issues
bdegeeter 9e4c1c0
Bump github.com/docker/cli
dependabot[bot] caf1e76
Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
dependabot[bot] 9a451ff
Update CODEOWNERS
schristoff d1f94de
Bump github.com/docker/distribution
dependabot[bot] 63c65dd
Adds custom section to output
tompaana 8d1623a
Restores mixins in table output
tompaana 8984cee
Removes commented out line
tompaana d4974ae
Minor fix
tompaana 8085119
Done it the proper way this time I think
tompaana 529fa18
Modifies test data to support custom output
tompaana b08a1f5
Fixes order in expected output as it is sorted
tompaana 79afd0f
Updates porter explain documentation
tompaana 109a73f
Adding my name to the list of contributors
tompaana f1446e8
Fixes based in review
tompaana 05d34f2
Grammar fix
tompaana 8763ddd
update hugo to v0.112.7
Arhell c26ca16
Bump github.com/docker/docker
dependabot[bot] 9b89b32
update helm3 mixin link and changed client version in docs
troy0820 1b79fa2
add troy0820 to contributors
troy0820 311f2dd
chore: basic repo structure for grpc api
7ab9361
chore: go mod tidy
bdegeeter ff220e2
chore: fixes for integration tests
bdegeeter c5834b1
chore: fix mage imports
bdegeeter 6b2b29c
Merge branch 'main' into pep-006-outputs-api
bdegeeter ba15bfd
chore: build flags for grpc service and other PR feedback
bdegeeter a3d0462
chore: rename grpc-server to api-server
bdegeeter 16277ac
Merge branch 'main' into pep-006-outputs-api
bdegeeter f6595ea
chore: address lint issues
bdegeeter 450a4b7
docs: Added docstring to porter server struct and middleware
sgettys 6d5fd72
chore: cleanup signals based on pr feedback
bdegeeter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
* | ||
|
||
!bin/dev/porter-linux-amd64 | ||
!bin/dev/porter-linux-arm64 | ||
!bin/dev/porter-api-server-linux-amd64 | ||
!bin/dev/porter-api-server-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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM alpine:3 as builder | ||
ARG TARGETARCH | ||
WORKDIR /app/.porter | ||
|
||
RUN mkdir runtimes && \ | ||
mkdir -p mixins/exec/runtimes | ||
|
||
# Install porter-api-server, agent, and the exec mixin, everything else | ||
COPY bin/dev/porter-api-server-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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/protoc-gen-go@v1.28 | ||
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 | ||
WORKDIR /proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 buildGRPCServerCommands(p *porter.Porter) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "api-server", | ||
Short: "API server", | ||
Long: "Launch API 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": "api-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", "api-server", "Server service name") | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "./" | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
porter -> Porter (it is the nittiest of nits, but I only included it because I'm going to point out....) -> and <link?> ?