Comments (8)
@alanbchristie yep, at face value I would agree.
Ultimately, we are talking about some rework of https://github.com/openshift/jenkins-client-plugin/blob/master/src/main/resources/com/openshift/jenkins/plugins/OpenShiftDSL.groovy#L497-L528
where we possibly need to make more RPCs, and we have a bit of regression testing to perform
since that code path is common to a lot of our oc verb equivalents.
Because of the RPC implications, I'm wondering if we want to introduce and optimization option which would allow the code to assume a common namespace.
As such, I'd like to have some discussion on our (openshif dev) end to get to a consensus on things. But certainly chime in with any thoughts along those lines you have as well @alanbchristie
@openshift/sig-developer-experience fyi / ptal
@jupierce if you have an historical notes on the obj combination logic I referenced above please advise (the same basic form seems to have been in place since the early commits).
thanks
from jenkins-client-plugin.
OK ... I found some related history with openshift/origin#12277 , a bug @bparees and @jupierce worked in late 2016.
And see this snippet from @jupierce for the process command:
public ArrayList<HashMap> process(Object obj,Object... oargs) throws AbortException {
String[] args = toStringArray(oargs);
if (obj instanceof Map) {
if (obj.kind != "Template") {
throw new AbortException("Expected Template object, but received: " + obj.toString());
}
// https://github.com/openshift/origin/issues/12277
Map template = new HashMap((Map)obj);
template.metadata.remove('namespace');
template.metadata.remove('selfLink');
obj = JsonOutput.toJson(template);
}
Now, the openshift/origin process template source from that issue has been reworked quite a since the activity from @bparees and @jupierce in late 2016.
And the comment from the origin docs that @jupierce reference befored is still present, but it has evolved to include the new parameter substitution support:
If an object definition’s metadata includes a fixed namespace field value, the field will be stripped out of the definition during template instantiation. If the namespace field contains a parameter reference, normal parameter substitution will be performed and the object will be created in whatever namespace the parameter substitution resolved the value to, assuming the user has permission to create objects in that namespace.
Still wrapping my head around all this, but I'm wondering if we don't just leave metadata.namespace
in the obj (i.e. remove the template.metadata.remove('namespace');
call).
Insights / opinions welcome while I cogitate
from jenkins-client-plugin.
I think I may have it:
- the code I mentioned above re remove template namespace probably can be removed now ... but is also orthogonal
- right now, the create flow always passes in the arg to set the namespace from what was specified in the
withProject
method ... just need to allow for honoring the obj namespace if it exists
from jenkins-client-plugin.
right now, the create flow always passes in the arg to set the namespace from what was specified in the withProject method ... just need to allow for honoring the obj namespace if it exists
sounds right. presumably that's what "oc process -f foo | oc create -f -" does.
from jenkins-client-plugin.
Another train of thought:
-
when @alanbchristie cites he did a
oc process -f <template-file> | oc create -f -
, was it preceded by something like anoc login
and thenoc project Y
beforehand; or did anoc cluster up
and got that activity under the covers -
this separation, if this is in fact what was done using the CLI, is a key difference ... with this plugin, there is not an
oc login
that occurs when we callopenshift.withCluster
, nor anoc project
associated withopenshift.withProject
. Those instead become the--namespace
and--serverURL
/--token
/ --ca-crtetc. args on a single
oc` invocation. That makes approximating the defaulting behavior a little trickier.
I've circled back around to having to iterate through the api object list, and if namespaces are specified, adjust accordingly, along with seeing if I can avoid multiple oc create
calls.
I'll try to put something together in a PR and we all can then review it and see how it looks. But I'm not convinced yet that the work around that @alanbchristie came up with might not be more attractive resolution.
from jenkins-client-plugin.
update: I have create and access for this scenario working with the process and create verbs used in tandem.
the new-app path is different though, and needs similar adjustments.
i'll submit a PR once that is sorted out
from jenkins-client-plugin.
update: the changes in the referenced PR are passing both new multiproject tests as well as regression tests.
however, given the amount of change needed to make this work, we want to hold off on a new version of the plugin and update to the openshift jenkins images until after the soon to be release 3.9 of openshift is cut.
we can entertain plugin versions published to the jenkins update center with the fix after we cut the 3.9 branch at https://github.com/openshift/jenkins if that would help users in the interim.
@alanbchristie - with all that, and the workaround noted in the description, do you have any feel on how soon you need this? Or how long you can wait?
thanks
from jenkins-client-plugin.
from jenkins-client-plugin.
Related Issues (20)
- Question: What extra steps should i follow if my OCP4 cluster is using a proxy ? HOT 4
- exportable did not work on newer openshift clusters HOT 4
- Stream stdout to console for passthrough operations HOT 5
- Plugin incompatible with new-style clouds configuration. HOT 5
- Error after Warning HOT 7
- Can't get api token from com.openshift.jenkins.plugnis.OpenShiftTokenCredentials in pipeline HOT 5
- List of DSL methods required HOT 3
- Error to parse POM's HOT 4
- 'restart' subcommand is missing for rollout()
- Support current version of oc tool HOT 4
- Plugin installation broke credentials used by other plugins HOT 12
- Argument was classified as an image, image~source, or loaded template reference but should be git repo HOT 7
- Leftover oc processes after wait() calls HOT 7
- Plugin doesn't detect capabilities (--ignore-not-found) from recent OC versions HOT 8
- No credentials shown in cluster configuration dropdown HOT 6
- Job fails if there are spaces in the project name, using raw command HOT 9
- Error flags cannot be placed before plugin name on external Jenkins declarative pipeline HOT 2
- Unable to retrieve object names using kubernetes-plugin sidecar container HOT 5
- java.nio.file.NoSuchFileException after upgrade to 1.0.37 HOT 5
- Certificate options not escaped HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jenkins-client-plugin.