Skip to content

Conversation

@mvazquezc
Copy link
Member

What this PR does / why we need it:

It updates the kubevirt configuration as of the latest release (03/23/2023).

Checklist

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

@mvazquezc
Copy link
Member Author

@davidvossel could you take a look?

@netlify
Copy link

netlify bot commented Mar 23, 2023

Deploy Preview for hypershift-docs ready!

Name Link
🔨 Latest commit 51ba765
🔍 Latest deploy log https://app.netlify.com/sites/hypershift-docs/deploys/642a8d790c353b0008316cf4
😎 Deploy Preview https://deploy-preview-2318--hypershift-docs.netlify.app/how-to/kubevirt/create-kubevirt-cluster
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 23, 2023

@mvazquezc: The label(s) area/area/hypershift-operator cannot be applied, because the repository doesn't have them.

Details

In response to this:

/area area/hypershift-operator

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mvazquezc mvazquezc force-pushed the updated-kv-docs branch 2 times, most recently from 1e12240 to d39a0b8 Compare March 23, 2023 18:44
--memory $MEM \
--cores $CPU
--cores $CPU \
#--release-image quay.io/openshift-release-dev/ocp-release:$OCP_RELEASE \
Copy link
Contributor

Choose a reason for hiding this comment

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

i'd rather omit the release-image from the example command. we want hypershift cli to pick the best default for us. if someone is using the latest hypershift operator, the default will be accurate

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 will remove it and add a note stating that this flag could be used to provision the cluster with a specific OCP release. Let me know if this is good enough or if we want to completely omit this information.

From my point of view I see it useful in terms of testing, let's say that you're running a hypershift version that supports deploying from 4.11 to 4.13 hosted clusters. Being able to specify a given release may be helpful when troubleshooting issues / reproducing a bug / testing something in a specific release / etc.

Comment on lines 61 to 62
# You may want to run this instead
hypershift install --hypershift-image quay.io/hypershift/hypershift-operator:4.12
Copy link
Contributor

Choose a reason for hiding this comment

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

i think this has the potential to lead to more confusion. if someone uses a hypershift operator pinned to a specific release (and not the latest one) then we have to start talking about release payload versioning and other stuff, which isn't well defined at the moment. i'd rather we stick to defaults for the documentation examples.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it, will remove that from the doc.

Comment on lines 130 to 131
In order for the hosted cluster to complete its deployment, we need to fix the Ingress, we will do that in the next sections.

Copy link
Contributor

Choose a reason for hiding this comment

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

the default settings are meant to avoid people needing to consider ingress

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, will reorganize the document so the default example doesn't require ingress.

export MEM="6Gi"
export CPU="2"
export WORKER_COUNT="2"
export BASE_DOMAIN=hypershift.lab
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't want to specify a basedomain by default. that's the advanced case that requires someone to setup DNS entries

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed this.

Comment on lines 298 to 343
4. Create a ClusterIP service and a OCP Route in the management cluster for providing ingress to the hosted cluster (One limitation is that we can only expose one of the router ports, in this case we will expose the https one.)
```shell
export HTTPS_NODEPORT=$(oc --kubeconfig $CLUSTER_NAME-kubeconfig get services -n openshift-ingress router-nodeport-default -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')
cat << EOF | oc apply -f -
apiVersion: v1
kind: Service
metadata:
labels:
app: $CLUSTER_NAME
name: $CLUSTER_NAME-apps
namespace: clusters-$CLUSTER_NAME
spec:
ports:
- name: https-443
port: 443
protocol: TCP
targetPort: ${HTTPS_NODEPORT}
selector:
kubevirt.io: virt-launcher
type: ClusterIP
EOF
cat << EOF | oc apply -f -
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: $CLUSTER_NAME-443
namespace: clusters-$CLUSTER_NAME
spec:
host: data.apps.$CLUSTER_NAME.$BASE_DOMAIN
wildcardPolicy: Subdomain
tls:
termination: passthrough
insecureEdgeTerminationPolicy: Redirect
port:
targetPort: https-443
to:
kind: Service
name: $CLUSTER_NAME-apps
weight: 100
EOF
```
## Checking HostedCluster status after having fixed the ingress
Now that we fixed the ingress, we should see our HostedCluster progress moved from `Partial` to `Completed`.
Copy link
Contributor

Choose a reason for hiding this comment

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

this is done automatically now for the latest hypershift operator as long as guest clsuters are using 4.12.2 or greater

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, removed.

@zanetworker
Copy link

zanetworker commented Mar 23, 2023

FYI @lahinson

@lahinson
Copy link

@davidvossel After these updates are approved and merged, should I add this info to the content we're working on in stolostron/rhacm-docs#4803?

@mvazquezc
Copy link
Member Author

hey @davidvossel I modified the doc, could you review again? thanks.

@csrwng
Copy link
Contributor

csrwng commented Mar 29, 2023

/area hypershift-operator

@openshift-ci openshift-ci bot added area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release and removed do-not-merge/needs-area labels Mar 29, 2023
wking added a commit to wking/ci-tools that referenced this pull request Mar 30, 2023
…e annotation

bee450b (ci-operator: expose ephemeral cluster versions based on
parents, 2020-08-11, openshift#1098) taught assembleReleaseStep to consume the
release.openshift.io/config annotation on an ImageStream to find a
version prefix that actually reflects the 4.y release branch (instead
of using 0.0.1-0 as the prefix).  Those annotations are set on the
app.ci ImageStreams, for example:

  $ oc whoami -c
  default/api-ci-l2s4-p1-openshiftapps-com:6443/wking
  $ oc -n ocp get -o json imagestream 4.13 | jq -r '.metadata.annotations["release.openshift.io/config"] | fromjson | .name'
  4.13.0-0.ci

But they are not set in ImageStreams contained within release images:

  $ oc adm release info -o json registry.ci.openshift.org/ocp/release:4.13.0-0.ci-2023-03-29-224346 | jq '.references | {kind, metadata}'
  {
    "kind": "ImageStream",
    "metadata": {
      "name": "4.13.0-0.ci-2023-03-29-224346",
      "creationTimestamp": "2023-03-29T22:52:54Z",
      "annotations": {
        "release.openshift.io/from-image-stream": "ocp/4.13-2023-03-29-224346"
      }
    }
  }

With this commit, I'm taking the name out of the imported release
ImageStream and trying to parse it as a Semantic Version.  If it
parses, I'm constructing a release.openshift.io/config annotation to
set just the 'name' property to the MAJOR.MINOR.SPEC from that parsed
name.  This should allow cluster-bot runs like:

  launch 4.13.0-0.ci,openshift/cluster-version-operator#918,openshift/hypershift#2318 hypershift-hosted

to build releases named 4.13.0-0-... instead of their current
0.0.1-0-...:

  $ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/logs/release-openshift-origin-installer-launch-hypershift-hosted/1641294936391290880/artifacts/release/artifacts/release-payload-latest/image-references | jq -r .metadata.name
  0.0.1-0.test-2023-03-30-043404-ci-ln-h9dwcbk-latest

which is failing to run with [1]:

  Release image is not valid: {
    "lastTransitionTime": "2023-03-30T04:36:29Z",
    "message": "releases before 4.8 are not supported",
    "observedGeneration": 3,
    "reason": "InvalidImage",
    "status": "False",
    "type": "ValidReleaseImage"
  }

[1]: https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/release-openshift-origin-installer-launch-hypershift-hosted/1641294936391290880#1:build-log.txt%3A203-210
wking added a commit to wking/ci-tools that referenced this pull request Mar 30, 2023
…e annotation

bee450b (ci-operator: expose ephemeral cluster versions based on
parents, 2020-08-11, openshift#1098) taught assembleReleaseStep to consume the
release.openshift.io/config annotation on an ImageStream to find a
version prefix that actually reflects the 4.y release branch (instead
of using 0.0.1-0 as the prefix).  Those annotations are set on the
app.ci ImageStreams, for example:

  $ oc whoami -c
  default/api-ci-l2s4-p1-openshiftapps-com:6443/wking
  $ oc -n ocp get -o json imagestream 4.13 | jq -r '.metadata.annotations["release.openshift.io/config"] | fromjson | .name'
  4.13.0-0.ci

But they are not set in ImageStreams contained within release images:

  $ oc adm release info -o json registry.ci.openshift.org/ocp/release:4.13.0-0.ci-2023-03-29-224346 | jq '.references | {kind, metadata}'
  {
    "kind": "ImageStream",
    "metadata": {
      "name": "4.13.0-0.ci-2023-03-29-224346",
      "creationTimestamp": "2023-03-29T22:52:54Z",
      "annotations": {
        "release.openshift.io/from-image-stream": "ocp/4.13-2023-03-29-224346"
      }
    }
  }

With this commit, I'm taking the name out of the imported release
ImageStream and trying to parse it as a Semantic Version.  If it
parses, I'm constructing a release.openshift.io/config annotation to
set just the 'name' property to the MAJOR.MINOR.PATCH from that parsed
name.  This should allow cluster-bot runs like:

  launch 4.13.0-0.ci,openshift/cluster-version-operator#918,openshift/hypershift#2318 hypershift-hosted

to build releases named 4.13.0-0-... instead of their current
0.0.1-0-...:

  $ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/logs/release-openshift-origin-installer-launch-hypershift-hosted/1641294936391290880/artifacts/release/artifacts/release-payload-latest/image-references | jq -r .metadata.name
  0.0.1-0.test-2023-03-30-043404-ci-ln-h9dwcbk-latest

which is failing to run with [1]:

  Release image is not valid: {
    "lastTransitionTime": "2023-03-30T04:36:29Z",
    "message": "releases before 4.8 are not supported",
    "observedGeneration": 3,
    "reason": "InvalidImage",
    "status": "False",
    "type": "ValidReleaseImage"
  }

[1]: https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/release-openshift-origin-installer-launch-hypershift-hosted/1641294936391290880#1:build-log.txt%3A203-210
@mvazquezc mvazquezc force-pushed the updated-kv-docs branch 2 times, most recently from 1ad115e to 5596268 Compare March 30, 2023 06:08
Copy link
Contributor

@jparrill jparrill left a comment

Choose a reason for hiding this comment

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

/lgtm

Comment on lines 43 to 47
~~~sh
podman cp $(podman create --name hypershift --rm --pull always quay.io/hypershift/hypershift-operator:latest):/usr/bin/hypershift /tmp/hypershift && podman rm -f hypershift

sudo install -m 0755 -o root -g root /tmp/hypershift /usr/local/bin/hypershift
~~~
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you can use this resource:
image

code sample:
image


A load balancer is required. If MetalLB is in use, here are some example steps
outlining how to configure MetalLB after [installing MetalLB](https://docs.openshift.com/container-platform/4.12/networking/metallb/metallb-operator-install.html).
If we access the cluster we will see we have two nodes and that there are some cluster operators failing because Ingress has not been properly configured.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/If we access the cluster/If we access the Hosted Cluster/

namespace: metallb-system
EOF
```
oc --kubeconfig $CLUSTER_NAME-kubeconfig get nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you clarify in the var name, which cluster are you referring to?

Copy link
Member Author

Choose a reason for hiding this comment

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

This var is configured at the beginning of the scenario and does not change.

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Mar 30, 2023
@mvazquezc mvazquezc force-pushed the updated-kv-docs branch 4 times, most recently from 75b47fb to a16a47d Compare March 30, 2023 08:14
@mvazquezc
Copy link
Member Author

mvazquezc commented Mar 30, 2023

I just squashed all three commits. I think this is now ready for a final review. Thanks.

@mvazquezc mvazquezc removed the request for review from enxebre March 30, 2023 08:16
@mvazquezc mvazquezc requested review from davidvossel and jparrill and removed request for csrwng and davidvossel March 30, 2023 08:16
Copy link
Contributor

@jparrill jparrill left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 30, 2023
wking added a commit to wking/ci-tools that referenced this pull request Mar 30, 2023
…e annotation

bee450b (ci-operator: expose ephemeral cluster versions based on
parents, 2020-08-11, openshift#1098) taught assembleReleaseStep to consume the
release.openshift.io/config annotation on an ImageStream to find a
version prefix that actually reflects the 4.y release branch (instead
of using 0.0.1-0 as the prefix).  Those annotations are set on the
app.ci ImageStreams, for example:

  $ oc whoami -c
  default/api-ci-l2s4-p1-openshiftapps-com:6443/wking
  $ oc -n ocp get -o json imagestream 4.13 | jq -r '.metadata.annotations["release.openshift.io/config"] | fromjson | .name'
  4.13.0-0.ci

But they are not set in ImageStreams contained within release images:

  $ oc adm release info -o json registry.ci.openshift.org/ocp/release:4.13.0-0.ci-2023-03-29-224346 | jq '.references | {kind, metadata}'
  {
    "kind": "ImageStream",
    "metadata": {
      "name": "4.13.0-0.ci-2023-03-29-224346",
      "creationTimestamp": "2023-03-29T22:52:54Z",
      "annotations": {
        "release.openshift.io/from-image-stream": "ocp/4.13-2023-03-29-224346"
      }
    }
  }

With this commit, I'm taking the name out of the imported release
ImageStream and trying to parse it as a Semantic Version.  If it
parses, I'm constructing a release.openshift.io/config annotation to
set just the 'name' property to the MAJOR.MINOR.PATCH from that parsed
name.  This should allow cluster-bot runs like:

  launch 4.13.0-0.ci,openshift/cluster-version-operator#918,openshift/hypershift#2318 hypershift-hosted

to build releases named 4.13.0-0-... instead of their current
0.0.1-0-...:

  $ curl -s https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/logs/release-openshift-origin-installer-launch-hypershift-hosted/1641294936391290880/artifacts/release/artifacts/release-payload-latest/image-references | jq -r .metadata.name
  0.0.1-0.test-2023-03-30-043404-ci-ln-h9dwcbk-latest

which is failing to run with [1]:

  Release image is not valid: {
    "lastTransitionTime": "2023-03-30T04:36:29Z",
    "message": "releases before 4.8 are not supported",
    "observedGeneration": 3,
    "reason": "InvalidImage",
    "status": "False",
    "type": "ValidReleaseImage"
  }

[1]: https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/release-openshift-origin-installer-launch-hypershift-hosted/1641294936391290880#1:build-log.txt%3A203-210
Copy link
Contributor

@davidvossel davidvossel left a comment

Choose a reason for hiding this comment

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

looks great, i had a couple of suggestions

Comment on lines 24 to 52
```shell
podman run --rm --privileged -it -v \
$PWD:/output docker.io/library/golang:1.18 /bin/bash -c \
'git clone https://github.com/openshift/hypershift.git && \
cd hypershift/ && \
make hypershift && \
mv bin/hypershift /output/hypershift'

sudo mv $PWD/hypershift /usr/local/bin
```
=== "Podman"

```shell
podman run --rm --privileged -it -v \
$PWD:/output docker.io/library/golang:1.18 /bin/bash -c \
'git clone https://github.com/openshift/hypershift.git && \
cd hypershift/ && \
make hypershift && \
mv bin/hypershift /output/hypershift'

sudo install -m 0755 -o root -g root $PWD/hypershift /usr/local/bin/hypershift
rm $PWD/hypershift
```

=== "Docker"

```shell
docker run --rm --privileged -it -v \
$PWD:/output docker.io/library/golang:1.18 /bin/bash -c \
'git clone https://github.com/openshift/hypershift.git && \
cd hypershift/ && \
make hypershift && \
mv bin/hypershift /output/hypershift'

sudo install -m 0755 -o root -g root $PWD/hypershift /usr/local/bin/hypershift
rm $PWD/hypershift
```
Copy link
Contributor

Choose a reason for hiding this comment

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

the podman and docker command are identical except for the use of podman or docker as the binary, right? If so I'd suggest documenting this just with podman, and saying the command is the same for docker.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added note.

Comment on lines 51 to 87
export CLUSTER_NAME=example
export HOSTEDCLUSTER_NAME=example
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason we use CLUSTER_NAME instead of HOSTEDCLUSTER_NAME is that CLUSTER_NAME is consistent with documentation for all the other hypershift platforms. I'd prefer to remain consistent. So if we're going to change this env var, i'd want to change it across the board.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed back to CLUSTER_NAME.

Comment on lines 255 to 270
## Advanced Ingress and DNS

This process involves three steps.
Every OpenShift cluster comes setup with a default application ingress
controller which is expected have an external DNS record associated with it.

**Step 1. Cluster Creation**
For example, a HyperShift cluster named `example` with the base domain
`hypershift.lab` is created, then it is expected that the wildcard domain
`*.apps.example.hypershift.lab` can be resolved.

Create Hypershift KubeVirt cluster with a custom base domain you control. This
can be achieved using the `--base-domain` cli argument during cluster creation.
There are two ways to set this up:

Below is an example.
* Default: Reuse the management cluster's wildcard DNS routing and make the
Hypershift KubeVirt cluster a subdomain of the management cluster. This is what we have seen in the previous section.
* Advanced: Set up a new LoadBalancer service and wildcard DNS record for the HostedCluster `*.apps` domain.

### Deploying the HostedCluster specifying our base domain
Copy link
Contributor

Choose a reason for hiding this comment

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

Previously we had a Default Ingress and DNS Behavior section which clearly outlined how ingress works out of the box. then we have a Customized Ingress and DNS Behavior which went into the details around how someone can set up their own basedomain. I'd like to keep those two sections.

Can the Default Ingress and DNS Behavior be re-introduced?

Copy link
Member Author

Choose a reason for hiding this comment

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

Reintroduced and reworded some sections to match with the 3-steps proposed by the original doc:

  1. Cluster creation
  2. LoadBalancer creation
  3. Wildcard DNS configuration

@davidvossel
Copy link
Contributor

After these updates are approved and merged, should I add this info to the content we're working on in stolostron/rhacm-docs#4803?

@lahinson yes, i think it would make sense to update the official docs once these changes land. These changes definitely add further clarity to the procedures

Signed-off-by: Mario Vazquez <mavazque@redhat.com>

Incorporated feedback

Signed-off-by: Mario Vazquez <mavazque@redhat.com>

Added Juan P. feedback

Signed-off-by: Mario Vazquez <mavazque@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 3, 2023
@mvazquezc
Copy link
Member Author

@davidvossel I just pushed some changes addressing your suggestions. Ready for review when you're back.

Copy link
Contributor

@davidvossel davidvossel left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

this is great! thanks for improving the docs

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 10, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidvossel, mvazquezc

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

The pull request process is described here

Details 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 10, 2023

@mvazquezc: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit deda143 into openshift:main Apr 10, 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. area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants