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

Git source #658

Merged
merged 25 commits into from
Sep 19, 2024
Merged

Git source #658

merged 25 commits into from
Sep 19, 2024

Conversation

blampe
Copy link
Contributor

@blampe blampe commented Sep 10, 2024

Open questions:

  • I'm currently passing auth information via env vars to the workspace init container. Do we want to provide them a different way?
  • The current API is allows auth to be specified via literals, env vars or on-disk files but these don't make sense in an agent/server model. I'm inclined to say we should only support secret refs for these fields, but this is technically a breaking change for anyone currently specifying literals/vars/files. Otherwise I think we'll need to mirror the flexible types in the workspace and add some logic to the agent to resolve them at runtime (might need Setup an "in-cluster" kubeconfig within the workspace pod #652?). What do you guys think?

Summary of changes so far:

  • Fetch latest git commit using an in-memory object store.
  • Agent's init now uses automation API to clone the repo. Seems like a natural place to dogfood.
  • Removed code for gitAuthSecret since it was marked deprecated in v1.
  • Exposed a "shallow" option to the stack API for controlling shallowness. We don't currently perform shallow clones so this is backwards compatible.

Fixes #655

@blampe blampe added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Sep 10, 2024
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 70.02967% with 101 lines in your changes missing coverage. Please review.

Project coverage is 26.17%. Comparing base (3f0a0b4) to head (be32ff2).
Report is 1 commits behind head on v2.

Files with missing lines Patch % Lines
...r/internal/controller/auto/workspace_controller.go 28.30% 32 Missing and 6 partials ⚠️
...tor/internal/controller/pulumi/stack_controller.go 34.21% 22 Missing and 3 partials ⚠️
agent/cmd/init.go 69.44% 19 Missing and 3 partials ⚠️
operator/internal/controller/pulumi/git.go 90.80% 12 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v2     #658      +/-   ##
==========================================
+ Coverage   20.66%   26.17%   +5.50%     
==========================================
  Files          25       25              
  Lines        3769     3947     +178     
==========================================
+ Hits          779     1033     +254     
+ Misses       2867     2772      -95     
- Partials      123      142      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@EronWright EronWright left a comment

Choose a reason for hiding this comment

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

Looking great, and thanks for using GIT_ vars.

On the topic of SSH known hosts, what's the minimum we need to do? Keep in mind that the user can customize the pu/pu docker image.

I too encountered the "breaking change" you mentioned, when porting the stack configuration code. The "local file" or "local env variable" reference makes little sense now, and would it be interpreted as a reference to the operator pod or to the workspace pod? I think we should flag it as a migration issue, and eventually add validation logic to reject it.

@@ -1016,6 +1002,35 @@ func (sess *StackReconcilerSession) resolveResourceRefAsConfigItem(ctx context.C
}
}

// resolveResourceRef reads a referenced object and returns its value as a string.
func (sess *StackReconcilerSession) resolveResourceRef(ctx context.Context, ref *shared.ResourceRef) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hopefully we can remove this method, and defer resolution of the value to the workspace pod. In other words the operator shouldn't see the resolved value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline - operator needs to resolve these in order to poll the remote for latest commit.

operator/internal/controller/pulumi/git.go Outdated Show resolved Hide resolved
@blampe
Copy link
Contributor Author

blampe commented Sep 16, 2024

On the topic of SSH known hosts, what's the minimum we need to do? Keep in mind that the user can customize the pu/pu docker image.

I removed this TODO. Instead of accepting whatever the host's key is currently, we should encourage the user to customize the workspace with a custom mount containing the expected keys.

@blampe blampe requested a review from EronWright September 16, 2024 20:11
agent/cmd/init.go Outdated Show resolved Hide resolved
operator/go.mod Outdated Show resolved Hide resolved
operator/internal/controller/auto/workspace_controller.go Outdated Show resolved Hide resolved
operator/internal/controller/pulumi/git.go Show resolved Hide resolved
operator/internal/controller/pulumi/git.go Outdated Show resolved Hide resolved
operator/internal/controller/pulumi/git.go Show resolved Hide resolved
operator/internal/controller/pulumi/git.go Show resolved Hide resolved
@@ -16,7 +26,6 @@ import (
"github.com/pulumi/pulumi/sdk/v3/go/auto"
Copy link
Contributor

@EronWright EronWright Sep 16, 2024

Choose a reason for hiding this comment

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

Odd to see auto imported here. Would have expected the autov1alpha package.
(are these tests obsolete?)

@blampe blampe merged commit 3cb8900 into v2 Sep 19, 2024
7 checks passed
@blampe blampe deleted the blampe/v2-git branch September 19, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants