Expose bundle data from bundle image#94
Expose bundle data from bundle image#94openshift-merge-robot merged 5 commits intooperator-framework:masterfrom
Conversation
a133142 to
33248b4
Compare
|
This update includes the code for launching a container to execute the new serve command and is feature complete, minus the tests. |
33248b4 to
d18f84f
Compare
d18f84f to
ec6e3c0
Compare
|
I just need to plumb the e2e test (potentially) into the makefile and CI. The WIP commit (related to CLI handling) referenced above has been removed. |
awgreene
left a comment
There was a problem hiding this comment.
Great work! I had a few nits and general question but the logic looks great!
| ) | ||
|
|
||
| // configmap keys can contain underscores, but configmap names can not | ||
| var unallowedKeyChars = regexp.MustCompile("[^-A-Za-z0-9_.]") |
There was a problem hiding this comment.
Rather than whitelisting valid characters wouldn't it be better to check for valid k8s object names?
There was a problem hiding this comment.
For example, a-- would get through this. I understand that this is being used to fix invalid configmap names, but I'm not sure if that's something the tool should be responsible for.
There was a problem hiding this comment.
There was some discussion as to whether or not the code here should be responsible for validating "valid" file names ("valid" because technically it's a configmap implementation detail leaking into what's considered valid from a user perspective). However, given how short this code is, I personally like ensuring that things don't explode. And since the resource names aren't in play here, I believe the chosen regex is best.
| } | ||
|
|
||
| func TranslateInvalidChars(input string) string { | ||
| validConfigMapKey := unallowedKeyChars.ReplaceAllString(input, "~") |
There was a problem hiding this comment.
It is not apparent to me why you are providing ~ as an input (even after googling). Could you explain?
There was a problem hiding this comment.
This ties into the above comment. If you want to argue that failing instead of translating to valid is best, then this code is up for potential removal. But I randomly chose the tilda character as a character that is typically rarely used to replace any invalid characters. In practice, I hope the string is not modified, but did make sure to include a warning message to point out the potential issue.
ec6e3c0 to
e59b816
Compare
e59b816 to
b40c9b8
Compare
b40c9b8 to
220ec6a
Compare
220ec6a to
a98ec3c
Compare
a98ec3c to
ef47feb
Compare
ef47feb to
c94d43f
Compare
|
/retest |
This verifies that the configmap is being properly read from the extracted data of a bundle image (from operator-framework#94).
| @@ -0,0 +1,3 @@ | |||
| annotations: | |||
| operators.coreos.com.bundle.resources: "manifests+metadata" | |||
There was a problem hiding this comment.
This is the only change I think we need. Please see my comment on Vu's PR: #97 (comment)
This should be a minor change, otherwise everything looks great!
Before I lgtm, do you want to hold this for further testing on the OLM side? Or would you rather merge and make new PRs if something comes up?
There was a problem hiding this comment.
I think it's easier to go ahead and get in. Hopefully any follow ups are pretty minor.
c94d43f to
f6fb0e4
Compare
f6fb0e4 to
05cd9a9
Compare
Previously, the package manifest data was going to be included as a file within the bundle. The planning changed and this updates the implementation to match. (This commit can be squashed, but was left as separate for review purposes.) The configmap annotations for manifest data has been made as a requirement. Also, this PR now depends on operator-framework#94.
This verifies that the configmap is being properly read from the extracted data of a bundle image (from operator-framework#94).
05cd9a9 to
371a5c2
Compare
Allows code reuse throughout operator-registry.
This implements "Populate" for writing bundle data to a configmap. Both subdirectories manifests and metadata are parsed for files to be stored in the configmap. Also implements a function for deploying the bundle image via a job.
This command serves the manifest data from an image bundle into a configmap via `opm alpha bundle extract`.
Essentially what is produced by `ginkgo bootstrap`, but without using dot-imports. The package name is intentionally chosen to be outside of the code under test in order to encourage not reaching into the internals.
The image-bundle directory contains files for the data inside a bundle image in addition to buildling both the bundle and init container images.
371a5c2 to
2c7ba05
Compare
ecordell
left a comment
There was a problem hiding this comment.
/lgtm
I had some nits, but they can be resolved in followups.
| clientset *kubernetes.Clientset | ||
| } | ||
|
|
||
| func NewConfigMapLoaderForDirectory(configMapName, namespace, manifestsDir, kubeconfig string) *ConfigMapWriter { |
There was a problem hiding this comment.
nit: NewConfigMapWriterForDirectory
nit: might want to use the functional option pattern for arguments we've been using elsewhere
| // the responsibility of the caller to delete the job, the pod, and the configmap | ||
| // when done. This function is intended to be called from OLM, but is put here | ||
| // for locality. | ||
| func LaunchBundleImage(kubeclient kubernetes.Interface, bundleImage, initImage, namespace string) (*corev1.ConfigMap, *batchv1.Job, error) { |
There was a problem hiding this comment.
nit: should be able to set the path to find opm in initImage?
| @@ -0,0 +1,773 @@ | |||
| package e2e_test | |||
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ecordell, jpeeler The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This provides a command to expose data in a bundle image and parses both /manifests and /metadata as proposed in operator-framework/operator-lifecycle-manager#1054.
This might need some shuffling around as I'm not sure the sqlite package is the best place for this code to live. Also, currently it includes another WIP PR which is likely to change.This includes functionality for launching the container to execute the new serve command, to be called from OLM once this and other PRs are pulled in.
OLM-1275