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

[redhat-3.10] configtool: Adding validation for IBM Cloud Storage (PROJQUAY-6549) #2581

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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<td colspan="2">
<span class="config-string-field" binding="config.REGISTRY_TITLE"></span>
<div class="help-text" style="margin-top: 10px;">
Name of registry to be displayed in the Contact Page.
Name of registry to be displayed in the Contact Page.
</div>
</td>
</tr>
Expand Down Expand Up @@ -72,7 +72,7 @@
is displayed.
</div>
</td>
</tr>
</tr>
</table>
</div>
</div>
Expand Down Expand Up @@ -215,7 +215,7 @@
</td>
</tr>
</table>
</div>
</div>
</div>


Expand Down Expand Up @@ -459,6 +459,7 @@
<option value="AzureStorage">Azure Blob Storage</option>
<option value="GoogleCloudStorage">Google Cloud Storage</option>
<option value="RadosGWStorage">Ceph Object Gateway (RADOS)</option>
<option value="IBMCloudStorage">IBM Cloud Object Storage</option>
<option value="SwiftStorage">OpenStack Storage (Swift)</option>
<option value="CloudFrontedS3Storage">CloudFront + Amazon S3</option>
<option value="CloudFlareStorage">CloudFlare + Amazon S3</option>
Expand Down Expand Up @@ -745,7 +746,7 @@
<tr>
<td>Security Scanner PSK:</td>
<td>
<span class="config-string-field" binding="config.SECURITY_SCANNER_V4_PSK"
<span class="config-string-field" binding="config.SECURITY_SCANNER_V4_PSK"
is-readonly="fieldGroupReadonly('SecurityScanner')" placeholder="Base64 Encoded PSK"></span>
<div class="help-text" style="margin-top: 10px;">
Clair Pre-Shared Key. Make sure to include this value in your Clair config.
Expand Down Expand Up @@ -1735,7 +1736,7 @@ <h4>Callback URLs for this service:</h4>
<span class="config-list-field" item-title="Super User"
binding="config.SUPER_USERS" item-pattern="[a-z0-9_]{4,30}"></span>
<div class="help-text">
Users included in this list will be given elevated access to Quay.
Users included in this list will be given elevated access to Quay.
</div>
</td>
</tr>
Expand Down Expand Up @@ -1995,14 +1996,14 @@ <h4 class="modal-title">
<span class="cor-loader-inline" ng-show="operatorCommitStatus == 'inProgress'"></span>
<span class="service-title">Committing to Operator</span>
</div>


<!-- Successful commit to operator -->
<div class="service-verification-row" ng-if="operatorCommitStatus == 'success'">
<i class="fa fa-lg fa-check-circle" ng-show="operatorCommitStatus == 'success'"></i>
<span class="service-title">Config Sent to Operator</span>
</div>

<!-- Error in Commit-->
<div class="service-verification-row" ng-if="operatorCommitStatus == 'error'">
<i class="fa fa-lg fa-warning" ng-show="operatorCommitStatus == 'error'"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ angular.module("quay-config")
{'name': 'storage_path', 'title': 'Storage Directory', 'placeholder': '/path/inside/bucket', 'kind': 'text'}
],

'IBMCloudStorage': [
{'name': 'hostname', 'title': 'IBM Cloud Storage Hostname', 'placeholder': 'storage hostname', 'kind': 'text'},
{'name': 'port', 'title': 'Custom Port (optional)', 'placeholder': '443', 'kind': 'text', 'pattern': '^[0-9]+$', 'optional': true},
{'name': 'is_secure', 'title': 'Is Secure', 'placeholder': 'Require SSL', 'kind': 'bool'},
{'name': 'access_key', 'title': 'Access Key', 'placeholder': 'accesskeyhere', 'kind': 'text'},
{'name': 'secret_key', 'title': 'Secret Key', 'placeholder': 'secretkeyhere', 'kind': 'text'},
{'name': 'bucket_name', 'title': 'Bucket Name', 'placeholder': 'my-cool-bucket', 'kind': 'text'},
{'name': 'storage_path', 'title': 'Storage Directory', 'placeholder': '/path/inside/bucket', 'kind': 'text'}
],

'SwiftStorage': [
{'name': 'auth_version', 'title': 'Swift Auth Version', 'kind': 'option', 'values': [1, 2, 3]},
{'name': 'auth_url', 'title': 'Swift Auth URL', 'placeholder': 'http://swiftdomain/auth/v1.0', 'kind': 'text'},
Expand Down Expand Up @@ -319,10 +329,10 @@ angular.module("quay-config")
delete $scope.config["DB_CONNECTION_ARGS"]["ssl"];
$scope.config["DB_CONNECTION_ARGS"]["sslrootcert"] = "conf/stack/database.pem";
$scope.config["DB_CONNECTION_ARGS"]["sslmode"] = "verify-full"
} else if
} else if
($scope.certs["database.pem"] && $scope.config["DB_URI"].startsWith("mysql")){
delete $scope.config["DB_CONNECTION_ARGS"]["sslrootcert"];
delete $scope.config["DB_CONNECTION_ARGS"]["sslmode"];
delete $scope.config["DB_CONNECTION_ARGS"]["sslmode"];
$scope.config["DB_CONNECTION_ARGS"]["ssl"] = {}
$scope.config["DB_CONNECTION_ARGS"]["ssl"]["ca"] = "conf/stack/database.pem";
}
Expand Down Expand Up @@ -365,7 +375,7 @@ angular.module("quay-config")
}

$scope.checkValidateAndSave = function() {

if ($scope.configform.$valid) {
saveStorageConfig();
$scope.validateAndSave();
Expand All @@ -375,7 +385,7 @@ angular.module("quay-config")
var query = $.find(".ng-invalid");

console.log(query)
if (query && query.length) {
if (query && query.length) {
query[1].scrollIntoView();
query[1].focus();
}
Expand Down Expand Up @@ -618,7 +628,7 @@ angular.module("quay-config")
$scope.mapped['database'] = {}
$scope.mapped['database'] = parseDbUri(getKey(config, "DB_URI"))
console.log($scope.mapped['database'])

};

var tlsSetter = function(value) {
Expand Down Expand Up @@ -693,7 +703,7 @@ angular.module("quay-config")
}

$scope.config['DB_URI'] = uri

};

var logsModelSelector = function(keyname) {
Expand Down Expand Up @@ -1104,7 +1114,7 @@ angular.module("quay-config")
}
}
$scope.$watch("certs", checkHasFile, true);

$scope.onFileSelect = function(files) {
if (files.length < 1) {
$scope.hasFile = false;
Expand Down Expand Up @@ -1146,9 +1156,9 @@ angular.module("quay-config")
$scope.uploadProgress = null;
});
};



};

}
Expand Down Expand Up @@ -1395,7 +1405,7 @@ angular.module("quay-config")
};
return directiveDefinitionObject;
})

.directive('configStringField', function () {
var directiveDefinitionObject = {
priority: 0,
Expand Down Expand Up @@ -1542,7 +1552,7 @@ angular.module("quay-config")
const c = new X509();
c.readCertPEM(atob(contents));
const current = new Date();
// This function returns a bad string, so we have to do some extra formatting to normalize it.
// This function returns a bad string, so we have to do some extra formatting to normalize it.
let originalDateString = "20"+c.getNotAfter()
let formattedDateString = originalDateString.replace(
/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/,
Expand Down Expand Up @@ -1585,7 +1595,7 @@ angular.module("quay-config")
cn.push(attr.value)
}
})
return cn
return cn
}

$scope.deleteCert = function (certPath) {
Expand Down
2 changes: 1 addition & 1 deletion config-tool/pkg/lib/shared/storage_validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func ValidateStorage(opts Options, storageName string, storageType string, args
switch storageType {
case "LocalStorage":
return true, []ValidationError{}
case "RHOCSStorage", "RadosGWStorage":
case "RHOCSStorage", "RadosGWStorage", "IBMCloudStorage":

// Check access key
if ok, err := ValidateRequiredString(args.AccessKey, "DISTRIBUTED_STORAGE_CONFIG."+storageName+".access_key", fgName); !ok {
Expand Down
8 changes: 4 additions & 4 deletions config-tool/pkg/lib/shared/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (ve ValidationError) String() string {

// DistributedStorageArgs
type DistributedStorageArgs struct {
// Args for RHOCSStorage, RadosGWStorage
// Args for RHOCSStorage, RadosGWStorage, IBMCloudStorage
Hostname string `default:"" validate:"" json:"hostname,omitempty" yaml:"hostname,omitempty"`
Port int `default:"" validate:"" json:"port,omitempty" yaml:"port,omitempty"`
IsSecure bool `default:"" validate:"" json:"is_secure" yaml:"is_secure"`
Expand Down Expand Up @@ -53,7 +53,7 @@ type DistributedStorageArgs struct {
// Args for CloudFlare
CloudflareDomain string `default:"" validate:"" json:"cloudflare_domain,omitempty" yaml:"cloudflare_domain,omitempty"`
// Args for MultiCDNStorage
DefaultProvider string `default:"" validate:"" json:"default_provider,omitempty" yaml:"default_provider,omitempty"`
Providers map[string]interface{} `default:"" validate:"" json:"providers,omitempty" yaml:"providers,omitempty"`
StorageConfig map[string]interface{} `default:"" validate:"" json:"storage_config,omitempty" yaml:"storage_config,omitempty"`
DefaultProvider string `default:"" validate:"" json:"default_provider,omitempty" yaml:"default_provider,omitempty"`
Providers map[string]interface{} `default:"" validate:"" json:"providers,omitempty" yaml:"providers,omitempty"`
StorageConfig map[string]interface{} `default:"" validate:"" json:"storage_config,omitempty" yaml:"storage_config,omitempty"`
}