Files
odo/tests/examples/source/devfiles/nodejs/kubernetes/devfile-image-names-as-selectors/k8s.yaml
Armel Soro ec747b4ab3 Allow using imageName as a selector (#6768)
* Add integration tests highlighting our expectations

* Bump Devfile library to latest commit

f041d79870

* Expose preference that allows users to globally configure an image registry

* Return the effective Devfile view by default from the initial context

This is supposed to be read-only, so that tools can rely on it
and to the operations they need to perform right away.

Raw Devfile objects can still be obtained upon request
if there is need to update them (for example via 'odo add/remove
binding' commands.

* Pass the image registry preference to the Devfile parser to build the effective view

* Fix 'odo init' integration tests

- The test spec was actually not doing what it was supposed to do
- Now 'odo init' returns a complete Devfile, where the parent is flattened,
  because the goal of 'odo init' is to bootstrap a Devfile.
  Previously, 'odo init' would not download the parent referenced,
  making it hard to understand the resulting Devfile.

* Document how odo now handles relative image names as selectors

* fixup! Document how odo now handles relative image names as selectors

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Revert "Fix 'odo init' integration tests"

This reverts commit 78868b03fd.

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Do not make `odo init` return an effective Devfile as a result

This would change the behavior of `odo init`.

Furthermore, due to an issue [1] in the Devfile library,
it is not possible to parse some Devfiles with parents linked as GitHub URLs (like GitHub release artifacts).

[1] https://github.com/devfile/api/issues/1119

Co-authored-by: Philippe Martin <phmartin@redhat.com>

* fixup! Document how odo now handles relative image names as selectors

---------

Co-authored-by: Philippe Martin <phmartin@redhat.com>
2023-05-22 10:45:27 -04:00

157 lines
3.8 KiB
YAML

apiVersion: v1
kind: Pod
metadata:
name: my-k8s-pod
spec:
containers:
- image: "{{ CONTAINER_IMAGE_RELATIVE }}"
name: my-main-cont1
- image: "{{ CONTAINER_IMAGE_ABSOLUTE_NOT_MATCHING_RELATIVE }}"
name: my-main-cont2
initContainers:
- image: "{{ CONTAINER_IMAGE_ABSOLUTE }}"
name: my-init-cont1
- image: "{{ CONTAINER_IMAGE_RELATIVE_NOT_MATCHING_AND_NOT_USED_IN_IMAGE_COMP }}"
name: my-init-cont2
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: my-app
name: my-k8s-deployment
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- image: "{{ CONTAINER_IMAGE_RELATIVE }}"
name: my-main-cont1
- image: "{{ CONTAINER_IMAGE_ABSOLUTE_NOT_MATCHING_RELATIVE }}"
name: my-main-cont2
initContainers:
- image: "{{ CONTAINER_IMAGE_ABSOLUTE }}"
name: my-init-cont1
- image: "{{ CONTAINER_IMAGE_RELATIVE_NOT_MATCHING_AND_NOT_USED_IN_IMAGE_COMP }}"
name: my-init-cont2
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: my-app
name: my-k8s-daemonset
spec:
selector:
matchLabels:
name: my-app
template:
metadata:
labels:
creationTimestamp: ""
name: my-app
spec:
containers:
- image: "{{ CONTAINER_IMAGE_RELATIVE }}"
name: my-main-cont1
- image: "{{ CONTAINER_IMAGE_ABSOLUTE_NOT_MATCHING_RELATIVE }}"
name: my-main-cont2
initContainers:
- image: "{{ CONTAINER_IMAGE_ABSOLUTE }}"
name: my-init-cont1
- image: "{{ CONTAINER_IMAGE_RELATIVE_NOT_MATCHING_AND_NOT_USED_IN_IMAGE_COMP }}"
name: my-init-cont2
---
apiVersion: apps/v1
kind: ReplicaSet
metadata:
labels:
app: my-app
name: my-k8s-replicaset
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- image: "{{ CONTAINER_IMAGE_RELATIVE }}"
name: my-main-cont1
- image: "{{ CONTAINER_IMAGE_ABSOLUTE_NOT_MATCHING_RELATIVE }}"
name: my-main-cont2
initContainers:
- image: "{{ CONTAINER_IMAGE_ABSOLUTE }}"
name: my-init-cont1
- image: "{{ CONTAINER_IMAGE_RELATIVE_NOT_MATCHING_AND_NOT_USED_IN_IMAGE_COMP }}"
name: my-init-cont2
---
apiVersion: v1
kind: ReplicationController
metadata:
name: my-k8s-replicationcontroller
spec:
replicas: 3
selector:
app: my-app
template:
metadata:
labels:
app: my-app
name: my-app
spec:
containers:
- image: "{{ CONTAINER_IMAGE_RELATIVE }}"
name: my-main-cont1
- image: "{{ CONTAINER_IMAGE_ABSOLUTE_NOT_MATCHING_RELATIVE }}"
name: my-main-cont2
initContainers:
- image: "{{ CONTAINER_IMAGE_ABSOLUTE }}"
name: my-init-cont1
- image: "{{ CONTAINER_IMAGE_RELATIVE_NOT_MATCHING_AND_NOT_USED_IN_IMAGE_COMP }}"
name: my-init-cont2
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: my-k8s-statefulset
spec:
replicas: 1
selector:
matchLabels:
app: my-app
serviceName: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- image: "{{ CONTAINER_IMAGE_RELATIVE }}"
name: my-main-cont1
- image: "{{ CONTAINER_IMAGE_ABSOLUTE_NOT_MATCHING_RELATIVE }}"
name: my-main-cont2
initContainers:
- image: "{{ CONTAINER_IMAGE_ABSOLUTE }}"
name: my-init-cont1
- image: "{{ CONTAINER_IMAGE_RELATIVE_NOT_MATCHING_AND_NOT_USED_IN_IMAGE_COMP }}"
name: my-init-cont2
# TODO(rm3l): test with some Custom Resources as well. Bug odo if comment is laced after last ---
---