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

Enable containersV2 by default #369

Merged
merged 5 commits into from
Jan 10, 2024

Conversation

mpritham
Copy link
Contributor

@mpritham mpritham commented Jan 9, 2024

Before this PR

In #361 we introduced the containersV2 flag. After observing improvements across several stacks, we'd like to enable the functionality guarded by the flag as the default behavior. We'd like to keep the option open for devs to disable the behavior if needed, by setting the containersV2 flag to false.

After this PR

==COMMIT_MSG==
Enable containersV2 by default.
==COMMIT_MSG==

Possible downsides?

N/A.

@changelog-app
Copy link

changelog-app bot commented Jan 9, 2024

Generate changelog in changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Enable containersV2 by default.

Check the box to generate changelog(s)

  • Generate changelog entry

@mpritham mpritham self-assigned this Jan 9, 2024
wip: Make containerV2 default to true

wip: Make containerV2 default to true

wip: re-add containerv2 flag to test configs.

add debug logs

remove more containerV2 flags

try omitempty

use setToDefaults

outparamcheck

use field.Addr().Interface()

pass addr of conf

don't take addr of unaddressable value

use *bool

set default

update config_test

set containerv2: false for existing configs

nil check

update test expectation

Remove debug logs. Add nl
@mpritham mpritham force-pushed the pmarupaka/containers-v2-default branch from 7161e99 to 4f135ba Compare January 9, 2024 02:11
@mpritham mpritham marked this pull request as draft January 9, 2024 02:11
@mpritham mpritham marked this pull request as ready for review January 9, 2024 02:14
@@ -144,7 +144,7 @@ func TestMainMethodWithoutCustomConfig(t *testing.T) {
}

func TestMainMethodContainerWithoutCustomConfig(t *testing.T) {
output := testContainerSupportEnabled(t, "foo", "-XX\\:InitialRAMPercentage=75.0 -XX\\:MaxRAMPercentage=75.0 -XX\\:ActiveProcessorCount=2", []string{})
output := testContainerSupportEnabled(t, "foo", "", []string{"-Xmx", "-Xms"})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there is a no custom config, or there is a failure to read the custom config, we use the new default behavior, hence this change.

@@ -3,3 +3,5 @@ configVersion: 1
jvmOpts:
- '-Xmx1g'
dangerousDisableContainerSupport: true
experimental:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting the flag to false to retain tests for old behavior for now.

@@ -267,6 +267,10 @@ func parseCustomConfig(yamlString []byte) (PrimaryCustomLauncherConfig, error) {
"subProcess config %s", name)
}
}
if config.Experimental.ContainerV2 == nil {
var trueVal = true
config.Experimental.ContainerV2 = &trueVal
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've seen this pattern elsewhere, but it would be nice if I could make this one line.

Copy link
Contributor

@andybradshaw andybradshaw Jan 9, 2024

Choose a reason for hiding this comment

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

I don't think there's anything in the standard library for it :( but there are some pretty small deps for doing something like this:

package main

import (
    "fmt"
    "k8s.io/utils/ptr"
)

func main() {
    a := ptr.To(false)
    fmt.Printf("%T %v", a, *a)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I'm leaning towards not adding the dep since we use this in one place in the implementation (and also once in the tests).

@carterkozak
Copy link
Contributor

Thanks @mpritham and @andybradshaw! 👍

@bulldozer-bot bulldozer-bot bot merged commit b255dce into develop Jan 10, 2024
6 checks passed
@bulldozer-bot bulldozer-bot bot deleted the pmarupaka/containers-v2-default branch January 10, 2024 19:48
@svc-autorelease
Copy link
Collaborator

Released 1.101.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants