Skip to content
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

Use init process #367

Merged
merged 4 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,3 @@ dockers:
- "--label=org.label-schema.name={{ .ProjectName }}"
- "--label=org.label-schema.vcs-ref={{ .ShortCommit }}"
- "--label=org.label-schema.vcs-url='{{ .GitURL }}'"

extra_files:
- "build/bin"
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ CHANGELOG
[#365](https://github.com/pulumi/pulumi-kubernetes-operator/pull/365)
- Rewrite test case to confirm to Pulumi YAML 1.0 (breaking) changes
[#369](https://github.com/pulumi/pulumi-kubernetes-operator/pull/369)
- Use an init process so processes spawned by `pulumi` are reaped
[#367](https://github.com/pulumi/pulumi-kubernetes-operator/pull/367)

## 1.10.1 (2022-10-25)

Expand Down
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
FROM pulumi/pulumi:3.46.0

ENV OPERATOR=/usr/local/bin/pulumi-kubernetes-operator
RUN apt-get install tini
ENTRYPOINT ["tini", "--", "/usr/local/bin/pulumi-kubernetes-operator"]

# install operator binary
COPY pulumi-kubernetes-operator ${OPERATOR}

COPY build/bin/* /usr/local/bin/
RUN /usr/local/bin/user_setup
COPY pulumi-kubernetes-operator /usr/local/bin/pulumi-kubernetes-operator

RUN useradd -m pulumi-kubernetes-operator
RUN mkdir -p /home/pulumi-kubernetes-operator/.ssh \
Expand All @@ -22,4 +20,3 @@ ENV XDG_CONFIG_CACHE=/tmp/.cache
ENV GOCACHE=/tmp/.cache/go-build
ENV GOPATH=/tmp/.cache/go

ENTRYPOINT ["/usr/local/bin/entrypoint"]
4 changes: 0 additions & 4 deletions build/bin/entrypoint

This file was deleted.

11 changes: 0 additions & 11 deletions build/bin/user_setup

This file was deleted.

10 changes: 10 additions & 0 deletions pkg/controller/stack/stack_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,12 @@ func (sess *reconcileStackSession) DestroyStack(ctx context.Context) error {
func (sess *reconcileStackSession) SetupGitAuth(ctx context.Context) (*auto.GitAuth, error) {
gitAuth := &auto.GitAuth{}

// check that the URL is valid (and we'll use it later to check we got appropriate auth)
u, err := giturls.Parse(sess.stack.ProjectRepo)
if err != nil {
return gitAuth, err
}

if sess.stack.GitAuth != nil {
if sess.stack.GitAuth.SSHAuth != nil {
privateKey, err := sess.resolveResourceRef(ctx, &sess.stack.GitAuth.SSHAuth.SSHPrivateKey)
Expand Down Expand Up @@ -1516,6 +1522,10 @@ func (sess *reconcileStackSession) SetupGitAuth(ctx context.Context) (*auto.GitA
}
}

if u.Scheme == "ssh" && gitAuth.SSHPrivateKey == "" {
return gitAuth, fmt.Errorf("a private key must be provided for SSH")
}

return gitAuth, nil
}

Expand Down