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

OCM-5942 | feat: allow users set delete protection on cluster #1877

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

ciaranRoche
Copy link
Member

@ciaranRoche ciaranRoche commented Mar 27, 2024

This change allows a user to edit delete protection on clusters, and adds the delete protection to the describe output.

This change lacks tests due to the size of the refactors needed to make this easy to test. Happy to follow up with refactors after

JIRA - https://issues.redhat.com/browse/OCM-5942

Validation

╭─croche@fedora ~/Work/ocm/rosa ‹OCM-5942› 
╰─$ rosa describe cluster -c croche                             

Name:                       croche
Domain Prefix:              croche
Display Name:               croche
ID:                         2a874cc5sm2o72h5h9fdq8ciafr0h8tq
External ID:                790b1651-7566-4e32-8c2f-f290592b6665
Control Plane:              Customer Hosted
OpenShift Version:          4.14.12
Channel Group:              stable
DNS:                        croche.hgnf.s1.devshift.org
AWS Account:                765374464689
API URL:                    https://api.croche.hgnf.s1.devshift.org:6443
Console URL:                https://console-openshift-console.apps.croche.hgnf.s1.devshift.org
Region:                     eu-west-1
Multi-AZ:                   false

Nodes:
 - Control plane:           3
 - Infra:                   2
 - Compute:                 2
Network:
 - Type:                    OVNKubernetes
 - Service CIDR:            172.30.0.0/16
 - Machine CIDR:            10.0.0.0/16
 - Pod CIDR:                10.128.0.0/14
 - Host Prefix:             /23
Infra ID:                   croche-hrj2f
EC2 Metadata Http Tokens:   optional
Role (STS) ARN:             arn:aws:iam::765374464689:role/cro-Installer-Role
Support Role ARN:           arn:aws:iam::765374464689:role/cro-Support-Role
Instance IAM Roles:
 - Control plane:           arn:aws:iam::765374464689:role/cro-ControlPlane-Role
 - Worker:                  arn:aws:iam::765374464689:role/cro-Worker-Role
Operator IAM Roles:
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-machine-api-aws-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cloud-credential-operator-cloud-credential
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-image-registry-installer-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-ingress-operator-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cluster-csi-drivers-ebs-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cloud-network-config-controller-cloud-cred
Managed Policies:           No
State:                      ready 
Private:                    No
Delete Protection:          Disabled
Created:                    Mar 26 2024 12:31:49 UTC
User Workload Monitoring:   Enabled
Details Page:               https://qaprodauth.console.redhat.com/openshift/details/s/2eE4Gnq0uM1pfqPqAh24lI9gjdk
OIDC Endpoint URL:          https://oidc.os1.devshift.org/2a874cc5sm2o72h5h9fdq8ciafr0h8tq (Classic)

╭─croche@fedora ~/Work/ocm/rosa ‹OCM-5942› 
╰─$ rosa edit cluster -c croche --enable-delete-protection=true 
I: Interactive mode enabled.
Any optional fields can be ignored and will not be updated.
? Private cluster, check this command's help for possible impacts: No
? Disable Workload monitoring: No
? Enable cluster deletion protection: Yes
I: Updated cluster 'croche'
╭─croche@fedora ~/Work/ocm/rosa ‹OCM-5942› 
╰─$ rosa describe cluster -c croche

Name:                       croche
Domain Prefix:              croche
Display Name:               croche
ID:                         2a874cc5sm2o72h5h9fdq8ciafr0h8tq
External ID:                790b1651-7566-4e32-8c2f-f290592b6665
Control Plane:              Customer Hosted
OpenShift Version:          4.14.12
Channel Group:              stable
DNS:                        croche.hgnf.s1.devshift.org
AWS Account:                765374464689
API URL:                    https://api.croche.hgnf.s1.devshift.org:6443
Console URL:                https://console-openshift-console.apps.croche.hgnf.s1.devshift.org
Region:                     eu-west-1
Multi-AZ:                   false

Nodes:
 - Control plane:           3
 - Infra:                   2
 - Compute:                 2
Network:
 - Type:                    OVNKubernetes
 - Service CIDR:            172.30.0.0/16
 - Machine CIDR:            10.0.0.0/16
 - Pod CIDR:                10.128.0.0/14
 - Host Prefix:             /23
Infra ID:                   croche-hrj2f
EC2 Metadata Http Tokens:   optional
Role (STS) ARN:             arn:aws:iam::765374464689:role/cro-Installer-Role
Support Role ARN:           arn:aws:iam::765374464689:role/cro-Support-Role
Instance IAM Roles:
 - Control plane:           arn:aws:iam::765374464689:role/cro-ControlPlane-Role
 - Worker:                  arn:aws:iam::765374464689:role/cro-Worker-Role
Operator IAM Roles:
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-machine-api-aws-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cloud-credential-operator-cloud-credential
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-image-registry-installer-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-ingress-operator-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cluster-csi-drivers-ebs-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cloud-network-config-controller-cloud-cred
Managed Policies:           No
State:                      ready 
Private:                    No
Delete Protection:          Enabled
Created:                    Mar 26 2024 12:31:49 UTC
User Workload Monitoring:   Enabled
Details Page:               https://qaprodauth.console.redhat.com/openshift/details/s/2eE4Gnq0uM1pfqPqAh24lI9gjdk
OIDC Endpoint URL:          https://oidc.os1.devshift.org/2a874cc5sm2o72h5h9fdq8ciafr0h8tq (Classic)

╭─croche@fedora ~/Work/ocm/rosa ‹OCM-5942› 
╰─$ rosa edit cluster -c croche                                 
I: Interactive mode enabled.
Any optional fields can be ignored and will not be updated.
? Private cluster, check this command's help for possible impacts: No
? Disable Workload monitoring: No
? Enable cluster deletion protection: No
I: Updated cluster 'croche'
╭─croche@fedora ~/Work/ocm/rosa ‹OCM-5942› 
╰─$ rosa describe cluster -c croche

Name:                       croche
Domain Prefix:              croche
Display Name:               croche
ID:                         2a874cc5sm2o72h5h9fdq8ciafr0h8tq
External ID:                790b1651-7566-4e32-8c2f-f290592b6665
Control Plane:              Customer Hosted
OpenShift Version:          4.14.12
Channel Group:              stable
DNS:                        croche.hgnf.s1.devshift.org
AWS Account:                765374464689
API URL:                    https://api.croche.hgnf.s1.devshift.org:6443
Console URL:                https://console-openshift-console.apps.croche.hgnf.s1.devshift.org
Region:                     eu-west-1
Multi-AZ:                   false

Nodes:
 - Control plane:           3
 - Infra:                   2
 - Compute:                 2
Network:
 - Type:                    OVNKubernetes
 - Service CIDR:            172.30.0.0/16
 - Machine CIDR:            10.0.0.0/16
 - Pod CIDR:                10.128.0.0/14
 - Host Prefix:             /23
Infra ID:                   croche-hrj2f
EC2 Metadata Http Tokens:   optional
Role (STS) ARN:             arn:aws:iam::765374464689:role/cro-Installer-Role
Support Role ARN:           arn:aws:iam::765374464689:role/cro-Support-Role
Instance IAM Roles:
 - Control plane:           arn:aws:iam::765374464689:role/cro-ControlPlane-Role
 - Worker:                  arn:aws:iam::765374464689:role/cro-Worker-Role
Operator IAM Roles:
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-machine-api-aws-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cloud-credential-operator-cloud-credential
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-image-registry-installer-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-ingress-operator-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cluster-csi-drivers-ebs-cloud-credentials
 - arn:aws:iam::765374464689:role/croche-l5l6-openshift-cloud-network-config-controller-cloud-cred
Managed Policies:           No
State:                      ready 
Private:                    No
Delete Protection:          Disabled
Created:                    Mar 26 2024 12:31:49 UTC
User Workload Monitoring:   Enabled
Details Page:               https://qaprodauth.console.redhat.com/openshift/details/s/2eE4Gnq0uM1pfqPqAh24lI9gjdk
OIDC Endpoint URL:          https://oidc.os1.devshift.org/2a874cc5sm2o72h5h9fdq8ciafr0h8tq (Classic)

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 27, 2024
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 9.67742% with 56 lines in your changes are missing coverage. Please review.

Project coverage is 21.86%. Comparing base (ec4e4a0) to head (bdd6073).
Report is 2 commits behind head on master.

Files Patch % Lines
cmd/edit/cluster/cmd.go 14.63% 35 Missing ⚠️
cmd/describe/cluster/cmd.go 0.00% 11 Missing ⚠️
pkg/ocm/clusters.go 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1877      +/-   ##
==========================================
- Coverage   21.88%   21.86%   -0.02%     
==========================================
  Files         117      117              
  Lines       18935    18978      +43     
==========================================
+ Hits         4144     4150       +6     
- Misses      14477    14514      +37     
  Partials      314      314              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

cmd/edit/cluster/cmd.go Outdated Show resolved Hide resolved
@JustinXHale
Copy link

JustinXHale commented Mar 27, 2024

In the UI we're suggesting using Enable/Disable for the cluster details. Wondering if this will be better language in the cluster details portion instead of yes/no? The goal is for me is to align the language in both the UI and CLI

image

@ciaranRoche
Copy link
Member Author

@robpblake PTAL when you get a chance 🙏

@robpblake
Copy link
Contributor

/lgtm

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

openshift-ci bot commented Apr 3, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ciaranRoche, robpblake

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:
  • OWNERS [ciaranRoche,robpblake]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

openshift-ci bot commented Apr 3, 2024

@ciaranRoche: 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/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 260f864 into openshift:master Apr 3, 2024
9 checks passed
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. 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

4 participants