Skip to content

Conversation

rausingh-rh
Copy link

This PR includes proposal to introduce a new API field in must-gather-operator spec for disabling upload of must-gather bundle.

Changes include:

  1. disableUpload: Field is added to MustGather CRD allowing users to collect must-gather data without uploading to Red Hat's SFTP server.
  2. caseID and caseManagementAccountSecretRef required only when upload enabled.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Sep 3, 2025

@rausingh-rh: This pull request references MG-86 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.21.0" version, but no target version was set.

In response to this:

This PR includes proposal to introduce a new API field in must-gather-operator spec for disabling upload of must-gather bundle.

Changes include:

  1. disableUpload: Field is added to MustGather CRD allowing users to collect must-gather data without uploading to Red Hat's SFTP server.
  2. caseID and caseManagementAccountSecretRef required only when upload enabled.

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 Sep 3, 2025
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 3, 2025
Copy link
Contributor

openshift-ci bot commented Sep 3, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Contributor

openshift-ci bot commented Sep 3, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign knobunc for approval. For more information see the Code Review Process.

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

@rausingh-rh rausingh-rh marked this pull request as ready for review September 3, 2025 12:25
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 3, 2025
@openshift-ci openshift-ci bot requested review from eparis and jmguzik September 3, 2025 12:27
Copy link
Contributor

openshift-ci bot commented Sep 3, 2025

@rausingh-rh: all tests passed!

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-sigs/prow repository. I understand the commands that are listed here.


### User Stories

* As a cluster admin, I want to collect must-gather data without automatically uploading it to Red Hat's case management system so I can review the data locally first.
Copy link
Contributor

@Prashanth684 Prashanth684 Sep 25, 2025

Choose a reason for hiding this comment

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

The disconnected case could also be a relevant use case where you don't have the ability to upload outside the airgapped env


* **Prerequisites**: Requires Kubernetes 1.25+ for CEL validation support (enabled by default)
* **API**: Add `DisableUpload` to `MustGatherSpec` with kubebuilder default marker and CEL validation rules.
* **Validation**: Use kubebuilder CEL validation (`+kubebuilder:validation:XValidation`) to enforce that `caseID` and `caseManagementAccountSecretRef` are mandatory when `disableUpload` is false or unset.
Copy link
Contributor

Choose a reason for hiding this comment

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

ah..ok..that makes sense..should have read this first :)

2. **Validation Fallback**: For clusters < Kubernetes 1.25 (without CEL support), should we implement controller-level validation as fallback?
- **Impact**: Ensures consistent behavior across all supported Kubernetes versions
- **Complexity**: Requires dual validation paths
- **Decision Needed**: Is this necessary given OpenShift's Kubernetes version requirements?
Copy link
Contributor

Choose a reason for hiding this comment

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

right. probably not.

@Prashanth684
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2025
// A flag to control whether the must-gather bundle should be uploaded to SFTP server.
// If set to true, the bundle will be collected but not uploaded.
// +kubebuilder:default:=false
DisableUpload bool `json:"disableUpload,omitempty"`
Copy link
Member

@swghosh swghosh Sep 29, 2025

Choose a reason for hiding this comment

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

@iamkirkbater suggested on the other EP, to use an API field like spec.uploadTarget. It sounds reasonable to add UnionDiscriminator type field that uploads only when set appropriately.

ref: https://github.com/openshift/api/blob/1517fca97fe327e076bcff90accb86d1f4e804ed/example/v1/types_stable.go#L69 of UnionDiscriminator

eg.



type MustGatherSpec struct {
    // ...

    // uploadTarget sets the target config for uploading the collected must-gather tar,
    // uploading is disabled if this field is unset
    // 
    // +optional
    UploadTarget *UploadTarget `json:"uploadTarget,omitempty"`

    // ...
}


// UploadType is a specific method for uploading to a target
// +kubebuilder:validation:Enum=SFTP
type UploadType string


// UploadTarget defines the configuration for uploading the must-gather tar ...
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'SFTP' ?  has(self.sftp) : !has(self.sftp)",message="sftp upload target config is required when upload type is SFTP, and forbidden otherwise"
// +union
type UploadTarget struct {
	// type defines the method used for uploading to a specific target
	// Available types are SFTP only.
	//
	// +unionDiscriminator
	// +required
	Type UploadType `json:"type"`

	// sftp defines the target details for uploading to a valid
        // SFTP server.
	//
	// +unionMember
	// +optional
	SFTP *SFTPUploadTargetConfig `json:"sftp,omitempty"`
}

// SFTPUploadTargetConfig defines the ...
type SFTPUploadTargetConfig struct {
	// caseID specifies the ...
	//
	// +kubebuilder:validation:MaxLength=128
	// +kubebuilder:validation:MinLength=1
	// +required
	CaseID string `json:"caseId"`
	
	// uploadTokenSecretRef ...
	// +required
	UploadTokenSecretRef corev1.LocalObjectReference `json:".."`

	// sftpHost specifies ...
	// +kubebuilder:default:="sftp.access.redhat.com"
	// +optional
	SFTPHost string `json:"sftpHost"`
}

also 👀 @shivprakashmuley as this also might interfere with #1831.

Copy link
Contributor

@Prashanth684 Prashanth684 Oct 13, 2025

Choose a reason for hiding this comment

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

are we updating the spec here or is it rolled into #1830 ?

Copy link
Author

Choose a reason for hiding this comment

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

I will be closing this EP. Changes will be rolled into #1830

cc @swghosh @shivprakashmuley

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants