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

MGMT-4668: Generate OLM opeartor manifest to custom file #1609

Merged
merged 1 commit into from May 23, 2021

Conversation

machacekondra
Copy link
Member

@machacekondra machacekondra commented Apr 28, 2021

This PR add a possibility to create manifests from assisted-installer.
In some cases it may be useful to create manifest from
assisted-isntaller instead of openshift-installer. For example when
installing CNV/LSO/OCS we need to have predefined CRDs for the
operators, because at the time of the operator is being created the CRDs
are not yet created by the OLM.

This PR add support to add the files to the bootstrap.ign to directory
prefix /opt/openshift/olmoperators, so later assisted-installer can fetch
the content of those files and create them via dynamic client.

Signed-off-by: Ondra Machacek omachace@redhat.com

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: machacekondra
To complete the pull request process, please assign yuvigold after the PR has been reviewed.
You can assign the PR to them by writing /assign @yuvigold in a comment when ready.

The full list of commands accepted by this bot can be found 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

@machacekondra
Copy link
Member Author

Related-to: openshift/assisted-installer#271

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 28, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 29, 2021
@pkliczewski
Copy link
Contributor

@eranco74 @tsorya please review

@tsorya
Copy link
Contributor

tsorya commented May 4, 2021

@machacekondra why it is different than creating manifests with bootkube by adding them to manifests? Trying to understand when we expect those manifests to be created? after cluster is up and running?

@machacekondra
Copy link
Member Author

@machacekondra why it is different than creating manifests with bootkube by adding them to manifests? Trying to understand when we expect those manifests to be created? after cluster is up and running?

The problem is that the operator CRDs are not created at the time the openshift-installer creates the manifests resources. That's why we had to store the CRD spec in assisted-service. If we would not create the CRD by ourselfs, the openshift-installer would simply fail to create the operator resources, because it's not yet created by OLM.

With this PR, we create only OLM's resources by the openshift-installer manifests and we create our own custom assisted-installer manifests, which are created after the openshift is ready, which means OLM is ready and the OLM CRDs are created and we can without any issue create our operators CRs.

@tsorya
Copy link
Contributor

tsorya commented May 4, 2021

@machacekondra wondering if those manifests can't be applied from bootstrap. When control plane will be up, operators should start already no? cluster bootstrap should eventually succeed no?

@eranco74
Copy link
Contributor

eranco74 commented May 4, 2021

The problem is that the operator CRDs are not created at the time the openshift-installer
The CRDs will get created by the relevant operator once the operator will start running, no?

How would you do it if you were installing with openshift installer?

With this PR, we create only OLM's resources by the openshift-installer manifests and we create our own custom assisted-installer manifests, which are created after the openshift is ready

Who will apply these custom assisted-installer manifests?

@tsorya
Copy link
Contributor

tsorya commented May 4, 2021

After talking with @eranco74 we think that this case is relevant only for SNO, regular flow should work without this one.
The main question what we are trying to solve here. SNO flow?
Another thing is that if we want it in SNO flow we should create api (if we don't have one already) that will allow to download those manifests and not to push them to bootstrap ignition as they shouldn't be part of it at all.

@machacekondra
Copy link
Member Author

The problem is that the operator CRDs are not created at the time the openshift-installer
The CRDs will get created by the relevant operator once the operator will start running, no?

How would you do it if you were installing with openshift installer?

With this PR, we create only OLM's resources by the openshift-installer manifests and we create our own custom assisted-installer manifests, which are created after the openshift is ready

Who will apply these custom assisted-installer manifests?

assisted-installer

@machacekondra wondering if those manifests can't be applied from bootstrap. When control plane will be up, operators should start already no? cluster bootstrap should eventually succeed no?

I am not sure about this one. We wait for for the operators to be ready in assisted-installer posinstall stage so I think there could be some catch.

Another thing is that if we want it in SNO flow we should create api (if we don't have one already) that will allow to download those manifests and not to push them to bootstrap ignition as they shouldn't be part of it at all.

Why do you think it's SNO issue only? It's problem with normal installation as well. But I agree that creating a special API for those files would make a better sense. Something like:

/clusters/{cluster_id}/downloads/files?file_name=custom_manifests.yaml

And the content would be all the relevant custom manifests?

@eranco74
Copy link
Contributor

eranco74 commented May 5, 2021

Pretty sure that it's relevant only for SNO because assisted-installer is capable to install OLM operators without creating the manifests from the assisted-controller.
It works the same when installing a cluster with openshift-installer, cluster-bootstrap will keep on trying to apply the manifests until it succeeds, at some point the relevant operator (that is creating the required CRDs for applying the manifest) will start running on the master nodes, create the CRDs and cluster bootstrap will succeed.
When installing SNO it's a different story (because there is no master node running in parallel with the bootstrap).
This is documented in the SNO bootstrap in place enhancement.
If this is what this code is trying to solve ( I don't think we want it for multi-node cluster in order to stay inline with openshift-installer behavior), we should decide which manifests get this special treatment, I guess only OLM related manifests that assisted-service support for SNO.

Also I agree there should be a dedicated API for these manifests, overloading them on the bootstrap ignition (bootstrap node never use them) and pulling the bootstrap ignition from the assisted-controller seems wrong.

@openshift-ci openshift-ci bot added the api-review Categorizes an issue or PR as actively needing an API review. label May 6, 2021
@machacekondra
Copy link
Member Author

So I've update the code to upload the manifest to storage. Example:

$ curl http://10.97.140.59:8090/api/assisted-install/v1/clusters/dcf20f64-fe45-404a-af45-a205856e27e8/downloads/files?file_name=custom_manifests.yaml
---
apiVersion: hco.kubevirt.io/v1beta1
kind: HyperConverged
metadata:
  name: kubevirt-hyperconverged
  namespace: openshift-cnv
spec:
  BareMetalPlatform: true
---
apiVersion: "local.storage.openshift.io/v1alpha1"
kind: "LocalVolumeSet"
metadata:
  name: "local-disks"
  namespace: "openshift-local-storage"
spec:
  storageClassName: "localblock-sc"
  volumeMode: Block
  deviceInclusionSpec:
    deviceTypes:
      - "disk"

@machacekondra
Copy link
Member Author

/test subsystem-aws

@machacekondra machacekondra changed the title MGMT-4668: Generate OLM opeartor manifest to bootstrap ignition MGMT-4668: Generate OLM opeartor manifest to custom file May 10, 2021
@machacekondra
Copy link
Member Author

/retest

@machacekondra machacekondra force-pushed the dont_use_crd branch 3 times, most recently from 4b676e2 to 7810b0a Compare May 17, 2021 12:45
@machacekondra
Copy link
Member Author

/retest

1 similar comment
@machacekondra
Copy link
Member Author

/retest

@machacekondra
Copy link
Member Author

@eranco74 @tsorya Can you please re-review?

}
}

return nil
}

func (mgr *Manager) createManifests(ctx context.Context, cluster *common.Cluster, filename string, content []byte) error {
func (mgr *Manager) createCustomManifest(ctx context.Context, cluster *common.Cluster, content string) error {
objectFileName := fmt.Sprintf("%s/custom_manifests.yaml", cluster.ID)
Copy link
Contributor

Choose a reason for hiding this comment

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

createCustomManifest const it

Copy link
Contributor

@eranco74 eranco74 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

}
}

return nil
}

func (mgr *Manager) createManifests(ctx context.Context, cluster *common.Cluster, filename string, content []byte) error {
func (mgr *Manager) createCustomManifest(ctx context.Context, cluster *common.Cluster, content string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a comment explaining that this is for custom manifests that requires CRDs are created late by the cluster operators (and not by the CVO)

@eranco74
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 20, 2021
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 20, 2021
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label May 21, 2021
This PR add a possibility to create manifests from assisted-installer.
In some cases it may be useful to create manifest from
assisted-isntaller instead of openshift-installer. For example when
installing CNV/LSO/OCS we need to have predefined CRDs for the
operators, because at the time of the operator is being created the CRDs
are not yet created by the OLM.

This PR add support to read the files from custom_manifest.yaml
and fetch the content of those files
and create them via dynamic client. Since assisted-installer-controller
runs with limited permissions, every resource which should be created by
assisted_installer_controller must be added to the clusterrole.

Signed-off-by: Ondra Machacek <omachace@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented May 21, 2021

@machacekondra: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-metal-assisted-operator-disconnected 061dfbf link /test e2e-metal-assisted-operator-disconnected

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.

@machacekondra
Copy link
Member Author

/retest

@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 21, 2021
@tsorya
Copy link
Contributor

tsorya commented May 23, 2021

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 23, 2021
@openshift-ci
Copy link

openshift-ci bot commented May 23, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: machacekondra, tsorya

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 May 23, 2021
@openshift-merge-robot openshift-merge-robot merged commit c1fcc80 into openshift:master May 23, 2021
machacekondra added a commit to machacekondra/assisted-service that referenced this pull request Jun 1, 2021
machacekondra added a commit to machacekondra/assisted-service that referenced this pull request Jun 1, 2021
machacekondra added a commit to machacekondra/assisted-service that referenced this pull request Jun 1, 2021
@pkliczewski
Copy link
Contributor

/cherry-pick ocm-2.3

@openshift-cherrypick-robot

@pkliczewski: new pull request could not be created: failed to create pull request against openshift/assisted-service#ocm-2.3 from head openshift-cherrypick-robot:cherry-pick-1609-to-ocm-2.3: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"No commits between openshift:ocm-2.3 and openshift-cherrypick-robot:cherry-pick-1609-to-ocm-2.3"}],"documentation_url":"https://docs.github.com/rest/reference/pulls#create-a-pull-request"}

In response to this:

/cherry-pick ocm-2.3

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.

@pkliczewski
Copy link
Contributor

This commit is already part of ocm-2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. 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

7 participants