Skip to content

cmd: ex: standalone docker garbage collector #16796

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

Merged
merged 1 commit into from
Oct 20, 2017

Conversation

sjenning
Copy link
Contributor

This implements a standalone docker GC daemon for use in OpenShift when using a non-docker runtime (e.g. cri-o) but using docker for builds.

https://trello.com/c/iO9d9R1w

$ openshift ex dockergc --help
Perform garbage collection to free space in docker storage 

If the OpenShift node is configured to use a container runtime other than docker, docker will still be used to do
builds.  However OpenShift itself will not manage the docker storage since it is not the container runtime for pods. 

This utility allows garbage collection to do be done on the docker storage.

Usage:
  openshift ex dockergc [NAME] [options]

Examples:
  # Perform garbage collection with the default settings
  openshift ex dockergc

Options:
      --dry-run=false: If true, show the result of the operation without performing it.
      --image-gc-high-threshold=80: The percent of disk usage after which image garbage collection is always run.
      --image-gc-low-threshold=60: The percent of disk usage before which image garbage collection is never run. Lowest
disk usage to garbage collect to.
      --minimum-ttl-duration=1h0m0s: Minimum age for a container or unused image before it is garbage collected.
Examples: '300ms', '10s' or '2h45m'.
  -o, --output='': Output results as yaml or json instead of executing, or use name for succint output (resource/name).
  -a, --show-all=false: When printing, show all resources (default hide terminated pods.)
      --show-labels=false: When printing, show all labels as the last column (default hide labels column)
      --sort-by='': If non-empty, sort list types using this field specification.  The field specification is expressed
as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression
must be an integer or a string.
      --template='': Template string or path to template file to use when -o=go-template, -o=go-template-file. The
template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].

Use "openshift options" for a list of global command-line options (applies to all commands).

@derekwaynecarr @vikaschoudhary16

@sjenning sjenning added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 11, 2017
@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 11, 2017
@derekwaynecarr
Copy link
Member

can you add a yaml demonstrating how you would run this on cluster?

@csrwng
Copy link
Contributor

csrwng commented Oct 11, 2017

/unassign

@sjenning
Copy link
Contributor Author

@derekwaynecarr added the example daemonset spec and serviceaccount with required scc

@enj
Copy link
Contributor

enj commented Oct 17, 2017

/unassign

Missing too much context to review 😄

@sjenning sjenning removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 17, 2017
@sjenning sjenning changed the title [WIP] cmd: ex: standalone docker garbage collector cmd: ex: standalone docker garbage collector Oct 17, 2017
@sjenning sjenning assigned derekwaynecarr and unassigned abstractj and mfojtik Oct 17, 2017
@sjenning
Copy link
Contributor Author

/retest

flake #16414

resources:
requests:
memory: 30Mi
cpu: 100m
Copy link
Member

Choose a reason for hiding this comment

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

can we size less? maybe 50m? how did you get to this number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

copied it from node-exporter 😄

Perform garbage collection to free space in docker storage

If the OpenShift node is configured to use a container runtime other than docker,
docker will still be used to do builds. However OpenShift itself will not
Copy link
Member

Choose a reason for hiding this comment

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

s/will/may

}

func doGarbageCollection(ctx context.Context, client *dockerapi.Client, options *dockerGCConfigCmdOptions, rootDir string) error {
capacityBytes, usageBytes, err := getRootDirInfo(rootDir)
Copy link
Member

Choose a reason for hiding this comment

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

can we do a log at each gc interval?

Copy link
Member

Choose a reason for hiding this comment

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

it would be good to have something that logs before gathering root dir info

@derekwaynecarr
Copy link
Member

@sjenning just a few nits.

@derekwaynecarr
Copy link
Member

running out of disk space on a cri-o server would be a bug.

/kind bug

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 18, 2017

dockerapi "github.com/docker/engine-api/client"
dockertypes "github.com/docker/engine-api/types"
dockerfilters "github.com/docker/engine-api/types/filters"
Copy link
Contributor

Choose a reason for hiding this comment

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

as long as these dependencies 1) already exist and 2) aren't ones we're trying to delete as part of the oc split (I don't think they are... @deads2k?), hanging this under experimental doesn't bother me

Copy link
Contributor

Choose a reason for hiding this comment

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

as long as these dependencies 1) already exist and 2) aren't ones we're trying to delete as part of the oc split (I don't think they are... @deads2k?), hanging this under experimental doesn't bother me

We do want to see this leave as part of oc. Is this command logically an oc adm command? If so, then openshift ex is ok and we'll move it to oc ex later.

Copy link
Member

@derekwaynecarr derekwaynecarr Oct 18, 2017

Choose a reason for hiding this comment

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

@deads2k it should actually not be oc but openshift ex. the command is temporary and is avoiding us having to ship an official product image.

@sjenning i think /pkg/cmd/openshift experimental is the right home for this. similar to those other experimental commands.

Copy link
Member

Choose a reason for hiding this comment

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

moved discussion to irc. agree w/ @deads2k that we may want to handle this similar to kubernetes-namespace-reservation

Copy link
Member

Choose a reason for hiding this comment

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

@sjenning -- @deads2k and i spoke in person. when oc moves out of tree, we will move this command with it. at that point, we will need to make sure our ops team has the updated daemonset.

@sjenning
Copy link
Contributor Author

/retest

@derekwaynecarr
Copy link
Member

/test extended_conformance_install_update

@derekwaynecarr
Copy link
Member

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 19, 2017
@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: derekwaynecarr, sjenning

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 19, 2017
@sjenning
Copy link
Contributor Author

/test extended_conformance_install_update

@sjenning
Copy link
Contributor Author

flake #16870
/test extended_conformance_install_update

@openshift-ci-robot
Copy link

openshift-ci-robot commented Oct 19, 2017

@sjenning: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/experimental/unit 299f412 link /test origin-ut

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 16667, 16796, 16960, 16965, 16894).

@openshift-merge-robot openshift-merge-robot merged commit 4fdb151 into openshift:master Oct 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.