Skip to content

Commit

Permalink
Merge pull request #629 from ciaranRoche/SDA-6369
Browse files Browse the repository at this point in the history
add addons mgmt to model
  • Loading branch information
renan-campos authored Oct 24, 2022
2 parents c763055 + 20e6acc commit 7475f34
Show file tree
Hide file tree
Showing 21 changed files with 825 additions and 0 deletions.
25 changes: 25 additions & 0 deletions model/addons_mgmt/v1/addon_config_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of an addon config.
// The attributes under it are to be used by the addon once its installed in the cluster.
struct AddonConfig {
// List of environment variables for the addon
EnvironmentVariables []AddonEnvironmentVariable

// List of secret propagations for the addon
SecretPropagations []AddonSecretPropagation
}
30 changes: 30 additions & 0 deletions model/addons_mgmt/v1/addon_credential_request_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Contains the necessary attributes to allow each operator to access the necessary AWS resources
struct CredentialRequest {
// Name of the credentials secret used to access cloud resources
Name String

// Namespace where the credentials secret lives in the cluster
Namespace String

// Service account name to use when authenticating
ServiceAccount String

// List of policy permissions needed to access cloud resources
PolicyPermissions []String
}
27 changes: 27 additions & 0 deletions model/addons_mgmt/v1/addon_environment_variable_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of an addon env object.
struct AddonEnvironmentVariable {
// Name of the env object.
Name String

// Value of the env object.
Value String

// Indicates is this environment variable is enabled for the addon
Enabled Boolean
}
26 changes: 26 additions & 0 deletions model/addons_mgmt/v1/addon_install_mode_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of an addon InstallMode field.
enum AddonInstallMode {
// This mode means that the the addon CRD exists in a single specific namespace.
// This namespace is reflected by the TargetNamespace addon field
OwnNamespace

// This mode means that the addon is deployed in all namespaces.
// However, the addon status is retrieved from the target namespace
AllNamespaces
}
30 changes: 30 additions & 0 deletions model/addons_mgmt/v1/addon_namespace_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of an addon namespace object.
struct AddonNamespace {
// Name of the namespace
Name String

// Enabled shows if this namespace object is in use
Enabled Boolean

// Labels to be included in the addon namespace
Labels [String]String

// Annotations to be included in the addon namespace
Annotations [String]String
}
30 changes: 30 additions & 0 deletions model/addons_mgmt/v1/addon_parameter_option_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of an addon parameter option.
struct AddonParameterOption {
// Name of the addon parameter option.
Name String

// Value of the addon parameter option.
Value String

// Rank of option to be used in cases where editable direction should be restricted.
Rank Integer

// List of addon requirements for this parameter option.
Requirements []AddonRequirement
}
58 changes: 58 additions & 0 deletions model/addons_mgmt/v1/addon_parameter_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of an addon parameter.
struct AddonParameter {
// ID for this addon parameter
ID String

// Name of the addon parameter.
Name String

// Description of the addon parameter.
Description String

// Type of value of the addon parameter.
ValueType AddonParameterValueType

// Validation rule for the addon parameter.
Validation String

// Error message to return should the parameter be invalid.
ValidationErrMsg String

// Indicates if this parameter is required by the addon.
Required Boolean

// Indicates if this parameter can be edited after creation.
Editable Boolean

// Restricts if the parameter can be upscaled/downscaled
// Expected values are "up", "down", or "" (no restriction).
EditableDirection String

// Indicates if this parameter is enabled for the addon.
Enabled Boolean

// Indicates the value default for the addon parameter.
DefaultValue String

// List of options for the addon parameter value.
Options []AddonParameterOption

// Conditions in which this parameter is valid for
Conditions []AddonRequirement
}
36 changes: 36 additions & 0 deletions model/addons_mgmt/v1/addon_parameter_value_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of the value type for this specific addon parameter
enum AddonParameterValueType {
// This value type must be a valid string
String

// This value type must be a valid boolean
Boolean

// This value type must be a valid number, this includes integer and float type numbers
Number

// This value type enforces a valid CIDR value to be passed as parameter value
CIDR

// This value must match a valid SKU resource in OCM
Resource

// This value must match a valid SKU resource in OCM and allows for validation of SKU resource in OCM
ResourceRequirement
}
28 changes: 28 additions & 0 deletions model/addons_mgmt/v1/addon_requirement_resource_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Addon requirement resource type
enum AddonRequirementResource {
// This requirement resource data will be validated and checked against cluster resources
Cluster

// This requirement resource data will be validated and checked against machine pool resources
@json(name = "machine_pool")
MachinePool

// This requirement resource data will be validated and checked against addon installation resources
Addon
}
24 changes: 24 additions & 0 deletions model/addons_mgmt/v1/addon_requirement_status_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of an addon requirement status.
struct AddonRequirementStatus {
// Indicates if this requirement is fulfilled.
Fulfilled Boolean

// Error messages detailing reasons for unfulfilled requirements.
ErrorMsgs []String
}
33 changes: 33 additions & 0 deletions model/addons_mgmt/v1/addon_requirement_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Representation of an addon requirement.
struct AddonRequirement {
// ID of the addon requirement.
ID String

// Type of resource of the addon requirement.
Resource AddonRequirementResource

// Data for the addon requirement.
Data [String]Interface

// Indicates if this requirement is enabled for the addon.
Enabled Boolean

// Optional cluster specific status for the addon.
Status AddonRequirementStatus
}
41 changes: 41 additions & 0 deletions model/addons_mgmt/v1/addon_resource.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright (c) 2022 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Manages a specific addon.
resource Addon {
// Retrieves the details of the addon.
method Get {
out Body Addon
}

// Updates the addon.
method Update {
// DryRun indicates the request body will not be persisted when dryRun=true.
@json(name = "dryRun")
in DryRun Boolean

in out Body Addon
}

// Deletes the addon.
method Delete {
}

// Reference to the resource that manages the collection of addon versions.
locator Versions {
target AddonVersions
}
}
Loading

0 comments on commit 7475f34

Please sign in to comment.