-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add support for platform 010 #1332
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## main #1332 +/- ##
==========================================
- Coverage 67.34% 67.17% -0.17%
==========================================
Files 133 138 +5
Lines 8210 8503 +293
==========================================
+ Hits 5529 5712 +183
- Misses 2231 2343 +112
+ Partials 450 448 -2
|
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Still to do:
Before I proceed further, I'd like to confirm that we indeed want to add these additional resources ^^ (Slack thread) Maintainers, please opine! |
e735f8a
to
16515e9
Compare
@@ -10,6 +10,6 @@ unit-ci: | |||
$(GOCMD) test ./pkg/... -coverprofile=coverage.txt -covermode=atomic | |||
|
|||
e2e: | |||
$(GOCMD) test --timeout=30m -v ./test/... | |||
$(GOCMD) test --timeout=30m -failfast -v ./test/... |
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.
We don't have to add this... but I like it
Signed-off-by: Natalie Arellano <narellano@vmware.com>
16515e9
to
160ce19
Compare
Signed-off-by: Natalie Arellano <narellano@vmware.com>
98befe4
to
dbaa66d
Compare
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@@ -8,7 +8,7 @@ import ( | |||
) | |||
|
|||
func TestParseURL(t *testing.T) { | |||
spec.Focus(t, "Test Parse Git URL", testParseURL) | |||
spec.Focus(t, "Test Parse Git URL", testParseURL) // TODO: should this be .Focus? |
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.
Is this a forgotten .Focus
?
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.
I suspect that it works because its the only thing in the function but it probably should not be a focus
}, | ||
Spec: buildapi.ExtensionSpec{ | ||
ImageSource: corev1alpha1.ImageSource{ | ||
Image: "natalieparellano/sample-extension", // FIXME |
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.
Perhaps we could build the sample extension and push it along with all the other images from hack/local.sh
or equivalent?
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.
that feels slightly odd to me since we don't do that with buildpacks. maybe we can put a sample extension in the projects ghcr repo or something
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.
I would prefer to use a properly released (read: maintained) extension, does CNB have a sample one? What about paketo or other well known buildpack authors?
//require.True(t, fakeTracker.IsTrackingKind( | ||
// kreconciler.KeyForObject(extension).GroupKind, | ||
// builder.NamespacedName())) | ||
//require.True(t, fakeTracker.IsTrackingKind( | ||
// kreconciler.KeyForObject(clusterExtension).GroupKind, | ||
// builder.NamespacedName())) |
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.
I have no idea what this is testing or why it's failing. Maintainers, please help!
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.
The tracker is a thing we use to force reconciliation of related objects. The usage is that it is first added as an event handler to a specific informer, and then during each reconcile loop we can decide to register individual things to track. Then when these things get modified (by the user or other controllers), it triggers a reconcile loop on a separate reconciler.
To give an example, the Builder reconciler sets up a tracker for all Buildpack objects. This is so that if a buildpack was changed (i.e. user updated the .spec.image
field), we want to force a reconciliation of any builders that uses it:
kpack/pkg/reconciler/builder/builder.go
Lines 97 to 101 in b14fce9
buildpackInformer.Informer().AddEventHandler(controller.HandleAll( | |
controller.EnsureTypeMeta( | |
c.Tracker.OnChanged, | |
buildapi.SchemeGroupVersion.WithKind(buildapi.BuildpackKind)), | |
)) |
Once the tracker is set to handle events for all Buildpacks, it can register individual objects (in this case a ClusterStore) for tracking
kpack/pkg/reconciler/builder/builder.go
Lines 175 to 184 in b14fce9
c.Tracker.Track(reconciler.Key{ | |
NamespacedName: types.NamespacedName{ | |
Name: builder.Spec.Store.Name, | |
Namespace: metav1.NamespaceAll, | |
}, | |
GroupKind: schema.GroupKind{ | |
Group: "kpack.io", | |
Kind: buildapi.ClusterStoreKind, | |
}, | |
}, builder.NamespacedName()) |
Or track all group kind (in this case Buildpacks) in a namespace
kpack/pkg/reconciler/builder/builder.go
Lines 192 to 195 in b14fce9
c.Tracker.TrackKind(schema.GroupKind{ | |
Group: "kpack.io", | |
Kind: buildapi.BuildpackKind, | |
}, builder.NamespacedName()) |
The test injects a fake tracker into the reconciler and asserts that it's setting up the expected namespaced-objects/group-version-kind to track.
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.
So you'll probably have to setup the tracker in the builder reconciler to also watch for changes to the [Cluster]Extension resource. If you don't, the builder won't be reconciled if a new extension is added, or if an existing extension changes.
//require.True(t, fakeTracker.IsTrackingKind( | ||
// kreconciler.KeyForObject(clusterExtension).GroupKind, builder.NamespacedName())) |
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.
I have no idea what this is testing or why it's failing. Maintainers, please help!
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.
Same as #1332 (comment), with the only difference being that it only watches for ClusterExtensions instead of both Extension and ClusterExtension
Signed-off-by: Natalie Arellano <narellano@vmware.com>
} | ||
|
||
func stackChange(lastBuild *buildapi.Build, builder buildapi.BuilderResource) buildchange.Change { | ||
if lastBuild == nil || !lastBuild.IsSuccess() { | ||
return nil | ||
} | ||
|
||
if len(builder.ExtensionMetadata()) > 0 { |
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.
Without this, if extensions are used to switch the runtime base image, the image will never stop building because the reconciler always sees a stack change. Future versions of kpack should improve this by (somehow) tying the image back to a "stack" that includes the runtime base image that was switched to.
Signed-off-by: Natalie Arellano <narellano@vmware.com>
The integration tests won't run in CI until this is merged, but here is my local output if that's helpful:
|
container.SecurityContext.RunAsUser = intPointer(0) | ||
container.SecurityContext.RunAsGroup = intPointer(0) | ||
container.SecurityContext.RunAsNonRoot = boolPointer(false) | ||
container.SecurityContext.Capabilities = &corev1.Capabilities{Add: []corev1.Capability{"SETGID", "SETUID"}} |
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.
Discussed in 10/31 Working Group, run as root is unnecessary if all we're doing is switching the runtime base. We should make this configurable by the end user (and default to the most secure setting).
@tomkennedy513 @chenbh did you have a chance to go through all the changes? If so I can pick this up again |
There are still some open TODOs but this is ready for detailed feedback
Summary of larger changes
Unresolved