mirror of
https://github.com/rancher/rke.git
synced 2025-09-01 23:16:22 +00:00
Initial commit for adding ecr credential plugin
This commit is contained in:
committed by
Gaurav Mehta
parent
b8e94c98f8
commit
723dd7c670
@@ -54,6 +54,11 @@ func (c *Cluster) ValidateCluster(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// validate registry credential plugin
|
||||
if err := validateRegistryAuthPlugin(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// validate services options
|
||||
return validateServicesOptions(c)
|
||||
}
|
||||
@@ -605,3 +610,19 @@ func validateCRIDockerdOption(c *Cluster) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateRegistryAuthPlugin(c *Cluster) error {
|
||||
for _, pr := range c.PrivateRegistriesMap {
|
||||
if len(pr.CredentialPlugin) != 0 {
|
||||
if credPluginType, ok := pr.CredentialPlugin["type"]; ok {
|
||||
switch credPluginType {
|
||||
case "ecr":
|
||||
logrus.Debugf("Plugin type %s is valid", credPluginType)
|
||||
default:
|
||||
return fmt.Errorf("invalid registry plugin helper provided for %s", pr.URL)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user