At the time of making this commit, the package `github.com/ghodss/yaml`
is no longer actively maintained.
`sigs.k8s.io/yaml` is a permanent fork of `ghodss/yaml` and is actively
maintained by Kubernetes SIG.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* Make sure to run parallel commands part of a composite command in parallel
* Display warnings in case there are errors when executing pre-stop events
* Fix the command_composite_parallel.go implementation by lowering the case of the sub-command names
Since this passed the Devfile validation logic, we should use the same logic as in command_composite.go
* Add new `--run-port` flag to `odo init` to set ports non-interactively
As depicted in [1], this leverages the default (or single non-default) run command to find the linked container component.
As such, it assumes that the command found is an exec command,
and that the linked component is a container component.
[1] https://github.com/redhat-developer/odo/issues/6925
* Add unit and integration tests highlighting the expectations
* Document the new `--run-port` flag
* Fix some typos and language correctness issues in the `odo init` doc
* Add doc automation test for the output of `odo init --run-port`
This ensures the output and sample in the doc are kept in sync with the code base.
* Add integration tests highlighting the expectations
* Add and fill a 'Commands' field from the DevfileData struct returned by `describe`
* Display commands in the human-readable output of 'odo describe'
* Add documentation and sample outputs
* Add a run command
* Check command name passed as arg
* Check platform is available
* Add a Run method to the DevClient
* Run command on cluster
* Add test with run command on cluster
* Implement and test run on podman
* Enhance test to check that command has been executed in container
* Fix `odo help` test
* Refactor common code for podman/cluster
* Test Apply commands on Kubernetes/Images
* Test a msg is displayed when executing odo run without odo dev
* Review
* makes GetRunningPodFromSelector return only Running pods on Podman
* Document current implementations of command handlers
* Add unit tests for execHAndler
* Refactor pkg/devfile/image to inject Backend as dependency
* Use same handler for kubedev/podmandev
* Fail after SelectBackend==nil only if backend is needed
* Move runHandler to dev/common
* Unit tests for runHandler
* Create a component.ExecuteTerminatingCommand
* ExecuteTerminatingCommand/ExecuteNonTerminatingCommand for Handler
* Fix calling other command types
* Consider parent group to determine if a command is terminating
* Replace component.execHandler by common.runHandler
* Remove execHandler
* Make runHandler and most of fields private and pass containersRunning to handler
* Pass containersRunning value
* deploy using common Handler
* Fix tests
* Use specific Dev/Deploy mode for Apply
* Fix cmdline for job
* Fix unit tests
* Pass appName and componentName with ctx to handler
* Move handler to pkg/component package
* Update doc
* Unit tests Deploy
* Unit tests Build
* Unit tests Run
* Unit tests PostStart
* Unit tests PreStop
* Update doc
* Fix Podman tests
* Fix hotReload on podman
* Change podman version timeout to 30s for tests
* Cleanup + fix doc
* Add test cases simulating build or run commands that take very long
* Pass a context around to relevant functions and methods
This will allow to handle cancellations and timeouts and deadlines as needed
* Pass the context to Podman exec command too
* fixup! Add test cases simulating build or run commands that take very long
* Remove additional non-nil checks on component fields since they are already filtered by type
We are confident that the fields we expect
(comp.{Image,Kubernetes,OpenShift}) are non-nil.
* Rename 'libdevfile.GetImageComponentsToPush' into 'libdevfile.GetImageComponentsToPushAutomatically'
* Document with examples cases where 'deployByDefault' and 'autoBuild' are `false` and the component is not referenced
* Rename 'image-autobuild-true-and-referenced' command into 'image-autobuild-true' in test Devfile
* Simplify parsing the output on Podman in the tests when looking for K8s/OpenShift components
* Use 'source/nodejs' instead of 'source/devfiles/nodejs/project' in the tests
* Revert "Rename 'image-autobuild-true-and-referenced' command into 'image-autobuild-true' in test Devfile"
This reverts commit 65812b857c.
* Add sample Devfile with multiple autoBuild/deployByDefault combinations
It will be used for integration tests.
* Add helper function to update a given Devfile Command Group
This will allow supporting cases where we need to run a custom command,
but this is not implemented yet on odo (cases with 'odo dev --debug'
and 'odo deploy').
In this case, this helper will allow updating the Devfile for example to
unmark the current default command as non-default, and mark the custom
one as default.
* Add test cases for 'odo dev'
* Add test cases for 'odo deploy'
* Add test cases for 'odo build-images'
'odo build-images' should build all images regardless of the 'autoBuild' property.
* Display the spinner when creating or updating Kubernetes resources
This helps understand what resources are being patched.
* Handle deployByDefault on K8s and OpenShift components
* Add 'devfile.GetImageComponentsToPush' functions that returns the list of image components to auto-create
See https://github.com/devfile/api/issues/852#issuecomment-1211928487 for more context.
* Handle automatic image component creation for 'odo dev' on Kubernetes
* Handle automatic image component creation for 'odo dev' on Podman
* Handle automatic image and K8s/OpenShift component creation for 'odo deploy'
* Bump Devfile library to the latest commit at this time (c1b23d2)
This includes the fix for [1], which provides a way not to set default values automatically
[1] https://github.com/devfile/api/issues/1067
* Do not set default values when parsing a Devfile
See [1] for the rationale
[1] https://github.com/redhat-developer/odo/issues/5694\#issuecomment-1465778398
* Add documentation in the Devfile reference page
* Revert "Display the spinner when creating or updating Kubernetes resources"
This reverts commit 6ad073e63cb0e685f165eed767619a90997393a3.
* Avoid re-applying Image components multiple times
'adapter#Push' might get called several times when there are
state transitions (either on the Deployment in the cluster,
or from 'odo').
It might be confusing to apply Image components over and over again
(and also it can be slower if we need to push images to remote registries).
* Move GetK8sAndOcComponentsToPush and GetImageComponentsToPush to libdevfile package
As suggested in review, this should be the responsibility of the devfile library
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* fixup! Handle automatic image and K8s/OpenShift component creation for 'odo deploy'
* fixup! Handle automatic image component creation for 'odo dev' on Podman
* fixup! Avoid re-applying Image components multiple times
* Apply suggestions from code review
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* fixup! Do not set default values when parsing a Devfile
* Fix devfile-deploy-functional-pods.yaml (used in 'odo logs' tests)
Set deployByDefault to false on innerloop-pod component.
Otherwise, since it is not referenced by any apply command,
it will be automatically created by *both* 'odo dev' and 'odo deploy'.
---------
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Embed platform.Client interface in platform-specific interfaces
This avoids repeating the same methods in both interfaces,
and makes the intent clearer.
* Verify interface compliance of PodmanCli at compile time
This is recommended in the Coding Conventions guidelines [1].
Specifically, what's important here is checking that it meets the 'platform.Client' contract.
[1] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#verify-interface-compliance
* Move K8s-specific implementation of port-forwarding to a dedicated package
This paves the way to providing a different implementation for Podman
* Remove GetPortsToForward method from the portForward.Client interface
Current implementation relies on the Devfile object,
so it makes more sense to be in the libdevfile package.
* Monitor and send appropriate status events after starting a remote command process
This allows callers to get more meaningful events about the process.
* Implement port-forwarding logic on Podman
As explained in [1], this makes use of a helper sidecar container
(aptly named "odo-helper-port-forwarding") to be added to the Pod Spec created by odo.
In this scope, port-forwarding will be equivalent of executing a socat command in this
helper container, like so:
socat -d tcp-listen:20002,reuseaddr,fork tcp:localhost:5858
In the command above, this will open up port 20001 on the helper container,
and forwarding requests to localhost:5858
(which would be in the application container, part of the same Pod)
[1] https://github.com/redhat-developer/odo/issues/6510
* Update portForward.Client interface methods
Specifically, the 'StartPortForwarding' method
can now accept an explicit list of ports that needs to
be forwarded, if the caller can compute provide such information.
This is currently useful on Podman where the ports
(even the random ones) are known in advance.
* Add helper sidecar container to the Pod Spec generated on Podman
As explained in [1], this helper sidecar container (aptly named "odo-helper-port-forwarding")
will hold the actual container/host ports mapping in the spec
(to overcome the limitation of using hostPort against a container app listening on the loopback interface);
this running container will be used to execute the actual port-forwarding commands (based on socat), e.g:
```
apiVersion: v1
kind: Pod
metadata:
name: my-component-app
labels:
app: my-component-app
spec:
containers:
- name: runtime
command: [ 'tail', '-f', '/dev/null']
# Omitted for brevity, but imagine an application being executed by odo
# and listening on both 0.0.0.0:3000 and 127.0.0.1:5858
- name: odo-helper-port-forwarding
image: quay.io/devfile/base-developer-image:ubi8-latest
command: [ 'tail', '-f', '/dev/null']
ports:
- containerPort: 20001
# A command will be executed by odo, e.g.: 'socat -d -d tcp-listen:20001,reuseaddr,fork tcp:localhost:3000'
hostPort: 20001
- containerPort: 20002
# A command will be executed by odo, e.g.: 'socat -d -d tcp-listen:20002,reuseaddr,fork tcp:localhost:5858'
hostPort: 20002
# ... Omitted for brevity
```
In this scope, port-forwarding from 20002 to 5858 for example will be equivalent of executing
a socat command in this helper container, like so:
socat -d tcp-listen:20002,reuseaddr,fork tcp:localhost:5858
In the command above, this will open up port 20001 on the helper container,
and forwarding requests to localhost:5858
(which would be in the 'runtime' container, part of the same Pod)
[1] https://github.com/redhat-developer/odo/issues/6510
* Inject the right portForward client depending on the platform
* Delegate port-forwarding on Podman to the appropriate client
* Implement --forward-localhost on Podman
* Add unit and integration test cases
* Cover more debug-related test cases on Podman
* Expose the endpoint protocol so as to instruct socat to listen and forward the right protocol
* Fix sub-deps of EXEC and PORT_FORWARD, as suggested in review
* Support exec command for deploy
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Print log after timeout
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add helper function to form proper commandLine
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Mockgen kclient
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Enhance error message
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Attempt at fixing unit test failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Rename import v1 to batchv1
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Remove TODOs
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add integration tests and cleanup on user interrupt
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Temp changes
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Log tip to run odo logs after a minute
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* List components to delete even if there are no devfile resources
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix integration tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix deploy exec delete integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Temp Change
* Fix delete command tests
* Fix mockgen client
* Fix validation errors
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix unit test failure
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Attemp at writing less flaky integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Remove TODOs
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add tip after 1 minute and return the go routine if job finishes before that
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use the container as it is so that container-overrides can be taken into account
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Move job spec code to a different helper function inside the libdevfile pkg
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Modify the Execute method to use the new helper function and refactoring
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Attempt at fixing integration and unit tests
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Move defer to print remaining resources to a separate function, fix func doc and gofmt the files
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix test failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Cleanup
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Cleanup unused functions
Signed-off-by: Parthvi Vala <pvala@redhat.com>
---------
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add integration test case
Co-authored-by: Anand Kumar Singh <anandrkskd@gmail.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
* Add ApplyOpenShift method to handler
* Test openhift component with odo dev
* Rename GetKubernetesComponentsToPush to GetK8sAndOcComponentsToPush and modify if to obtain both k8s and oc components
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix unit test failures with delete_test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* update ListClusterResourcesToDeleteFromDevfile to fetch openshift component,Add ListOpenShiftComponents
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* fix testcase 'should have deleted the old resource and created the new resource' and add helper function ReplaceStrings
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* fix debug test to check openshift component
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
* Update GetBindingsFromDevfile to include openshift components
* Update offline tests
* Add openshift component to devfiles
* Update tests
* Fix binding tests
* Fix RemoveBinding unit tests
* Handle OpenShift components when removing binding
* odo describe component displaysOpenShift components
* Remove unused function
---------
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: anandrkskd <anandrkskd@gmail.com>
Co-authored-by: Anand Kumar Singh <anandrkskd@gmail.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Refactor 'libdevfile#GetContainerEndpointMapping' so it returns the whole Endpoint struct
It will help extract useful information like the port name and exposure.
* Fix typo in parameter name (in portForward#Client interface)
* Display the port names in the output of 'odo describe component'
* Display the port exposures in the output of 'odo describe component'
* Tell whether the port is a debug one or not in the output of 'odo describe component'
* Add integration tests meeting the expectations
* Update documentation
* Update the Devfile library
* Add test for container-overrides and pod-overrides attributes
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Attempt at fixing CI failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix CI failure
* Attempt at fixing OC integration test failures
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use random name in integration test
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Rebase and fix integration test failure
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Make integration test work for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Temp attempt at fixing podman test for GH
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Another attempt at fixing CI test for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* One more attempt at fixing integration test for podman
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add integration tests meeting the expectations
* Refactor 'libdevfile.GetContainerEndpointMapping' such that it returns debug endpoints only if told so
* [Kubernetes] Port-forward Debug endpoints only if running in Debug mode
* [Podman] Port-forward Debug endpoints only if running in Debug mode
* Use '--inspect' instead of '--inspect-brk' to run the "debug" script in Node.JS sample projects
'--inspect-brk' stops the execution at the start of the command
(waiting for a debugger to attach to it) while '--inspect' does not.
We need the application to be started regardless of whether a debugger
is attached or not, as we are testing that we can communicate with
the forwarded ports.
* Temporarily skip the test step on Podman that connects to the forwarded debug port until [1] is fixed
We can work on fixing the issue on Podman in a separate PR.
[1] https://github.com/redhat-developer/odo/issues/6510
* odo dev works if no endpoint is defined
* Update tests/integration/cmd_dev_test.go
Co-authored-by: Armel Soro <armel@rm3l.org>
* Add log when no port to forward
Co-authored-by: Armel Soro <armel@rm3l.org>
* Rename GetK8sManifestWithVariablesSubstituted to GetK8sManifestsWithVariablesSubstituted
* Add GetK8sComponentAsUnstructuredList; add support for multiple manifests in a single k8s component
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Use GetK8sComponentAsUnstructuredList in binding/remove.go
* Use GetK8sComponentAsUnstructuredList in component/component_test.go
* Use GetK8sComponentAsUnstructuredList in libdevfile/component_kubernetes_utils.go
* Use GetK8sComponentAsUnstructuredList in service/service.go
* Use GetK8sComponentAsUnstructuredList in devfile/adapters/kubernetes/component/adapter.go
* Add documentation for GetK8sComponentAsUnstructuredList and remove GetK8sComponentAsUnstructured
* Fix createOrUpdateServiceForComponent to fetch only the service created for the component
* Add integration test for odo deploy
* Add integration test for odo dev
* Attempt at fixing list/describe binding tests; fixes old mishap
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Check for empty list of binding
Signed-off-by: Parthvi Vala <pvala@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Do not display "Port configuration using flag is currently not supported"
This is confusing to users.
* Display ports detected as part of the Alizer component detection logic
This is because we specifically need to display the ports
at the same moment when the language, project type and Devfile
are displayed to the end user (when source code is present)
* Update the loaded Devfile object with the application ports detected prior to asking for its customization
The case of multi-container components will be handled in [1].
Otherwise, the container component ports (all but the Debug ports) are replaced with the right application ports.
[1] https://github.com/redhat-developer/odo/issues/6264
* Add integration test case
* Add application ports detected to "odo analyze -o json" output
* Update documentation
* Add utility functions for helping handle Debug endpoints
* Make application ports detected appear first in the endpoint list
This allows such ports to be port-forwarded first, before the Debug ones.
* Add support for devfile volume
* Add unit test
* Use same naming strategy as for cluster
* Apply suggestions from code review
Co-authored-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Parthvi Vala <pvala@redhat.com>
* Update odo to use go 1.18
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Update golangci-lint version in Makefile
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Use go 1.18, not go 1.19
Erroneously I had used go 1.19 at various places.
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Rearrange imports; fix golangci-lint errors
Fixed a bunch of golangci-lint errors like below:
`File is not `gofmt`-ed with `-s``
using the command: `golangci-lint run --fix`
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
* Use go install instead of go get
This is because with go 1.18, `go get` behaves as `go get -d` by
default. Which means that it will only download, but not install.
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
Signed-off-by: Dharmit Shah <shahdharmit@gmail.com>
Defining endpoints for Debug ports is required for Devfiles
to work properly with `odo dev --debug`.
This addresses the question of exposure for such endpoints.
Tools like DevSpaces currently set 'exposure: none' for debug endpoints.
This makes sense from the developer perspective,
as 'odo dev' aims at emulating a local developer machine.
As a consequence, `odo dev` should no longer ignore endpoints with
'exposure: none'. They should be port-forwarded just like other endpoints.
* Do not use receiver to pass DevfileCommands parameters
* Do not use receiver to pass DebugPort parameter
* Do not use receiver to pass deployment parameter
* Do not use receiver to pass pod parameter
* Move randomPorts and errOut as PushParameters
* Add integration test cases
* Add documentation
* Add `build-command` flag to `odo dev`
This allows to build applications using a non-default build command.
* Update docs/website/docs/command-reference/dev.md
Co-authored-by: Philippe Martin <contact@elol.fr>
Co-authored-by: Philippe Martin <contact@elol.fr>
* Add documentation
* Add integration test cases
* Refactor functions in 'pkg/libdevfile/libdevfile.go'
Few functions used to have similar but slightly different logic,
which could make them quite confusing to use.
This also fixes a behavior which is not supposed to be
part of the Devfile spec: in the past, if a Devfile contains a single
but non-default command for a given kind, this command would get returned
as the Default command for such kind.
Now, an explicit error is returned instead if this single command
is not marked as default in the Devfile.
* Add `run-command` to `odo dev`, to run non-default run commands
* Fix documentation of a few libdevfile functions, as suggested in review
* Change integration test expectations regarding composite run commands
* Add integration test supporting composite debug commands
* Rename in-container pid file from '.odo_devfile_cmd_<name>.pid' into '.odo_cmd_<name>.pid'
The implementation in kubeexec.go is indeed able to run any kind of commands,
not only Devfile-related.
* Pave the way to supporting composite run/debug commands
Drop validation rules that prevented from going further
with composite run or debug commands.
* Update logic for determining which containers should have their entrypoint overridden or env vars updated
The previous implementation was limited to Exec commands solely.
This now makes it easier to support other kind of commands.
For example, when handling a composite command, we are now recursively
determining the containers (a.k.a components) that would get used by this composite command.
* Store the process exit code in the pid file handled by kubeexec.go
This allows to more accurately determine how the process could be reported.
* Fix issue with util#DisplayLogs potentially not picking the last element of lines
* Make sure to execute the Build command only once when running a composite command
* Test that the Build command is executed once running a composite command
* Make sure not to retrieve the parent default command uselessly
* Log the command Id when it is about to be restarted
* Redirect build command logs to PID 1 process
This way, users would be able to display them (and follow them) with `odo logs` or `kubectl logs`
* Handle Errored case when logging information about the process that exited
* Make sure to override container entrypoint if needed for Build commands
Build commands (which could also be composite ones)
might be executed in a container different from the run or debug ones.
* Redirect output from commands handled by component.exec_handler to PID 1 process streams
This way, we can also have them displayed with `odo logs` or `kubectl logs`.
This includes Build and Devfile events commands.
* Make remotecmd#ExecuteCommand log stdout or stderr content only if there not empty
This reduces the clutter in case of an error with the command execution.
* Add integration test with more complex Devfile (composite build/run/debug commands running in different containers and with a shared volume)
* Update the 'Executing the application' spinner accordingly when the related command is done
* Introduce new 'pkg/remotecmd' package
This package allows to execute commands in remote packages
and exposes an interface for managing processes associated
to given Devfile commands.
* Rely on 'pkg/libdevfile' as much as possible for Devfile command execution
This requires passing a handler at the odo side,
which in turns uses the 'pkg/remotecmd' package to
run commands in remote containers.
* Switch to running without Supervisord as PID 1 in containers
To do this, the idea is to start the container component:
1- using the command/args defined in the Devfile
2- using whatever was defined in the container image
if there is no command/args defined in the Devfile
Then, once the container is started, we would execute the Devfile
commands directly in the container component, just like a simple
'kubectl exec' command would do.
Since this is a long-running command (and potentially never ending),
we would need to run it in the background, i.e. in a side goroutine.
Point 2) above requires implementing a temporary hack (as discussed in [1]),
without us having to wait for [2] to be merged on the Devfile side.
This temporary hack overrides the container entrypoint with "tail -f /dev/null"
if the component defines no command or args (in which case we should have
used whatever is defined in the image, per the specification).
[1] https://github.com/redhat-developer/odo/pull/5768#issuecomment-1147190409
[2] https://github.com/devfile/registry/pull/102
* Rename K8s adapter struct 'client' field into 'kubeClient', as suggested in review
* Rename sync adapter struct 'client' fields to better distinguish between them
* Make sure messages displayed to users running 'odo dev' are the same
* Update temporary hack log message
Co-authored-by: Philippe Martin <contact@elol.fr>
* Make sure to handle process output line by line, for performance purposes
* Handle remote process output and errors in the Devfile command handler
The implementation in kubeexec.go should remain
as generic as possible
* Keep retrying remote process status until timeout, rather than just waiting for 1 sec
Now that the command is run via a goroutine,
there might be some situations where we were checking
the status just before the goroutine had a chance to start.
* Handle remote process output and errors in the Devfile command handler
The implementation in kubeexec.go should remain
as generic as possible
* Update kubeexec StopProcessForCommand implementation such that it relies on /proc to kill the parent children processes
* Ignore missing children file in getProcessChildren
* Unit-test methods in kubexec.go
* Fix missing logs when build command does not pass when running 'odo dev'
Also add integration test case
* Fix spinner status when commands passed to exec_handler do not pass
* Make sure to check process status right after stopping it
The process just stopped might take longer to exit (it might have caught
the signal and is performing additional cleanup)
* Keep retrying remote process status until timeout, rather than just waiting for 1 sec
Now that the command is run via a goroutine,
there might be some situations where we were checking
the status just before the goroutine had a chance to start.
* Fix potential deadlock when reading output from remotecmd#ExecuteCommandAndGetOutput
Rely on the same logic in ExecuteCommand
* Add more unit tests
* Remove block that used to check debug port from env info
As commented out in [1], we don't store anymore the debug port value in the ENV file.
[1] https://github.com/redhat-developer/odo/pull/5768#discussion_r893163382
* Rename 'getCommandFromFlag' into 'getCommandByName', as suggested in review
* Make remotecmd package more generic
This package no longer depends on Devfile-related packages.
* Fix comments in libdevfile.go
* Move errorIfTimeout struct field as parameter of RetryWithSchedule
This boolean is tied to the given retry schedule,
so it makes sense for it to be passed with the schedule.
* Expose a single ExecuteCommand function that returns both stdout and stderr
Co-authored-by: Philippe Martin <contact@elol.fr>
* Skeleton for odo create binding
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add logic
* Add functions to add data to devfile and create files
* Dharmit's review + make it work with <name>/<kind>.<apigroup>
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Add support for more formats
* Add integration tests and supporting helper functions
* create > add
* Add default ServiceBinding name
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix timeout, and move cli/add/binding.go to cli/add/binding/binding.go
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Update pkg/binding/binding.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Update pkg/binding/binding.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Update pkg/binding/interface.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Philippe's review
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Self review
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix unit test failure
* Philippe's review: round 2
* Tomas review; self review
Signed-off-by: Parthvi Vala <pvala@redhat.com>
* Fix windows test failure
* Randomize binding name for test
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Co-authored-by: Philippe Martin <contact@elol.fr>
* Add integration test highlighting the issue
The devfile used is the same as devfile-deploy.yaml,
except that the the Kubernetes component is referenced via the URI.
This is why the same integration test logic is being reused here.
* Add higher-level function in 'libdevfile' allowing to load component resource manifest and substitute variables
This works with both Inlined or Uri resources.
Notes:
- Ideally, it would make more sense to rely on the same logic used in Devfile to
substitute variables (defined in the 'variables' package),
but this function is not exported;
and the exported ones substitute variables only in the URI name,
not in the content itself (it is not fetched),
which is actually the issue we are trying to solve here.
* Switch to using 'uri' Kubernetes components in test Devfiles
This seems to be a much more realistic case when referencing external
Kubernetes manifests.
Notes:
Some tests, like for `odo deploy`, still test 'Inlined' manifests.
* Pass the component name to 'GetComponentResourceManifestContentWithVariablesResolved'
As suggested in review, this makes more sense
now that we are passing the entire devfile object
* Rename 'GetComponentResourceManifestContentWithVariablesResolved' with 'GetK8sManifestWithVariablesSubstituted'
Previous name was a bit long ^^
* Remove extra parentheses in error string returned by 'ComponentsWithSameNameError#Error', as suggested in review
* Revert "Switch to using 'uri' Kubernetes components in test Devfiles"
This reverts commit df1f19ed959b8c82aa17ac3cf12c343305789149.
This will be done in a separate PR, with ideally
changes that should allow to use the same set of
tests for testing both Inlined and
URI-referenced manifests.
* odo init -o json
* docs
* fix header and json
* Make DevfileLocation part of api package
* Add Component api kind
* odo init -o json return value
* Document api package
* Update tests
* review
* Error when json output and no flags
* Update doc
* review
* Add test highlighting the issue
* Make `odo build-images` return an error if no Image component found
As reported in #5330, this makes more sense rather than exiting silently.
* First pass of port-forward for odo dev
* Supports forwarding multiple ports/endpoints
* Change message wording
* Port forwarding happens port 40001 onward
* Organize the code
* Integration tests
* Update the CLI help message
* Catch and check err
* Changes for failing unit tests
* Fix test and add newline to a message
* Remote label and use for loop
* Adds TODO to cleanup when port-forwarding fails
* Change messaging printed on the CLI
* Break Start method into multiple methods
* Set debug port while creating push parameters in dev
* Test after making a change to a file in pwd
* Refactoring to put things where they should be
* Notify user to run odo dev again if endpoints change
* Unit tests and rebase mistakes
* Add newline character for clear formatting
* Create business logic for reuse to find endpoints
* Fix unit and integration test failures
* Self review
* Changes based on Philippe's review
* Two more changes based on Philippe's review
* More changes based on PR review
* Changes based on PR feedback and more
- Renames all receivers in kclient package to `c`
- Adds mocks
* Removes unnecessary function
* Make function more generic for reuse
* Rename Options to DevOptions
* Address review comments by Tomas
* Fix failing unit test
* Modify message to restart odo dev
* Use helper.RunDevMode in odo dev tests
* Remove doubly imported log package
* Modifies clientset at CLI and business layer
- No need of KUBERNETES client for `odo dev` business layer.
- Added KUBERNETES client for `odo dev` CLI layer.
* Remove hardcoding of URL in tests
- It uses @feloy's work in PR #5570.
* Uses regexp to find strings.
* Makes FindAllMatchingStrings more generally usable
* Adds constant for localhost regex
* Replace matches with urls and remove unnecessary Sprintf
* Documents what urls is in RunDevMode function.
* Update tests/helper/helper_dev.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Update tests/helper/helper_dev.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Update tests/helper/helper_dev.go
Co-authored-by: Philippe Martin <contact@elol.fr>
* Update tests/helper/helper_dev.go
Co-authored-by: Philippe Martin <contact@elol.fr>
Co-authored-by: Philippe Martin <contact@elol.fr>