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

Release/2.8.0 #216

Merged
merged 4 commits into from
Sep 18, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [2.8.0] - 09-18-2023
### Changed
- Update the changes made for `2.7.0` below to include the deprecated sub-fields of the `cfs`
field in v1 session templates.
- Update the API spec to explicitly state which fields are automatically removed from v1 session
templates in this version of BOS.
- Remove the now-superfluous read-only `links` field from V1 session templates, since BOS no longer
ever returns session templates using that schema; the schema is now only used to validate session
templates being created by the user, and thus there is no purpose for read-only fields in it.
- Update the API spec to mark some v1-specific fields as deprecated that were not previously marked as
such (`partition`, `boot_ordinal`, `network`, and `shutdown_ordinal`). These fields already had no
effect and thus were effectively deprecated anyway.

## [2.7.0] - 09-12-2023
### Changed
- Removed non-v2 fields from v1 session template template
Expand Down
73 changes: 51 additions & 22 deletions api/openapi.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,11 @@ components:

It is recommended that this should be 1-1023 characters in length.

This restriction is not enforced in this version of BOS, but it is
targeted to start being enforced in an upcoming BOS version.
When upgrading to this version of BOS, all existing V1 session
templates will automatically have this deprecated field removed from them.

When a V1 session template is created, this deprecated field is
automatically removed from it before storing it in BOS.
V1CfsUrl:
type: string
deprecated: true
Expand All @@ -448,8 +451,11 @@ components:

It is recommended that this should be 1-4096 characters in length.

This restriction is not enforced in this version of BOS, but it is
targeted to start being enforced in an upcoming BOS version.
When upgrading to this version of BOS, all existing V1 session
templates will automatically have this deprecated field removed from them.

When a V1 session template is created, this deprecated field is
automatically removed from it before storing it in BOS.
V1CfsParameters:
type: object
description: |
Expand All @@ -470,8 +476,11 @@ components:
git commit hashes are hexadecimal strings with a length of 40 characters (although
fewer characters may be sufficient to uniquely identify a commit in some cases).

This restriction is not enforced in this version of BOS, but it is
targeted to start being enforced in an upcoming BOS version.
When upgrading to this version of BOS, all existing V1 session
templates will automatically have this deprecated field removed from them.

When a V1 session template is created, this deprecated field is
automatically removed from it before storing it in BOS.
playbook:
type: string
deprecated: true
Expand All @@ -481,8 +490,11 @@ components:

It is recommended that this should be 1-255 characters in length.

This restriction is not enforced in this version of BOS, but it is
targeted to start being enforced in an upcoming BOS version.
When upgrading to this version of BOS, all existing V1 session
templates will automatically have this deprecated field removed from them.

When a V1 session template is created, this deprecated field is
automatically removed from it before storing it in BOS.
configuration:
$ref: '#/components/schemas/CfsConfiguration'
additionalProperties: false
Expand Down Expand Up @@ -654,32 +666,47 @@ components:
$ref: '#/components/schemas/BootSetRootfsProviderPassthrough'
network:
type: string
deprecated: true
description: |
The network over which the node will boot.
Choices: NMN -- Node Management Network

When upgrading to this version of BOS, all existing V1 session
templates will automatically have this deprecated field removed from them.

When a V1 session template is created, this deprecated field is
automatically removed from it before storing it in BOS.
pattern: '^[nN][mM][nN]$'
boot_ordinal:
type: integer
deprecated: true
minimum: 0
description: |
The boot ordinal. This will establish the order for Boot Set operations.
Boot Sets boot in order from the lowest to highest boot_ordinal.

It is recommended that this should have a maximum value of 65535.

This restriction is not enforced in this version of BOS, but it is
targeted to start being enforced in an upcoming BOS version.
When upgrading to this version of BOS, all existing V1 session
templates will automatically have this deprecated field removed from them.

When a V1 session template is created, this deprecated field is
automatically removed from it before storing it in BOS.
shutdown_ordinal:
type: integer
deprecated: true
minimum: 0
description: |
The shutdown ordinal. This will establish the order for Boot Set
shutdown operations. Sets shutdown from low to high shutdown_ordinal.

It is recommended that this should have a maximum value of 65535.

This restriction is not enforced in this version of BOS, but it is
targeted to start being enforced in an upcoming BOS version.
When upgrading to this version of BOS, all existing V1 session
templates will automatically have this deprecated field removed from them.

When a V1 session template is created, this deprecated field is
automatically removed from it before storing it in BOS.
additionalProperties: false
required: [path, type]
V1SessionTemplateUuid:
Expand All @@ -693,9 +720,6 @@ components:
* 1-127 characters in length.
* Use only letters, digits, periods (.), dashes (-), and underscores (_).
* Begin and end with a letter or digit.

These restrictions are not enforced in this version of BOS, but they are
targeted to start being enforced in an upcoming BOS version.
minLength: 1
example: "my-session-template"
deprecated: true
Expand All @@ -707,6 +731,12 @@ components:
action (i.e. boot, configure, reboot, shutdown) will create a Kubernetes BOA job
to complete the required tasks for the operation.

When upgrading to this version of BOS, all existing V1 session templates
will automatically have all deprecated fields removed from them.

When a V1 session template is created, all deprecated fields are automatically
removed from it before storing it in BOS.

## Link Relationships

* self : The Session Template object
Expand All @@ -725,13 +755,17 @@ components:
$ref: '#/components/schemas/V1CfsParameters'
partition:
type: string
deprecated: true
description: |
The machine partition to operate on.

It is recommended that this should be 1-255 characters in length.

This restriction is not enforced in this version of BOS, but it is
targeted to start being enforced in an upcoming BOS version.
When upgrading to this version of BOS, all existing V1 session
templates will automatically have this deprecated field removed from them.

When a V1 session template is created, this deprecated field is
automatically removed from it before storing it in BOS.
boot_sets:
type: object
description: |
Expand All @@ -743,13 +777,8 @@ components:
* Boot Set names should be 1-127 characters in length.
* Boot Set names should use only letters, digits, periods (.), dashes (-), and underscores (_).
* Boot Set names should begin and end with a letter or digit.

These restrictions are not enforced in this version of BOS, but they are
targeted to start being enforced in an upcoming BOS version.
additionalProperties:
$ref: '#/components/schemas/V1BootSet'
links:
$ref: '#/components/schemas/LinkListReadOnly'
required: [name]
additionalProperties: false
V1BoaKubernetesJob:
Expand Down
22 changes: 20 additions & 2 deletions src/bos/server/controllers/v1/sessiontemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@
"configuration": "desired-cfs-config"},
"enable_cfs": True}

V1_SPECIFIC_ST_FIELDS = [ "cfs_url", "cfs_branch", "partition" ]
V1_SPECIFIC_BOOTSET_FIELDS = [ "network", "boot_ordinal", "shutdown_ordinal" ]
V1_SPECIFIC_ST_FIELDS = [ "cfs_branch", "cfs_url", "partition" ]
V1_SPECIFIC_CFS_FIELDS = [ "branch", "clone_url", "commit", "playbook" ]
V1_SPECIFIC_BOOTSET_FIELDS = [ "boot_ordinal", "network", "shutdown_ordinal" ]

def sanitize_xnames(st_json):
"""
Expand Down Expand Up @@ -85,10 +86,13 @@ def strip_v1_only_fields(template_data):
Returns False if nothing was removed.
"""
changes_made=False

# Strip out the v1-specific fields from the dictionary
for v1_field_name in V1_SPECIFIC_ST_FIELDS:
try:
del template_data[v1_field_name]
LOGGER.info("Stripped %s field from session template %s", v1_field_name,
template_data.get("name", ""))
changes_made=True
except KeyError:
pass
Expand All @@ -100,10 +104,24 @@ def strip_v1_only_fields(template_data):
for v1_bs_field_name in V1_SPECIFIC_BOOTSET_FIELDS:
try:
del bs[v1_bs_field_name]
LOGGER.info("Stripped %s field from a boot set in session template %s",
v1_bs_field_name, template_data.get("name", ""))
changes_made=True
except KeyError:
pass

# Do the same for the cfs field, if present
if "cfs" in template_data:
cfs_data = template_data["cfs"]
for v1_cfs_field_name in V1_SPECIFIC_CFS_FIELDS:
try:
del cfs_data[v1_cfs_field_name]
LOGGER.info("Stripped cfs.%s field from session template %s", v1_cfs_field_name,
template_data.get("name", ""))
changes_made=True
except KeyError:
pass

return changes_made

@no_v1_multi_tenancy_support
Expand Down