-
Notifications
You must be signed in to change notification settings - Fork 61
Update garbage collection #717
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import ( | |
| "strconv" | ||
| "time" | ||
|
|
||
| "github.com/openshift/release-controller/pkg/apis/release/v1alpha1" | ||
| releasecontroller "github.com/openshift/release-controller/pkg/release-controller" | ||
|
|
||
| batchv1 "k8s.io/api/batch/v1" | ||
|
|
@@ -417,3 +418,44 @@ func (c *Controller) ensureReleaseMirrorJob(release *releasecontroller.Release, | |
| func releaseMirrorJobName(tagName string) string { | ||
| return fmt.Sprintf("%s-alternate-mirror", tagName) | ||
| } | ||
|
|
||
| // ensureRemoveTagJob creates a job to copy rc_payload__{version} to remove__rc_payload__{version} in quay.io | ||
| func (c *Controller) ensureRemoveTagJob(payload *v1alpha1.ReleasePayload, release *releasecontroller.Release) (*batchv1.Job, error) { | ||
| if len(release.Config.AlternateImageRepository) == 0 || len(release.Config.AlternateImageRepositorySecretName) == 0 { | ||
| return nil, fmt.Errorf("alternate repository or secret not configured") | ||
| } | ||
|
|
||
| jobName := fmt.Sprintf("%s-remove-tag", payload.Name) | ||
| return c.ensureJob(jobName, nil, func() (*batchv1.Job, error) { | ||
| // Get cli image from mirror or config | ||
| cliImage := "registry.ci.openshift.org/ocp/4.16:cli" | ||
| if mirror, err := c.releaseLister.ImageStreams(release.Target.Namespace).Get(release.Target.Name); err == nil { | ||
| cliImage = fmt.Sprintf("%s:cli", mirror.Status.DockerImageRepository) | ||
| } | ||
| if len(release.Config.OverrideCLIImage) > 0 { | ||
| cliImage = release.Config.OverrideCLIImage | ||
| } | ||
|
|
||
| job, prefix := newReleaseJobBase(jobName, cliImage, release.Config.AlternateImageRepositorySecretName) | ||
|
|
||
| rcPayloadTag := fmt.Sprintf("rc_payload__%s", payload.Name) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We currently do not create release tags named anything like:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we will be using similar here
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused... |
||
| removeTag := fmt.Sprintf("remove__rc_payload__%s", payload.Name) | ||
| fromImage := fmt.Sprintf("%s:%s", release.Config.AlternateImageRepository, rcPayloadTag) | ||
| toImage := fmt.Sprintf("%s:%s", release.Config.AlternateImageRepository, removeTag) | ||
|
|
||
| job.Spec.Template.Spec.Containers[0].Command = []string{ | ||
| "/bin/bash", "-c", | ||
| prefix + ` | ||
| oc image mirror --keep-manifest-list=true $1 $2 | ||
| `, | ||
| "", | ||
| fromImage, toImage, | ||
| } | ||
|
|
||
| job.Annotations[releasecontroller.ReleaseAnnotationReleaseTag] = payload.Name | ||
| job.Annotations[releasecontroller.ReleaseAnnotationTarget] = fmt.Sprintf("%s/%s", payload.Spec.PayloadCoordinates.Namespace, payload.Spec.PayloadCoordinates.ImagestreamName) | ||
|
|
||
| klog.V(2).Infof("Creating remove tag job %s/%s to copy %s to %s", c.jobNamespace, job.Name, fromImage, toImage) | ||
| return job, nil | ||
| }) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,7 +152,7 @@ type ReleaseConfig struct { | |
| // AlternateImageRepository is the full path to an external Image Repository where we | ||
| // will mirror Accepted releases to. | ||
| // For example: | ||
| // "alternateImageRepository": "quay.io/openshift-release-dev/dev-release" | ||
| // "alternateImageRepository": "quay.io/openshift/ci" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is literally just a comment reference. If/when this goes live, you'll need to update all the respective references, like here: https://github.com/openshift/release/blob/6e2ede7d8f765e123cb1c0cfaf33f80a92a2b9e5/core-services/release-controller/_releases/release-ocp-4.21-ci.json#L10-L11 |
||
| AlternateImageRepository string `json:"alternateImageRepository"` | ||
|
|
||
| // AlternateImageRepositorySecret is the name of the secret containing credentials to the | ||
|
|
||
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.
4.21)