Repository navigation
create imagestreams and buildconfig for nodejs runtime - #13
Conversation
| shortNames: | ||
| - gitsrc | ||
| scope: Namespaced | ||
| validation: |
There was a problem hiding this comment.
sorry @alexeykazakov side effect of operator-sdk generate openapi of operator-sdk 0.5.0
I've removed it from makefile's build command.
| type ComponentSpec struct { | ||
| // Container image use to build (nodejs, golang etc..) | ||
| BuildType string `json:"buildType"` | ||
| Codebase string `json:"codebase"` |
There was a problem hiding this comment.
What is Codebase? Git URL?
Could you please add a description?
| // IsController: true, | ||
| // OwnerType: &componentsv1alpha1.Component{}, | ||
| //}) | ||
| if err != nil { |
|
|
||
| // Create an empty image name "nodejs-runtime" | ||
| newImageForRuntime := newImageStreamFromDocker(instance.Namespace, instance.Name, instance.Spec.BuildType) | ||
| err = r.client.Create(context.TODO(), newImageForRuntime) |
There was a problem hiding this comment.
newImageForRuntime could be nil. Should it be handled?
There was a problem hiding this comment.
@corinnekrych, the fix could still cause problems.
Can you please split the if err != nil || newImageForRuntime == nil { line two two seperate If checks?
That would allow us to have different error logging in both the cases.
| } | ||
|
|
||
| var _ reconcile.Reconciler = &ReconcileComponent{} | ||
| var buildTyppeImages = map[string]string{"nodejs":"nodeshift/centos7-s2i-nodejs:10.x"} |
There was a problem hiding this comment.
Note: we would use builder images present in the openshift namespace. So, this list could be constructed out of the builder images present in oc get imagestreams -n openshift
There was a problem hiding this comment.
Agreed!
but some imagestream (for ex: golang) are missing from openshift namespace, so building from ext docker image could still be useful.
I need to investigate further how to reuse those imagestream from another project, it work fine if i search for then within openshift project but coudn't find then from outside.
Let me track this in subtask https://jira.coreos.com/browse/ODC-133
There was a problem hiding this comment.
There's a small typo too
| var buildTyppeImages = map[string]string{"nodejs":"nodeshift/centos7-s2i-nodejs:10.x"} | |
| var buildTypeImages = map[string]string{"nodejs":"nodeshift/centos7-s2i-nodejs:10.x"} |
jarifibrahim
left a comment
There was a problem hiding this comment.
The PR looks good to me. Just a few minor things and then we can merge it. Thanks for fixing the docs and Readme @corinnekrych 🎉
|
|
||
| log.Info("Registering Components.") | ||
|
|
||
| // Setup Scheme for all resources |
There was a problem hiding this comment.
This could be removed :)
| spec: | ||
| properties: | ||
| buildType: | ||
| type: string |
There was a problem hiding this comment.
Since we would have a limited number of buildTypes, I think we should add the enum here. See https://github.com/operator-framework/operator-lifecycle-manager/blob/master/deploy/upstream/quickstart/olm.yaml#L1011 for an example.
What do you think @corinnekrych
There was a problem hiding this comment.
5046adb
for now only added nodejs, more will be added as we progress
| singular: gitsource | ||
| shortNames: | ||
| - gitsrc | ||
| - gitsrc |
There was a problem hiding this comment.
This should be indented :)
| } | ||
|
|
||
| var _ reconcile.Reconciler = &ReconcileComponent{} | ||
| var buildTyppeImages = map[string]string{"nodejs":"nodeshift/centos7-s2i-nodejs:10.x"} |
There was a problem hiding this comment.
There's a small typo too
| var buildTyppeImages = map[string]string{"nodejs":"nodeshift/centos7-s2i-nodejs:10.x"} | |
| var buildTypeImages = map[string]string{"nodejs":"nodeshift/centos7-s2i-nodejs:10.x"} |
|
|
||
| // Create an empty image name "nodejs-runtime" | ||
| newImageForRuntime := newImageStreamFromDocker(instance.Namespace, instance.Name, instance.Spec.BuildType) | ||
| err = r.client.Create(context.TODO(), newImageForRuntime) |
There was a problem hiding this comment.
@corinnekrych, the fix could still cause problems.
Can you please split the if err != nil || newImageForRuntime == nil { line two two seperate If checks?
That would allow us to have different error logging in both the cases.
| log.Error(err, "** Creating new RUNTIME image fails **") | ||
| return reconcile.Result{}, err | ||
| } | ||
| if newImageForRuntime == nil { |
There was a problem hiding this comment.
Redundant check. We can move this check to line 133.
| return reconcile.Result{}, err | ||
| } | ||
|
|
||
| log.Info("** Build config created **") |
There was a problem hiding this comment.
The message seems to be off. We have not yet created a build config, have we?
|
@jarifibrahim I've integrated all you comment and cleared the todo |
|
I don't see any tests for this code. |
|
Coming see odc-98 for the whole user story |
@sbose78 did we forget to add @alien-ike bot to this repo? ;) |
fixes sub-task https://jira.coreos.com/browse/ODC-131
of user story https://jira.coreos.com/browse/ODC-98