Recently, when I tried to answer the question: Openshift: how to edit scc non-interactively? I learned about nice feature of [crayon-64767101cc0ee350844809-i/] . It allows to change single values in OpenShift objects.
Patching the resources
For this scenario, let's say we have a deployment config called paprika. Standard way to update it is to run [crayon-64767101cc0f4340338153-i/] and change fields. That works only until it is not a repeatable task or something that needs to be done often.
Changing single value
Using [crayon-64767101cc0f5747017662-i/] you can easily automate simple tasks. Setting the rolling update timeout using this approach looks like this:
[crayon-64767101cc0f6614809568/]
The patch is an array of objects with the following fields:
op - one of the operation
The documentation is not the only place with information about OpenShift CLI. The tool itself contains a huge amount of data about the managed resources itself.
Finding the managed resources
A good starting point is to read output of [crayon-64767101cc4bb145866139-i/] that returns description of used concept and types. These are not all of them, but the ones used during development. You will not find there details about [crayon-64767101cc4bf313791857-i/] or [crayon-64767101cc4c0881323671-i/] .
For the listed types you can run [crayon-64767101cc4c1352395468-i/]
Exploring type's details
Armed with the knowledge of various types, further details can be displayed for it with[crayon-64767101cc4c2124449767-i/] . The command prints our all the fields, their types and descriptions.
[crayon...
With more than one node and more advanced setup than in minishift, you can use labels to add metadata to nodes. There are two ways to display later this information.
Showing all labels of a node
The following command returns all labels of all nodes. Normally the labels are not displayed and the [crayon-64767101cc6b4518876644-i/] flag has to be used to show them.
[crayon-64767101cc6b9225715235/]
Displaying only selected labels
As the number of labels and nodes grows, the output becomes unreadable. Usually just some of the metadata is useful at a time. The displayed labels can be then narrowed just to few that are helpful.
Lets show only architecture and os.
[crayon-64767101cc6ba993094595/]
I like that the selected labels are shortened and presented in columns. This adds a lot to t...
On linux machine you can use sudo to execute commands and so far I thought there is no equivalent approach in OpenShift. How mistaken I was! It looks like since OpenShift 3.1 the APIs allow to pass additional argument with the name of the user to impersonate.
Give the developer a sudoers role
On my minishift instance I add[crayon-64767101cc886063778616-i/] role to the default[crayon-64767101cc88a868702487-i/] user.
[crayon-64767101cc88c182618993/]
Using the new role
Starting from now, the [crayon-64767101cc88d807300857-i/] user can execute commands as a [crayon-64767101cc88e463728092-i/]. For example listing all nodes is possible, which does not work without the impersonation.
[crayon-64767101cc88f922908662/]
Environment
I executed the commands using minishift and the following cli...
I've been constrained to Windows recently and decided that such a small inconvenience won't stop me from trying out MiniShift on my desktop. Since constraints liberate [ref]Constraints Liberate, Liberties Constrain - Fantastic talk by Runar Bjarnason from Scala World 2015[/ref] that could also be an interesting experience.
Installation
Here are just some notes to start with it. I started with installing:
VirtualBox 5.1
Minishift release 0.9.0
OpenShift client 1.2.2
After configuring it minishift to use the VirtualBox:
[crayon-64767101ccc5d123113140-i/] - configure minishift to use VirtualBox
Since I installed it on h: drive, it fails to start. Related issue is https://github.com/kubernetes/minikube/issues/459
[crayon-64767101ccc60396174481/]
The problematic part is:...