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

CORS-3142: capi: write manifests to disk during create manifests #8166

Merged
merged 5 commits into from Mar 20, 2024

Conversation

r4f4
Copy link
Contributor

@r4f4 r4f4 commented Mar 14, 2024

This PR:

  • Changes the location where the capi machine manifests are written
  • Adds TypeMeta information to all CAPI manifests
  • Uses .GroupVersion.String() to retrieve APIVersion from the respective libs.
  • Adds capi manifests to the output of create manifests

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 14, 2024

@r4f4: This pull request references CORS-3142 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

This PR:

  • Changes the location where the capi machine manifests are written
  • Adds TypeMeta information to all CAPI manifests
  • Uses .GroupVersion.String() to retrieve APIVersion from the respective libs.
  • Adds capi manifests to the output of create manifests

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 14, 2024
@r4f4
Copy link
Contributor Author

r4f4 commented Mar 14, 2024

Example run:

[root@a6b805cf4280 /]# ./openshift-install create manifests --log-level debug --dir /c/
INFO Manifests created in: /c/cluster-api, /c/manifests and /c/openshift
[root@a6b805cf4280 /]# ls /c/cluster-api/
000_capi-namespace.yaml  01_aws-cluster-controller-identity-default.yaml  01_capi-cluster.yaml  02_infra-cluster.yaml  machines
[root@a6b805cf4280 /]# ls /c/cluster-api/machines/
10_inframachine_rdossant-installer-03-krglr-bootstrap.yaml  10_inframachine_rdossant-installer-03-krglr-master-2.yaml  10_machine_rdossant-installer-03-krglr-master-1.yaml
10_inframachine_rdossant-installer-03-krglr-master-0.yaml   10_machine_rdossant-installer-03-krglr-bootstrap.yaml      10_machine_rdossant-installer-03-krglr-master-2.yaml
10_inframachine_rdossant-installer-03-krglr-master-1.yaml   10_machine_rdossant-installer-03-krglr-master-0.yaml

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 14, 2024

/cc @patrickdillon

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 15, 2024

Update: fixed unit tests.

@patrickdillon
Copy link
Contributor

/assign @vincepri

As @r4f4 mentioned this PR is placing machine manifests in a subdir of clusterapi:

$  openshift-install create manifests --dir c
$ tree c -d
c
├── cluster-api
│   └── machines
├── manifests
└── openshift

$ tree c/cluster-api
c/cluster-api
├── 000_capi-namespace.yaml
├── 01_capi-cluster.yaml
├── 02_gcp-cluster.yaml
└── machines
    ├── 10_inframachine_padillon-gcp-capi-poc-gljxr-bootstrap.yaml
    ├── 10_inframachine_padillon-gcp-capi-poc-gljxr-master-0.yaml
    ├── 10_inframachine_padillon-gcp-capi-poc-gljxr-master-1.yaml
    ├── 10_inframachine_padillon-gcp-capi-poc-gljxr-master-2.yaml
    ├── 10_machine_padillon-gcp-capi-poc-gljxr-bootstrap.yaml
    ├── 10_machine_padillon-gcp-capi-poc-gljxr-master-0.yaml
    ├── 10_machine_padillon-gcp-capi-poc-gljxr-master-1.yaml
    └── 10_machine_padillon-gcp-capi-poc-gljxr-master-2.yaml

@patrickdillon
Copy link
Contributor

The commit message for 2cf920d says:

I have chosen to move the machine manifests to cluster-api/machines
which shouldn't be technically problematic until these manifests are
"pivoted" into the installed cluster.

I think I may have confused this for you. I'm not aware of any issues that a machines subdir would cause when we pivot. I think you can remove this from the commit message.

@patrickdillon
Copy link
Contributor

/approve

This LGTM. CI tests do run create manifests before installing the cluster, so let's get some tests going:

/test altinfra-e2e-aws-capi-ovn altinfra-e2e-openstack-capi-ovn altinfra-e2e-azure-capi-ovn altinfra-e2e-vsphere-capi-ovn

Copy link
Contributor

openshift-ci bot commented Mar 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: patrickdillon

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 15, 2024
This will make it easier to load previously generated machine manifests
later on. Right now, both the capi cluster manifest and the machine
manifests `asset.Load` functions just read all yaml/json in cluster-api/.

For example, trying to `create cluster` after `create manifests` as-is
would result in the following error:
```
ERROR failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: failed to create control-plane manifest: namespaces "openshift-cluster-api-guests" already exists
```

I have chosen to move the machine manifests to `cluster-api/machines`
which shouldn't be technically problematic.
Without this meta type information, capi won't know hown the unmarshall
a serialized manifest, resulting in the following error:

```
FATAL failed to fetch Cluster: failed to load asset "Cluster API Manifests": failed to unmarshal file: error unmarshaling JSON: while decoding JSON: Object 'Kind' is missing in '{"metadata":{"creationTimestamp":null,"name":"openshift-cluster-api-guests"},"spec":{},"status":{}}'
```
Instead of hardcoding values which might easily be forgotten to be
updated when the library version is bumped.
Write CAPI manifests to disk during create manifests so that they can be
user edited and users can also provide their own set of manifests. In
general, we think of manifests as an escape hatch that should be used
when a feature is missing from the install config, and users accept the
degraded user experience of editing manifests in order to achieve
non-install-config-supported functionality.
@r4f4
Copy link
Contributor Author

r4f4 commented Mar 15, 2024

Update: changed commit message as requested.

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 15, 2024

/test altinfra-e2e-openstack-capi-ovn altinfra-e2e-azure-capi-ovn altinfra-e2e-vsphere-capi-ovn

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 15, 2024

/test ?

Copy link
Contributor

openshift-ci bot commented Mar 15, 2024

@r4f4: The following commands are available to trigger required jobs:

  • /test agent-integration-tests
  • /test altinfra-e2e-aws-capi-ovn
  • /test altinfra-e2e-gcp-capi-ovn
  • /test altinfra-images
  • /test aro-unit
  • /test e2e-agent-compact-ipv4
  • /test e2e-aws-ovn
  • /test e2e-aws-ovn-edge-zones-manifest-validation
  • /test e2e-aws-ovn-upi
  • /test e2e-azure-ovn
  • /test e2e-azure-ovn-upi
  • /test e2e-gcp-ovn
  • /test e2e-gcp-ovn-upi
  • /test e2e-metal-ipi-ovn-ipv6
  • /test e2e-openstack-ovn
  • /test e2e-vsphere-ovn
  • /test e2e-vsphere-upi
  • /test gofmt
  • /test golint
  • /test govet
  • /test images
  • /test okd-images
  • /test okd-scos-images
  • /test okd-unit
  • /test okd-verify-codegen
  • /test openstack-manifests
  • /test shellcheck
  • /test terraform-images
  • /test terraform-verify-vendor
  • /test tf-lint
  • /test unit
  • /test verify-codegen
  • /test verify-vendor
  • /test yaml-lint

The following commands are available to trigger optional jobs:

  • /test altinfra-e2e-aws-custom-security-groups
  • /test altinfra-e2e-aws-ovn
  • /test altinfra-e2e-aws-ovn-fips
  • /test altinfra-e2e-aws-ovn-imdsv2
  • /test altinfra-e2e-aws-ovn-localzones
  • /test altinfra-e2e-aws-ovn-proxy
  • /test altinfra-e2e-aws-ovn-public-ipv4-pool-capi
  • /test altinfra-e2e-aws-ovn-shared-vpc
  • /test altinfra-e2e-aws-ovn-shared-vpc-edge-zones
  • /test altinfra-e2e-aws-ovn-single-node
  • /test altinfra-e2e-aws-ovn-wavelengthzones
  • /test altinfra-e2e-azure-capi-ovn
  • /test altinfra-e2e-ibmcloud-capi-ovn
  • /test altinfra-e2e-nutanix-capi-ovn
  • /test altinfra-e2e-openstack-capi-ovn
  • /test altinfra-e2e-vsphere-capi-ovn
  • /test altinfra-e2e-vsphere-capi-static-ovn
  • /test altinfra-e2e-vsphere-capi-zones
  • /test azure-ovn-marketplace-images
  • /test e2e-agent-compact-ipv4-appliance
  • /test e2e-agent-compact-ipv4-appliance-diskimage
  • /test e2e-agent-compact-ipv4-none-platform
  • /test e2e-agent-ha-dualstack
  • /test e2e-agent-sno-ipv4-pxe
  • /test e2e-agent-sno-ipv6
  • /test e2e-aws-custom-security-groups
  • /test e2e-aws-overlay-mtu-ovn-1200
  • /test e2e-aws-ovn-edge-zones
  • /test e2e-aws-ovn-fips
  • /test e2e-aws-ovn-imdsv2
  • /test e2e-aws-ovn-proxy
  • /test e2e-aws-ovn-public-ipv4-pool
  • /test e2e-aws-ovn-public-subnets
  • /test e2e-aws-ovn-shared-vpc
  • /test e2e-aws-ovn-shared-vpc-edge-zones
  • /test e2e-aws-ovn-single-node
  • /test e2e-aws-ovn-upgrade
  • /test e2e-aws-ovn-workers-rhel8
  • /test e2e-aws-upi-proxy
  • /test e2e-azure-ovn-resourcegroup
  • /test e2e-azure-ovn-shared-vpc
  • /test e2e-azurestack
  • /test e2e-azurestack-upi
  • /test e2e-crc
  • /test e2e-gcp-ovn-shared-vpc
  • /test e2e-gcp-ovn-xpn
  • /test e2e-gcp-secureboot
  • /test e2e-gcp-upgrade
  • /test e2e-gcp-upi-xpn
  • /test e2e-ibmcloud-ovn
  • /test e2e-metal-assisted
  • /test e2e-metal-ipi-ovn
  • /test e2e-metal-ipi-ovn-dualstack
  • /test e2e-metal-ipi-ovn-swapped-hosts
  • /test e2e-metal-ipi-ovn-virtualmedia
  • /test e2e-metal-single-node-live-iso
  • /test e2e-nutanix-ovn
  • /test e2e-openstack-ccpmso
  • /test e2e-openstack-ccpmso-zone
  • /test e2e-openstack-dualstack
  • /test e2e-openstack-dualstack-upi
  • /test e2e-openstack-externallb
  • /test e2e-openstack-nfv-intel
  • /test e2e-openstack-proxy
  • /test e2e-vsphere-static-ovn
  • /test e2e-vsphere-upi-zones
  • /test e2e-vsphere-zones
  • /test e2e-vsphere-zones-techpreview
  • /test okd-e2e-agent-compact-ipv4
  • /test okd-e2e-agent-ha-dualstack
  • /test okd-e2e-agent-sno-ipv6
  • /test okd-e2e-aws-ovn
  • /test okd-e2e-aws-ovn-upgrade
  • /test okd-e2e-gcp
  • /test okd-e2e-gcp-ovn-upgrade
  • /test okd-e2e-vsphere
  • /test okd-scos-e2e-aws-ovn
  • /test okd-scos-e2e-aws-upgrade
  • /test okd-scos-e2e-gcp
  • /test okd-scos-e2e-gcp-ovn-upgrade
  • /test okd-scos-e2e-vsphere
  • /test okd-scos-unit
  • /test okd-scos-verify-codegen
  • /test tf-fmt

Use /test all to run the following jobs that were automatically triggered:

  • pull-ci-openshift-installer-master-altinfra-e2e-aws-custom-security-groups
  • pull-ci-openshift-installer-master-altinfra-e2e-aws-ovn-fips
  • pull-ci-openshift-installer-master-altinfra-e2e-aws-ovn-localzones
  • pull-ci-openshift-installer-master-altinfra-e2e-aws-ovn-shared-vpc-edge-zones
  • pull-ci-openshift-installer-master-altinfra-e2e-aws-ovn-single-node
  • pull-ci-openshift-installer-master-altinfra-e2e-aws-ovn-wavelengthzones
  • pull-ci-openshift-installer-master-altinfra-images
  • pull-ci-openshift-installer-master-aro-unit
  • pull-ci-openshift-installer-master-azure-ovn-marketplace-images
  • pull-ci-openshift-installer-master-e2e-aws-custom-security-groups
  • pull-ci-openshift-installer-master-e2e-aws-ovn
  • pull-ci-openshift-installer-master-e2e-aws-ovn-edge-zones
  • pull-ci-openshift-installer-master-e2e-aws-ovn-edge-zones-manifest-validation
  • pull-ci-openshift-installer-master-e2e-aws-ovn-fips
  • pull-ci-openshift-installer-master-e2e-aws-ovn-imdsv2
  • pull-ci-openshift-installer-master-e2e-aws-ovn-shared-vpc
  • pull-ci-openshift-installer-master-e2e-aws-ovn-shared-vpc-edge-zones
  • pull-ci-openshift-installer-master-e2e-aws-ovn-single-node
  • pull-ci-openshift-installer-master-e2e-azure-ovn
  • pull-ci-openshift-installer-master-e2e-azure-ovn-shared-vpc
  • pull-ci-openshift-installer-master-e2e-azurestack
  • pull-ci-openshift-installer-master-e2e-gcp-ovn
  • pull-ci-openshift-installer-master-e2e-gcp-ovn-shared-vpc
  • pull-ci-openshift-installer-master-e2e-gcp-ovn-xpn
  • pull-ci-openshift-installer-master-e2e-gcp-secureboot
  • pull-ci-openshift-installer-master-e2e-openstack-nfv-intel
  • pull-ci-openshift-installer-master-e2e-openstack-ovn
  • pull-ci-openshift-installer-master-e2e-openstack-proxy
  • pull-ci-openshift-installer-master-e2e-vsphere-ovn
  • pull-ci-openshift-installer-master-e2e-vsphere-zones
  • pull-ci-openshift-installer-master-e2e-vsphere-zones-techpreview
  • pull-ci-openshift-installer-master-gofmt
  • pull-ci-openshift-installer-master-golint
  • pull-ci-openshift-installer-master-govet
  • pull-ci-openshift-installer-master-images
  • pull-ci-openshift-installer-master-okd-e2e-aws-ovn-upgrade
  • pull-ci-openshift-installer-master-okd-images
  • pull-ci-openshift-installer-master-okd-scos-images
  • pull-ci-openshift-installer-master-okd-scos-unit
  • pull-ci-openshift-installer-master-okd-scos-verify-codegen
  • pull-ci-openshift-installer-master-okd-unit
  • pull-ci-openshift-installer-master-okd-verify-codegen
  • pull-ci-openshift-installer-master-openstack-manifests
  • pull-ci-openshift-installer-master-shellcheck
  • pull-ci-openshift-installer-master-tf-fmt
  • pull-ci-openshift-installer-master-tf-lint
  • pull-ci-openshift-installer-master-unit
  • pull-ci-openshift-installer-master-verify-codegen
  • pull-ci-openshift-installer-master-verify-vendor
  • pull-ci-openshift-installer-master-yaml-lint

In response to this:

/test ?

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.

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 15, 2024

level=fatal msg=failed to fetch Cluster API Machine Manifests: failed to generate asset "Cluster API Machine Manifests": mkdir cluster-api: permission denied

Not sure why. I'll have to investigate.

The `asset.PersistToFile` function already takes care of creating the
necessary directories and files with appropriate permissions.
@r4f4
Copy link
Contributor Author

r4f4 commented Mar 15, 2024

/test altinfra-e2e-openstack-capi-ovn altinfra-e2e-azure-capi-ovn altinfra-e2e-vsphere-capi-ovn

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 15, 2024

Update: fixed a permission issue with creating the capi manifest directories

From the install-install container for the altinfra-e2e-azure-capi-ovn job:

sh-4.4$ ls -l /tmp/installer/cluster-api/*
-rw-r-----. 1 1005000000 root  124 Mar 15 19:41 /tmp/installer/cluster-api/000_capi-namespace.yaml
-rw-r-----. 1 1005000000 root  107 Mar 15 19:41 /tmp/installer/cluster-api/00_azure-namespace.yaml
-rw-r-----. 1 1005000000 root  510 Mar 15 19:41 /tmp/installer/cluster-api/01_aws-cluster-controller-identity-default.yaml
-rw-r-----. 1 1005000000 root  230 Mar 15 19:41 /tmp/installer/cluster-api/01_azure-client-secret.yaml
-rw-r-----. 1 1005000000 root  464 Mar 15 19:41 /tmp/installer/cluster-api/01_capi-cluster.yaml
-rw-r-----. 1 1005000000 root 1168 Mar 15 19:41 /tmp/installer/cluster-api/02_azure-cluster.yaml

/tmp/installer/cluster-api/machines:
total 32
-rw-r-----. 1 1005000000 root 840 Mar 15 19:41 10_inframachine_ci-op-qtzzzlk5-bdefc-8tq79-bootstrap.yaml
-rw-r-----. 1 1005000000 root 775 Mar 15 19:41 10_inframachine_ci-op-qtzzzlk5-bdefc-8tq79-master-0.yaml
-rw-r-----. 1 1005000000 root 775 Mar 15 19:41 10_inframachine_ci-op-qtzzzlk5-bdefc-8tq79-master-1.yaml
-rw-r-----. 1 1005000000 root 775 Mar 15 19:41 10_inframachine_ci-op-qtzzzlk5-bdefc-8tq79-master-2.yaml
-rw-r-----. 1 1005000000 root 507 Mar 15 19:41 10_machine_ci-op-qtzzzlk5-bdefc-8tq79-bootstrap.yaml
-rw-r-----. 1 1005000000 root 502 Mar 15 19:41 10_machine_ci-op-qtzzzlk5-bdefc-8tq79-master-0.yaml
-rw-r-----. 1 1005000000 root 502 Mar 15 19:41 10_machine_ci-op-qtzzzlk5-bdefc-8tq79-master-1.yaml
-rw-r-----. 1 1005000000 root 502 Mar 15 19:41 10_machine_ci-op-qtzzzlk5-bdefc-8tq79-master-2.yaml

@patrickdillon
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 19, 2024
@r4f4
Copy link
Contributor Author

r4f4 commented Mar 19, 2024

/label acknowledge-critical-fixes-only
Behind a feature gate. No capi manifests are generated if CAPI is disabled.

@openshift-ci openshift-ci bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Mar 19, 2024
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD aa76f02 and 2 for PR HEAD 2833e66 in total

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 6ca6a89 and 1 for PR HEAD 2833e66 in total

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 20, 2024

/test e2e-openstack-ovn

Copy link
Contributor

openshift-ci bot commented Mar 20, 2024

@r4f4: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/altinfra-e2e-azure-capi-ovn 2833e66 link false /test altinfra-e2e-azure-capi-ovn
ci/prow/altinfra-e2e-aws-capi-ovn ac79f0c link true /test altinfra-e2e-aws-capi-ovn
ci/prow/e2e-azurestack 2833e66 link false /test e2e-azurestack
ci/prow/altinfra-e2e-vsphere-capi-ovn 2833e66 link false /test altinfra-e2e-vsphere-capi-ovn
ci/prow/e2e-vsphere-zones 2833e66 link false /test e2e-vsphere-zones
ci/prow/altinfra-e2e-aws-ovn-localzones 2833e66 link false /test altinfra-e2e-aws-ovn-localzones
ci/prow/altinfra-e2e-aws-ovn-wavelengthzones 2833e66 link false /test altinfra-e2e-aws-ovn-wavelengthzones
ci/prow/altinfra-e2e-aws-ovn-shared-vpc-edge-zones 2833e66 link false /test altinfra-e2e-aws-ovn-shared-vpc-edge-zones
ci/prow/altinfra-e2e-aws-custom-security-groups 2833e66 link false /test altinfra-e2e-aws-custom-security-groups
ci/prow/altinfra-e2e-aws-ovn-fips 2833e66 link false /test altinfra-e2e-aws-ovn-fips
ci/prow/okd-e2e-aws-ovn-upgrade 2833e66 link false /test okd-e2e-aws-ovn-upgrade
ci/prow/altinfra-e2e-aws-ovn 2833e66 link false /test altinfra-e2e-aws-ovn
ci/prow/e2e-aws-ovn-single-node 2833e66 link false /test e2e-aws-ovn-single-node
ci/prow/altinfra-e2e-openstack-capi-ovn 2833e66 link false /test altinfra-e2e-openstack-capi-ovn
ci/prow/e2e-aws-ovn-fips 2833e66 link false /test e2e-aws-ovn-fips
ci/prow/altinfra-e2e-aws-ovn-single-node 2833e66 link false /test altinfra-e2e-aws-ovn-single-node

Full PR test history. Your PR dashboard.

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.

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 20, 2024

/override ci/prow/e2e-openstack-ovn
Not related to the changes and just failing in one e2e test.

Copy link
Contributor

openshift-ci bot commented Mar 20, 2024

@r4f4: Overrode contexts on behalf of r4f4: ci/prow/e2e-openstack-ovn

In response to this:

/override ci/prow/e2e-openstack-ovn
Not related to the changes and just failing in one e2e test.

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.

@openshift-merge-bot openshift-merge-bot bot merged commit fb92a96 into openshift:master Mar 20, 2024
40 of 55 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-installer-altinfra-container-v4.16.0-202403201847.p0.gfb92a96.assembly.stream.el8 for distgit ose-installer-altinfra.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants