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

OCPBUGS-46488: Validate Encryption Keys for GCP #9328

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

barbacbd
Copy link
Contributor

** Validate install config information for GCP KMS Encryption keys.
** Update Vendor
** Add KMS Google Module

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Dec 18, 2024
@openshift-ci-robot
Copy link
Contributor

@barbacbd: This pull request references Jira Issue OCPBUGS-46488, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.19.0) matches configured target version for branch (4.19.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @jianli-wei

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

** Validate install config information for GCP KMS Encryption keys.
** Update Vendor
** Add KMS Google Module

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 openshift-ci bot requested a review from jianli-wei December 18, 2024 23:27
@barbacbd
Copy link
Contributor Author

/hold

Still figuring out if there is further validation/error checking.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 18, 2024
@jianli-wei
Copy link
Contributor

/jira-refresh

@jianli-wei
Copy link
Contributor

/jira refresh

@openshift-ci-robot
Copy link
Contributor

@jianli-wei: This pull request references Jira Issue OCPBUGS-46488, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.19.0) matches configured target version for branch (4.19.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @jianli-wei

In response to this:

/jira refresh

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.

@jianli-wei
Copy link
Contributor

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Dec 19, 2024
@barbacbd barbacbd force-pushed the OCPBUGS-46488 branch 2 times, most recently from c7faacb to 29e3029 Compare December 19, 2024 14:59
@barbacbd
Copy link
Contributor Author

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 19, 2024
@barbacbd
Copy link
Contributor Author

/retest-required

@barbacbd
Copy link
Contributor Author

barbacbd commented Jan 6, 2025

/label acknowledge-critical-fixes-only

@openshift-ci openshift-ci bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Jan 6, 2025
@@ -80,3 +84,45 @@ func ValidateDefaultDiskType(p *gcp.MachinePool, fldPath *field.Path) field.Erro

return allErrs
}

func ValidateKMSKey(platform *gcp.Platform, p *types.MachinePool, fldPath *field.Path) field.ErrorList {
Copy link
Contributor

Choose a reason for hiding this comment

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

This validation should go in the validation run by pkg/asset. pkg/types should include minimal external dependencies to allow easy importing by other packages. The pkg/asset validation is called here:

func Validate(client API, ic *types.InstallConfig) error {
allErrs := field.ErrorList{}
if err := validate.GCPClusterName(ic.ObjectMeta.Name); err != nil {
allErrs = append(allErrs, field.Invalid(field.NewPath("clusterName"), ic.ObjectMeta.Name, err.Error()))
}
allErrs = append(allErrs, validateProject(client, ic, field.NewPath("platform").Child("gcp"))...)
allErrs = append(allErrs, validateNetworkProject(client, ic, field.NewPath("platform").Child("gcp"))...)
allErrs = append(allErrs, validateRegion(client, ic, field.NewPath("platform").Child("gcp"))...)
allErrs = append(allErrs, validateZones(client, ic)...)
allErrs = append(allErrs, validateNetworks(client, ic, field.NewPath("platform").Child("gcp"))...)
allErrs = append(allErrs, validateInstanceTypes(client, ic)...)
allErrs = append(allErrs, ValidateCredentialMode(client, ic)...)
allErrs = append(allErrs, validatePreexistingServiceAccount(client, ic)...)
allErrs = append(allErrs, validateServiceAccountPresent(client, ic)...)
allErrs = append(allErrs, validateMarketplaceImages(client, ic)...)
if err := validateUserTags(client, ic.Platform.GCP.ProjectID, ic.Platform.GCP.UserTags); err != nil {
allErrs = append(allErrs, field.Invalid(field.NewPath("platform").Child("gcp").Child("userTags"), ic.Platform.GCP.UserTags, err.Error()))
}
return allErrs.ToAggregate()
}

Parent: fmt.Sprintf("projects/%s/locations/%s", project, location),
}

it := kmsClient.ListKeyRings(context.Background(), req)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use GetKeyRing to avoid the iterator and simplify this?

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 7, 2025
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 7, 2025
}
}

return allErrs
Copy link
Contributor

Choose a reason for hiding this comment

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

It appears that we are not returning an error when the key is not found in the keyring. (I see that qe did some pre-merge testing and it works for them. Not sure if it was against this iteration of the fix.)

@sadasu
Copy link
Contributor

sadasu commented Jan 8, 2025

/approve

Copy link
Contributor

openshift-ci bot commented Jan 8, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sadasu

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 Jan 8, 2025
@barbacbd barbacbd force-pushed the OCPBUGS-46488 branch 2 times, most recently from 7a48d62 to 7ead689 Compare January 9, 2025 12:45
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 10, 2025
** Validate install config information for GCP KMS Encryption keys.
** Add KMS package for GCP
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 13, 2025
Copy link
Contributor

openshift-ci bot commented Jan 13, 2025

@barbacbd: 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/e2e-aws-ovn-single-node 7cebbfa link false /test e2e-aws-ovn-single-node
ci/prow/e2e-gcp-ovn-byo-vpc 7cebbfa link false /test e2e-gcp-ovn-byo-vpc
ci/prow/e2e-aws-ovn-imdsv2 7cebbfa link false /test e2e-aws-ovn-imdsv2
ci/prow/okd-scos-e2e-aws-ovn 7cebbfa link false /test okd-scos-e2e-aws-ovn
ci/prow/e2e-aws-ovn-fips 7cebbfa link false /test e2e-aws-ovn-fips
ci/prow/e2e-gcp-default-config 7cebbfa link false /test e2e-gcp-default-config
ci/prow/e2e-vsphere-ovn-multi-network 7cebbfa link false /test e2e-vsphere-ovn-multi-network
ci/prow/e2e-aws-default-config 7cebbfa link false /test e2e-aws-default-config
ci/prow/e2e-aws-ovn-shared-vpc-edge-zones 7cebbfa link false /test e2e-aws-ovn-shared-vpc-edge-zones
ci/prow/e2e-aws-ovn-edge-zones-manifest-validation 7cebbfa link true /test e2e-aws-ovn-edge-zones-manifest-validation
ci/prow/e2e-azure-ovn-resourcegroup 7cebbfa link false /test e2e-azure-ovn-resourcegroup
ci/prow/e2e-vsphere-static-ovn 7cebbfa link false /test e2e-vsphere-static-ovn
ci/prow/e2e-aws-ovn-heterogeneous 7cebbfa link false /test e2e-aws-ovn-heterogeneous
ci/prow/e2e-gcp-secureboot 7cebbfa link false /test e2e-gcp-secureboot
ci/prow/images 7cebbfa link true /test images
ci/prow/e2e-gcp-ovn-xpn 7cebbfa link false /test e2e-gcp-ovn-xpn
ci/prow/e2e-aws-ovn-shared-vpc-custom-security-groups 7cebbfa link false /test e2e-aws-ovn-shared-vpc-custom-security-groups
ci/prow/e2e-aws-ovn 7cebbfa link true /test e2e-aws-ovn
ci/prow/e2e-aws-ovn-edge-zones 7cebbfa link false /test e2e-aws-ovn-edge-zones
ci/prow/e2e-gcp-ovn 7cebbfa link true /test e2e-gcp-ovn

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.

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/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants