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

Bug 1884691: types: allow manual cred mode for gcp and azure #4238

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/data/install.openshift.io_installconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ spec:
- platform
type: object
credentialsMode:
description: "CredentialsMode is used to explicitly set the mode with which CredentialRequests are satisfied. \n If this field is set, then the installer will not attempt to query the cloud permissions before attempting installation. If the field is not set or empty, then the installer will perform its normal verification that the credentials provided are sufficient to perform an installation. \n There are three possible values for this field, but the valid values are dependent upon the platform being used. \"Mint\": create new credentials with a subset of the overall permissions for each CredentialsRequest \"Passthrough\": copy the credentials with all of the overall permissions for each CredentialsRequest \"Manual\": CredentialsRequests must be handled manually by the user \n For each of the following platforms, the field can set to the specified values. For all other platforms, the field must not be set. AWS: \"Mint\", \"Passthrough\", \"Manual\" Azure: \"Mint\", \"Passthrough\" GCP: \"Mint\", \"Passthrough\""
description: "CredentialsMode is used to explicitly set the mode with which CredentialRequests are satisfied. \n If this field is set, then the installer will not attempt to query the cloud permissions before attempting installation. If the field is not set or empty, then the installer will perform its normal verification that the credentials provided are sufficient to perform an installation. \n There are three possible values for this field, but the valid values are dependent upon the platform being used. \"Mint\": create new credentials with a subset of the overall permissions for each CredentialsRequest \"Passthrough\": copy the credentials with all of the overall permissions for each CredentialsRequest \"Manual\": CredentialsRequests must be handled manually by the user \n For each of the following platforms, the field can set to the specified values. For all other platforms, the field must not be set. AWS: \"Mint\", \"Passthrough\", \"Manual\" Azure: \"Mint\", \"Passthrough\", \"Manual\" GCP: \"Mint\", \"Passthrough\", \"Manual\""
enum:
- ""
- Mint
Expand Down
2 changes: 1 addition & 1 deletion pkg/explain/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func Test_PrintFields(t *testing.T) {
CredentialsMode is used to explicitly set the mode with which CredentialRequests are satisfied.
If this field is set, then the installer will not attempt to query the cloud permissions before attempting installation. If the field is not set or empty, then the installer will perform its normal verification that the credentials provided are sufficient to perform an installation.
There are three possible values for this field, but the valid values are dependent upon the platform being used. "Mint": create new credentials with a subset of the overall permissions for each CredentialsRequest "Passthrough": copy the credentials with all of the overall permissions for each CredentialsRequest "Manual": CredentialsRequests must be handled manually by the user
For each of the following platforms, the field can set to the specified values. For all other platforms, the field must not be set. AWS: "Mint", "Passthrough", "Manual" Azure: "Mint", "Passthrough" GCP: "Mint", "Passthrough"
For each of the following platforms, the field can set to the specified values. For all other platforms, the field must not be set. AWS: "Mint", "Passthrough", "Manual" Azure: "Mint", "Passthrough", "Manual" GCP: "Mint", "Passthrough", "Manual"

fips <boolean>
Default: false
Expand Down
4 changes: 2 additions & 2 deletions pkg/types/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ type InstallConfig struct {
// For each of the following platforms, the field can set to the specified values. For all other platforms, the
// field must not be set.
// AWS: "Mint", "Passthrough", "Manual"
// Azure: "Mint", "Passthrough"
// GCP: "Mint", "Passthrough"
// Azure: "Mint", "Passthrough", "Manual"
// GCP: "Mint", "Passthrough", "Manual"
// +optional
CredentialsMode CredentialsMode `json:"credentialsMode,omitempty"`
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/types/validation/installconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,8 @@ func validateCloudCredentialsMode(mode types.CredentialsMode, fldPath *field.Pat
// for the platform. If a platform name is not in the map, then the credentials mode cannot be set for that platform.
validPlatformCredentialsModes := map[string][]types.CredentialsMode{
aws.Name: {types.MintCredentialsMode, types.PassthroughCredentialsMode, types.ManualCredentialsMode},
azure.Name: {types.MintCredentialsMode, types.PassthroughCredentialsMode},
gcp.Name: {types.MintCredentialsMode, types.PassthroughCredentialsMode},
azure.Name: {types.MintCredentialsMode, types.PassthroughCredentialsMode, types.ManualCredentialsMode},
gcp.Name: {types.MintCredentialsMode, types.PassthroughCredentialsMode, types.ManualCredentialsMode},
}
if validModes, ok := validPlatformCredentialsModes[platform]; ok {
validModesSet := sets.NewString()
Expand Down
10 changes: 0 additions & 10 deletions pkg/types/validation/installconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,16 +962,6 @@ func TestValidateInstallConfig(t *testing.T) {
return c
}(),
},
{
name: "unsupported manual cloud credentials mode",
installConfig: func() *types.InstallConfig {
c := validInstallConfig()
c.Platform = types.Platform{GCP: validGCPPlatform()}
c.CredentialsMode = types.ManualCredentialsMode
return c
}(),
expectedError: `^credentialsMode: Unsupported value: "Manual": supported values: "Mint", "Passthrough"$`,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this test stay if changed to a platform that isn't AWS, Azure, or GCP

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could, but it is already covered by the next test case below it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ack

{
name: "invalidly set cloud credentials mode",
installConfig: func() *types.InstallConfig {
Expand Down