Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rework example pipelines #550

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

ksimon1
Copy link
Member

@ksimon1 ksimon1 commented May 22, 2023

What this PR does / why we need it:
feat: rework example pipelines

Common-templates are going to be deprecated in some future version. This commit is changing example pipelines to remove all automation related to templates and replaces it with create-vm-from-manifest task.

This change helps to unify pipelines for okd and kubernetes, so now we can use single version for okd and k8s.

Release note:

Remove templates automation from example pipelines

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels May 22, 2023
@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL labels May 22, 2023
data/tekton-pipelines/windows-bios-installer-pipeline.yaml Outdated Show resolved Hide resolved
metadata:
name: pipeline
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to ship this role or was this fixed in Tekton/OpenShift Pipelines in the meantime?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we still need it - I tested it with openshift pipelines 1.10.2 (newest) and SA is still not deployed to openshift|kube namespaces

- name: virtioContainerDiskName
description: Reference to the containerdisk containing the virtio-win drivers ISO.
type: string
default: quay.io/kubevirt/virtio-container-disk:latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest tag hasn't been updated in two years. This could be an issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data/tekton-pipelines/windows-bios-installer-pipeline.yaml Outdated Show resolved Hide resolved
taskRef:
kind: Task
name: wait-for-vmi-status
- name: create-base-dv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the base-dv enough, why do we need a separate root disk that is cloned after the install? Can't the base-dv be used as root disk directly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All gets complicated, because of the disk name and multiple runs use case. In templates, the disk name was derived from VM name and vm name was generated with some random hash. So you could run the pipeline multiple times. But while creating VM from VM manifest, the datavolume can have only a single hardcoded name (it might use generateName, but then we could not copy it to kubevirt-os-images, because the pvc will have different name than VM and vm name and namespace is the only information we get from create-vm task).

data/tekton-pipelines/windows-efi-installer-pipeline.yaml Outdated Show resolved Hide resolved
data/tekton-pipelines/windows-efi-installer-pipeline.yaml Outdated Show resolved Hide resolved
- description: Namespace of the created base DataVolume
name: baseDvNamespace
value: $(tasks.create-base-dv.results.namespace)
tasks:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this block at the start of the pipeline spec?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the order: params, tasks, finally, results

data/tekton-pipelines/windows-efi-installer-pipeline.yaml Outdated Show resolved Hide resolved
kind: Task
name: wait-for-vmi-status
timeout: 2h0m0s
- name: create-base-dv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, is cloning twice really necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be possible to do a single copy, but I need to test it, because it will mean to run VM in kubevirt-os-images namespace

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bios installer is not cloing twice while efi installer still is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

efi installer has to clone twice due to the fact, that pipelineRun can run in any namespace. One of the efi pipelineRun pod is mounting the PVC with iso. The PVC has to be in the same namespace as the pod (cross namespace is not supported during mount). So at the end when VM is finished, the result PVC has to be copied to result namespace.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@ksimon1
Copy link
Member Author

ksimon1 commented May 25, 2023

/hold I need to do additional changes

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 25, 2023
@ksimon1 ksimon1 force-pushed the update-pipelines branch 4 times, most recently from 30b2bef to e7a11f3 Compare June 1, 2023 11:30
@ksimon1
Copy link
Member Author

ksimon1 commented Jun 1, 2023

/retest

@ksimon1 ksimon1 force-pushed the update-pipelines branch 4 times, most recently from 3a768fb to 90dfa29 Compare June 2, 2023 17:03
@ksimon1 ksimon1 changed the title [WIP] feat: rework example pipelines feat: rework example pipelines Jun 2, 2023
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 2, 2023
@ksimon1
Copy link
Member Author

ksimon1 commented Jun 2, 2023

/hold cancel

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 2, 2023
@ksimon1
Copy link
Member Author

ksimon1 commented Jun 5, 2023

@akrejcir, @jcanocan, @opokornyy can you please review?

@ksimon1
Copy link
Member Author

ksimon1 commented Jun 5, 2023

/retest

@@ -29,17 +29,22 @@ done
# SECRET
accessKeyId="/tmp/secrets/accessKeyId"
secretKey="/tmp/secrets/secretKey"
namespace="kubevirt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use different namespace to test pipelines by default?

name: pipeline
---
apiVersion: v1
kind: ServiceAccount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this become an issue when pipeline SA is already there, i.e. will ssp-operator and tektoncd/operator fight for it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the SA is deployed only to ^openshift|^kube namespace. Howewer in the future there might be a time, when this bug will be fixed and ssp and tekton operator will fight over this SA. I will add a check to ssp if the SA already exists

data/tekton-pipelines/windows-bios-installer-pipeline.yaml Outdated Show resolved Hide resolved
data/tekton-pipelines/windows-bios-installer-pipeline.yaml Outdated Show resolved Hide resolved
data/tekton-pipelines/windows-bios-installer-pipeline.yaml Outdated Show resolved Hide resolved
data/tekton-pipelines/windows-efi-installer-pipeline.yaml Outdated Show resolved Hide resolved
data/tekton-pipelines/windows-efi-installer-pipeline.yaml Outdated Show resolved Hide resolved
data/tekton-pipelines/windows-efi-installer-pipeline.yaml Outdated Show resolved Hide resolved
data/tekton-pipelines/windows-efi-installer-pipeline.yaml Outdated Show resolved Hide resolved
data/tekton-pipelines/windows-efi-installer-pipeline.yaml Outdated Show resolved Hide resolved
@ksimon1 ksimon1 force-pushed the update-pipelines branch 3 times, most recently from 4b77915 to 10a3448 Compare June 6, 2023 10:51
@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 6, 2023
@kubevirt-bot kubevirt-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 6, 2023
kind: DataVolume
metadata:
annotations:
"cdi.kubevirt.io/storage.bind.immediate.requested": "true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quotes used here but in L187 not?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I updated it, but for some unknow reasons, it was reverted back

kind: Task
name: wait-for-vmi-status
timeout: 2h0m0s
- name: create-base-dv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

internal/operands/tekton-pipelines/tekton-pipelines.go Outdated Show resolved Hide resolved
tests/tekton-pipelines_test.go Outdated Show resolved Hide resolved
@ksimon1 ksimon1 force-pushed the update-pipelines branch 2 times, most recently from 5683820 to dec3e9a Compare June 12, 2023 10:51
@ksimon1
Copy link
Member Author

ksimon1 commented Jun 12, 2023

/retest

1 similar comment
@ksimon1
Copy link
Member Author

ksimon1 commented Jun 12, 2023

/retest

Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 0xFelix

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 12, 2023
@ksimon1
Copy link
Member Author

ksimon1 commented Jun 13, 2023

/retest

1 similar comment
@ksimon1
Copy link
Member Author

ksimon1 commented Jun 13, 2023

/retest

@ksimon1
Copy link
Member Author

ksimon1 commented Jun 14, 2023

/retest

@ksimon1 ksimon1 force-pushed the update-pipelines branch 2 times, most recently from f5a3692 to 994357d Compare June 14, 2023 16:02
Common-templates are going to be deprecated in some future version.
This commit is changing example pipelines to remove all automation
related to templates and replaces it with create-vm-from-manifest task.

This change helps to unify pipelines for okd and kubernetes, so now we
can use single version for okd and k8s.

windows-bios-installer pipeline is redesigned to run only in a single
namespace, which helps to reduce number of steps and complexity.

windows-customize pipeline is redesigned to run only in a single
namespace which helps to reduce number of steps and complexity.

Due to changes in pipelines, there were done necessary changes in RBAC -
objects separated in different file, rules defined in bios-installer
pipeline were replaced by roleBindings to original task's clusterRoles.

Signed-off-by: Karel Šimon <ksimon@redhat.com>
@sonarcloud
Copy link

sonarcloud bot commented Jun 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@akrejcir
Copy link
Collaborator

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2023
@kubevirt-bot kubevirt-bot merged commit 4617093 into kubevirt:master Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants