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

Fast-forward v0 #133

Merged
merged 12 commits into from
Apr 25, 2024
Merged

Fast-forward v0 #133

merged 12 commits into from
Apr 25, 2024

Conversation

omertuc
Copy link
Member

@omertuc omertuc commented Apr 25, 2024

No description provided.

omertuc and others added 12 commits April 5, 2024 13:35
When recert runs into an error, it returns it as a `Result` from the
`main` function. This causes the Rust runtime to print the error trace.

However, the error does not get included in the recert summary files. In
the summary, you only see the logs, which makes it look like no error
occurred.

This commit makes it so that when recert runs into an error the error
will be included in summary files
Include error in recert summary
Enabled `+#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)]`

(but also `allow-unwrap-in-tests = true` because it's too strict for
tests)

This means that `unwrap`, `expect` and `panic` are not allowed in the
project, unless the programmer states `#[allow(clippy::unwrap_used)]`,
preferably with a comment explaining why the `unwrap`/`expect` could
never panic.

Removed all instances of `unwrap` which had better alternatives, but
left some that were reasonable.

This should stop recert from causing panics (unfortunately dependencies
might still panic)

Also removed references to `anyhow::Error` from return values, as this
is unnecessarily verbose and can be inferred implicitly. It's constantly
being added by the rust_analyzer's extract_function code action, and I
forget to remove it.
This change ensures that rollouts after recert for the following components are
skipped:

- openshift-apiserver/openshift-apiserver
- openshift-oauth-apiserver/oauth-apiserver

The goal is the reduction of the stabilization time of the Ingress and the
Authentication cluster operators.

Specifically, those rollouts are triggered by the difference in annotations on
the respective deployments. The latter include:

- a spec-hash (SHA256 of the deployment.spec) annotation
- multiple ConfigMap and Secret fnv32 hash annotations of objects that the
  respective cluster-operators are watching

In order to correctly compute the spec-hash annotations, we need to ensure that
whatever the respective cluster-operators compute the hash on, is what we use as
well. Because the operators include a mix of YAML and Go code for the specs they
compute the spec-hash on, we do the same with a hack script written in Go.
The latter:

- downloads the required deployment YAML manifests from the specific OCP
  release branch
- encodes them in JSON (mainly because JSON encoding between Go and Rust are
  quite different)
- adds some spec fields that can be hardcoded and leaves some templated spec
  fields to be filled in in Rust code (e.g. container image pull-specs,
  revisions, etc.).

The fnv32 hash annotations are also adjusted to follow the Go JSON encoding
implementation:

- secret data fields are lexicographically ordered
- when a field is a nil pointer it's encoded as the 'null'
  JSON type

Signed-off-by: Michail Resvanis <[email protected]>
We had a too strict condition, see diff comment

Prevents the follow error:

```
Caused by:
    0: performing ocp specific post-processing
    1: renaming proxy
    2: renaming all
    3: renaming etcd resources
    4: fixing storages
    5: no "/kubernetes.io/operator.openshift.io/storages/cluster"
: exit status 1
```
# Background

The `cluster-config-v1` configmaps contain a copy of
`install-config.yaml` that was used for installation. In that
install-config, one of the fields is the machine-network CIDR.

The cluster-network-operator reads the machine-network field from the
`cluster-config-v1` configmaps while it tries to determine the final
value for `noProxy`, so that means we must ensure those configmaps have
the current machine network value.

# Current support

Currently recert supports replacing the entire install-config in those
configmaps. This is good for IBU, where we already have a cluster we can
take the entire install-config from.

# Issue

In IBI, we would have to fake such install-config for the fresh cluster.
This is inconvenient.

# Solution

Add a new `--machine-network-cidr` rename option to recert, which would
replace just the machine-network-cidr in the existing (seed)
install-config, rather than forcing the user to supply the entire
machine-config.
MGMT-16777: Compute the hash annotations for  {openshift,oauth}-apiserver
Support proxy change in clusters without storage
Add support for machine-network-cidr rename
OCPBUGS-32514: Fix recert failing because of non-existent managedFields
@openshift-ci openshift-ci bot requested a review from mresvanis April 25, 2024 15:53
Copy link

openshift-ci bot commented Apr 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: omertuc

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

@omertuc omertuc merged commit 6eb1632 into v0 Apr 25, 2024
1 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants