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

Adressing proxy promotion issues #773

Merged
merged 2 commits into from
Jul 29, 2022
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: 2 additions & 0 deletions controllers/capabilities/proxyconfigpromote_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ func (r *ProxyConfigPromoteReconciler) proxyConfigPromoteReconciler(proxyConfigP
if err != nil {
statusReconciler := NewProxyConfigPromoteStatusReconciler(r.BaseReconciler, proxyConfigPromote, "Failed", productIDStr, latestProductionVersion, latestStagingVersion, err)
return statusReconciler, err
} else {
Copy link
Member

Choose a reason for hiding this comment

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

this "spaghetti code" is calling for a refactor :)

Copy link
Member

Choose a reason for hiding this comment

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

not to be done in this PR, though

latestProductionVersion = latestStagingVersion
}

}
Expand Down
53 changes: 40 additions & 13 deletions doc/proxyConfigPromote-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,59 @@
* [ProxyConfigPromoteSpec](#proxyconfigpromotespec)
* [Provider Account Reference](#provider-account-reference)
* [ProxyConfigPromoteStatus](#proxyconfigpromotestatus)
* [ConditionSpec](#conditionspec)


Generated using [github-markdown-toc](https://github.com/ekalinin/github-markdown-toc)

## ProxyConfigPromote

| **Field** | **json field**| **Type** | **Info** |
| --- | --- |---------------------------------------------------| --- |
| **Field** | **json field**| **Type** | **Info** |
| --- | --- | --- | --- |
| Spec | `spec` | [ProxyConfigPromoteSpec](#ProxyConfigPromoteSpec) | The specfication for the custom resource |
| Status | `status` | [ProxyConfigPromoteStatus](#ProxyConfigPromoteStatus) | The status for the custom resource |
| Status | `status` | [ProxyConfigPromoteStatus](#ProxyConfigPromoteStatus) | The status for the custom resource |

### ProxyConfigPromoteSpec

| **Field** | **json field** | **Type** | **Info** | **Required** |
|----------------------------|----------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|
| ProductCRName | `productCRName` | string | Name of product Cr | Yes |
| Production | `production` | bool | If true promotes to production, if false promotes to staging | No |
| DeleteCR | `deleteCR` | bool | If true deletes the resource after a succesfull promotion | No | | No |
| **Field** | **json field**| **Type** | **Info** | **Required** |
| --- | --- | --- | --- | --- |
| ProductCRName | `productCRName` | string | Name of product Cr| Yes |
| Production | `production` | bool | If true promotes to production, if false promotes to staging | No |
| DeleteCR | `deleteCR` | bool | If true deletes the resource after a succesfull promotion | No |
| Provider Account Reference | `providerAccountRef` | object | [Provider account credentials secret reference](#provider-account-reference) | No |

#### Provider Account Reference
Copy link
Member

Choose a reason for hiding this comment

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

there is no provider account reference in the spec.

To be consistent with other CRDs, there should be one. Have a look at the product, backend CRDs types.

Regarding the doc you can just "copy&paste" the documentation here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good spot, added it in. Thanks.


Provider account credentials secret referenced by a [v1.LocalObjectReference](https://v1-15.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.15/#localobjectreference-v1-core) type object.

The secret must have `adminURL` and `token` fields with tenant credentials.
Tenant controller will fetch the secret and read the following fields:

| **Field** | **Description** | **Required** |
| --- | --- | --- |
| *token* | Provider account access token with *Account Management API* scope and *Read & Write* permission | Yes |
| *adminURL* | Provider account's domain URL | Yes |

For example:

```
apiVersion: v1
kind: Secret
metadata:
name: mytenant
type: Opaque
stringData:
adminURL: https://my3scale-admin.example.com:443
token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
```

### ProxyConfigPromoteStatus

| **Field** | **json field** | **Type** | **Info** |
|---------------------|----------------------| --- |-----------------------------------------------------------------------------|
| ProductId | `productId` | string | Internal ID of promted product |
| LatestProductionVersion | `latestProductionVersion` | string | int with the current version in the production environment |
| LatestStagingVersion | `latestStagingVersion` | string | int with the current version in the staging environment |
| **Field** | **json field** | **Type** | **Info** |
| --- | --- | --- | --- |
| ProductId | `productId` | string | Internal ID of promted product |
| LatestProductionVersion | `latestProductionVersion` | string | int with the current version in the production environment |
| LatestStagingVersion | `latestStagingVersion` | string | int with the current version in the staging environment |
| Conditions | `conditions` | array of [conditions](#ConditionSpec) | resource conditions |

For example:
Expand Down