-
Notifications
You must be signed in to change notification settings - Fork 553
✨ handle optionality of spec.grpcPodConfig.extractContent.cacheDir #3556
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
grokspawn
merged 1 commit into
operator-framework:master
from
grokspawn:extractcontent-optional-cache
May 2, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,6 +275,17 @@ func Pod(source *operatorsv1alpha1.CatalogSource, name, opmImg, utilImage, img s | |
Name: "catalog-content", | ||
MountPath: catalogPath, | ||
} | ||
// init container to copy catalog info. | ||
// ExtractContent.CatalogDir is mandatory when ExtractContent is provided | ||
// ExtractContent.CacheDir is optional, so we only add it if it is set | ||
var extractArgs = []string{ | ||
"--catalog.from=" + grpcPodConfig.ExtractContent.CatalogDir, | ||
"--catalog.to=" + fmt.Sprintf("%s/catalog", catalogPath), | ||
} | ||
if grpcPodConfig.ExtractContent.CacheDir != "" { | ||
extractArgs = append(extractArgs, "--cache.from="+grpcPodConfig.ExtractContent.CacheDir) | ||
extractArgs = append(extractArgs, "--cache.to="+fmt.Sprintf("%s/cache", catalogPath)) | ||
} | ||
pod.Spec.InitContainers = append(pod.Spec.InitContainers, corev1.Container{ | ||
Name: "extract-utilities", | ||
Image: utilImage, | ||
|
@@ -283,22 +294,18 @@ func Pod(source *operatorsv1alpha1.CatalogSource, name, opmImg, utilImage, img s | |
VolumeMounts: []corev1.VolumeMount{utilitiesVolumeMount}, | ||
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError, | ||
}, corev1.Container{ | ||
Name: "extract-content", | ||
Image: img, | ||
ImagePullPolicy: image.InferImagePullPolicy(img), | ||
Command: []string{utilitiesPath + "/copy-content"}, | ||
Args: []string{ | ||
"--catalog.from=" + grpcPodConfig.ExtractContent.CatalogDir, | ||
"--catalog.to=" + fmt.Sprintf("%s/catalog", catalogPath), | ||
Comment on lines
-291
to
-292
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 both we still have 👍 |
||
"--cache.from=" + grpcPodConfig.ExtractContent.CacheDir, | ||
"--cache.to=" + fmt.Sprintf("%s/cache", catalogPath), | ||
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. Thsi both are under |
||
}, | ||
Name: "extract-content", | ||
Image: img, | ||
ImagePullPolicy: image.InferImagePullPolicy(img), | ||
Command: []string{utilitiesPath + "/copy-content"}, | ||
Args: extractArgs, | ||
VolumeMounts: []corev1.VolumeMount{utilitiesVolumeMount, contentVolumeMount}, | ||
TerminationMessagePolicy: corev1.TerminationMessageFallbackToLogsOnError, | ||
}) | ||
|
||
pod.Spec.Containers[0].Image = opmImg | ||
pod.Spec.Containers[0].Command = []string{"/bin/opm"} | ||
// set service cache dir unconditionally, since it should always have compatible permissions for generation, if not provided by grpcPodConfig | ||
pod.Spec.Containers[0].Args = []string{ | ||
"serve", | ||
filepath.Join(catalogPath, "catalog"), | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we already have a check for this?
If ExtractContent is not empty and ExtractContent.CatalogDir is empty, we should raise an error with the following message:
"CatalogDir must be set when ExtractContent is provided."
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 do have that because CatalogDir is listed as required