From 93a9a8386eb82f8487f2853ea3b703f116360f16 Mon Sep 17 00:00:00 2001 From: chiragkyal Date: Wed, 15 Jan 2025 13:00:08 +0530 Subject: [PATCH 1/2] Update dns1123Subdomain validation message for machineNamePrefix Signed-off-by: chiragkyal --- machine/v1/types_controlplanemachineset.go | 7 ++++--- ...controlplanemachinesets-CustomNoUpgrade.crd.yaml | 13 ++++++++----- ...rolplanemachinesets-DevPreviewNoUpgrade.crd.yaml | 13 ++++++++----- ...olplanemachinesets-TechPreviewNoUpgrade.crd.yaml | 13 ++++++++----- .../CPMSMachineNamePrefix.yaml | 13 ++++++++----- machine/v1/zz_generated.swagger_doc_generated.go | 2 +- openapi/generated_openapi/zz_generated.openapi.go | 2 +- openapi/openapi.json | 2 +- ...controlplanemachinesets-CustomNoUpgrade.crd.yaml | 13 ++++++++----- ...rolplanemachinesets-DevPreviewNoUpgrade.crd.yaml | 13 ++++++++----- ...olplanemachinesets-TechPreviewNoUpgrade.crd.yaml | 13 ++++++++----- 11 files changed, 63 insertions(+), 41 deletions(-) diff --git a/machine/v1/types_controlplanemachineset.go b/machine/v1/types_controlplanemachineset.go index 12b6e5184f4..cc9c04ca279 100644 --- a/machine/v1/types_controlplanemachineset.go +++ b/machine/v1/types_controlplanemachineset.go @@ -46,13 +46,14 @@ type ControlPlaneMachineSetSpec struct { // Each machine name will consist of this prefix, followed by // a randomly generated string of 5 characters, and the index of the machine. // It must be a lowercase RFC 1123 subdomain, consisting of lowercase - // alphanumeric characters, '-', or '.', and must start and end - // with an alphanumeric character. + // alphanumeric characters, hyphens ('-'), and periods ('.'). + // Each block, separated by periods, must start and end with an alphanumeric character. + // Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. // The prefix must be between 1 and 245 characters in length. // For example, if machineNamePrefix is set to 'control-plane', // and three machines are created, their names might be: // control-plane-abcde-0, control-plane-fghij-1, control-plane-klmno-2 - // +openshift:validation:FeatureGateAwareXValidation:featureGate=CPMSMachineNamePrefix,rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character." + // +openshift:validation:FeatureGateAwareXValidation:featureGate=CPMSMachineNamePrefix,rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lowercase alphanumeric characters, hyphens ('-'), and periods ('.'). Each block, separated by periods, must start and end with an alphanumeric character. Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted." // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=245 // +openshift:enable:FeatureGate=CPMSMachineNamePrefix diff --git a/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-CustomNoUpgrade.crd.yaml b/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-CustomNoUpgrade.crd.yaml index 26b3b59f366..ce430732322 100644 --- a/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-CustomNoUpgrade.crd.yaml +++ b/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-CustomNoUpgrade.crd.yaml @@ -81,8 +81,9 @@ spec: Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase - alphanumeric characters, '-', or '.', and must start and end - with an alphanumeric character. + alphanumeric characters, hyphens ('-'), and periods ('.'). + Each block, separated by periods, must start and end with an alphanumeric character. + Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: @@ -91,9 +92,11 @@ spec: minLength: 1 type: string x-kubernetes-validations: - - message: a lowercase RFC 1123 subdomain must consist of lower case - alphanumeric characters, '-' or '.', and must start and end with - an alphanumeric character. + - message: a lowercase RFC 1123 subdomain must consist of lowercase + alphanumeric characters, hyphens ('-'), and periods ('.'). Each + block, separated by periods, must start and end with an alphanumeric + character. Hyphens are not allowed at the start or end of a block, + and consecutive periods are not permitted. rule: '!format.dns1123Subdomain().validate(self).hasValue()' replicas: default: 3 diff --git a/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml b/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml index 427635beaae..943f8d5c08d 100644 --- a/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml +++ b/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml @@ -81,8 +81,9 @@ spec: Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase - alphanumeric characters, '-', or '.', and must start and end - with an alphanumeric character. + alphanumeric characters, hyphens ('-'), and periods ('.'). + Each block, separated by periods, must start and end with an alphanumeric character. + Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: @@ -91,9 +92,11 @@ spec: minLength: 1 type: string x-kubernetes-validations: - - message: a lowercase RFC 1123 subdomain must consist of lower case - alphanumeric characters, '-' or '.', and must start and end with - an alphanumeric character. + - message: a lowercase RFC 1123 subdomain must consist of lowercase + alphanumeric characters, hyphens ('-'), and periods ('.'). Each + block, separated by periods, must start and end with an alphanumeric + character. Hyphens are not allowed at the start or end of a block, + and consecutive periods are not permitted. rule: '!format.dns1123Subdomain().validate(self).hasValue()' replicas: default: 3 diff --git a/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml b/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml index fd1d4ed47e9..a6f673d5683 100644 --- a/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml +++ b/machine/v1/zz_generated.crd-manifests/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml @@ -81,8 +81,9 @@ spec: Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase - alphanumeric characters, '-', or '.', and must start and end - with an alphanumeric character. + alphanumeric characters, hyphens ('-'), and periods ('.'). + Each block, separated by periods, must start and end with an alphanumeric character. + Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: @@ -91,9 +92,11 @@ spec: minLength: 1 type: string x-kubernetes-validations: - - message: a lowercase RFC 1123 subdomain must consist of lower case - alphanumeric characters, '-' or '.', and must start and end with - an alphanumeric character. + - message: a lowercase RFC 1123 subdomain must consist of lowercase + alphanumeric characters, hyphens ('-'), and periods ('.'). Each + block, separated by periods, must start and end with an alphanumeric + character. Hyphens are not allowed at the start or end of a block, + and consecutive periods are not permitted. rule: '!format.dns1123Subdomain().validate(self).hasValue()' replicas: default: 3 diff --git a/machine/v1/zz_generated.featuregated-crd-manifests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml b/machine/v1/zz_generated.featuregated-crd-manifests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml index d37da20bd46..21fedee8a39 100644 --- a/machine/v1/zz_generated.featuregated-crd-manifests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml +++ b/machine/v1/zz_generated.featuregated-crd-manifests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml @@ -83,8 +83,9 @@ spec: Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase - alphanumeric characters, '-', or '.', and must start and end - with an alphanumeric character. + alphanumeric characters, hyphens ('-'), and periods ('.'). + Each block, separated by periods, must start and end with an alphanumeric character. + Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: @@ -93,9 +94,11 @@ spec: minLength: 1 type: string x-kubernetes-validations: - - message: a lowercase RFC 1123 subdomain must consist of lower case - alphanumeric characters, '-' or '.', and must start and end with - an alphanumeric character. + - message: a lowercase RFC 1123 subdomain must consist of lowercase + alphanumeric characters, hyphens ('-'), and periods ('.'). Each + block, separated by periods, must start and end with an alphanumeric + character. Hyphens are not allowed at the start or end of a block, + and consecutive periods are not permitted. rule: '!format.dns1123Subdomain().validate(self).hasValue()' replicas: default: 3 diff --git a/machine/v1/zz_generated.swagger_doc_generated.go b/machine/v1/zz_generated.swagger_doc_generated.go index 4d96b3552ec..c0b8c4ce42a 100644 --- a/machine/v1/zz_generated.swagger_doc_generated.go +++ b/machine/v1/zz_generated.swagger_doc_generated.go @@ -188,7 +188,7 @@ func (ControlPlaneMachineSetList) SwaggerDoc() map[string]string { var map_ControlPlaneMachineSetSpec = map[string]string{ "": "ControlPlaneMachineSet represents the configuration of the ControlPlaneMachineSet.", - "machineNamePrefix": "machineNamePrefix is the prefix used when creating machine names. Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase alphanumeric characters, '-', or '.', and must start and end with an alphanumeric character. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: control-plane-abcde-0, control-plane-fghij-1, control-plane-klmno-2", + "machineNamePrefix": "machineNamePrefix is the prefix used when creating machine names. Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase alphanumeric characters, hyphens ('-'), and periods ('.'). Each block, separated by periods, must start and end with an alphanumeric character. Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: control-plane-abcde-0, control-plane-fghij-1, control-plane-klmno-2", "state": "state defines whether the ControlPlaneMachineSet is Active or Inactive. When Inactive, the ControlPlaneMachineSet will not take any action on the state of the Machines within the cluster. When Active, the ControlPlaneMachineSet will reconcile the Machines and will update the Machines as necessary. Once Active, a ControlPlaneMachineSet cannot be made Inactive. To prevent further action please remove the ControlPlaneMachineSet.", "replicas": "replicas defines how many Control Plane Machines should be created by this ControlPlaneMachineSet. This field is immutable and cannot be changed after cluster installation. The ControlPlaneMachineSet only operates with 3 or 5 node control planes, 3 and 5 are the only valid values for this field.", "strategy": "strategy defines how the ControlPlaneMachineSet will update Machines when it detects a change to the ProviderSpec.", diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index 8b3e977fb6a..a7a13e493dd 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -32774,7 +32774,7 @@ func schema_openshift_api_machine_v1_ControlPlaneMachineSetSpec(ref common.Refer Properties: map[string]spec.Schema{ "machineNamePrefix": { SchemaProps: spec.SchemaProps{ - Description: "machineNamePrefix is the prefix used when creating machine names. Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase alphanumeric characters, '-', or '.', and must start and end with an alphanumeric character. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: control-plane-abcde-0, control-plane-fghij-1, control-plane-klmno-2", + Description: "machineNamePrefix is the prefix used when creating machine names. Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase alphanumeric characters, hyphens ('-'), and periods ('.'). Each block, separated by periods, must start and end with an alphanumeric character. Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: control-plane-abcde-0, control-plane-fghij-1, control-plane-klmno-2", Type: []string{"string"}, Format: "", }, diff --git a/openapi/openapi.json b/openapi/openapi.json index 343dcd3b717..ea56188167c 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -18878,7 +18878,7 @@ ], "properties": { "machineNamePrefix": { - "description": "machineNamePrefix is the prefix used when creating machine names. Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase alphanumeric characters, '-', or '.', and must start and end with an alphanumeric character. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: control-plane-abcde-0, control-plane-fghij-1, control-plane-klmno-2", + "description": "machineNamePrefix is the prefix used when creating machine names. Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase alphanumeric characters, hyphens ('-'), and periods ('.'). Each block, separated by periods, must start and end with an alphanumeric character. Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: control-plane-abcde-0, control-plane-fghij-1, control-plane-klmno-2", "type": "string" }, "replicas": { diff --git a/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-CustomNoUpgrade.crd.yaml b/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-CustomNoUpgrade.crd.yaml index 26b3b59f366..ce430732322 100644 --- a/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-CustomNoUpgrade.crd.yaml +++ b/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-CustomNoUpgrade.crd.yaml @@ -81,8 +81,9 @@ spec: Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase - alphanumeric characters, '-', or '.', and must start and end - with an alphanumeric character. + alphanumeric characters, hyphens ('-'), and periods ('.'). + Each block, separated by periods, must start and end with an alphanumeric character. + Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: @@ -91,9 +92,11 @@ spec: minLength: 1 type: string x-kubernetes-validations: - - message: a lowercase RFC 1123 subdomain must consist of lower case - alphanumeric characters, '-' or '.', and must start and end with - an alphanumeric character. + - message: a lowercase RFC 1123 subdomain must consist of lowercase + alphanumeric characters, hyphens ('-'), and periods ('.'). Each + block, separated by periods, must start and end with an alphanumeric + character. Hyphens are not allowed at the start or end of a block, + and consecutive periods are not permitted. rule: '!format.dns1123Subdomain().validate(self).hasValue()' replicas: default: 3 diff --git a/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml b/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml index 427635beaae..943f8d5c08d 100644 --- a/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml +++ b/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-DevPreviewNoUpgrade.crd.yaml @@ -81,8 +81,9 @@ spec: Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase - alphanumeric characters, '-', or '.', and must start and end - with an alphanumeric character. + alphanumeric characters, hyphens ('-'), and periods ('.'). + Each block, separated by periods, must start and end with an alphanumeric character. + Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: @@ -91,9 +92,11 @@ spec: minLength: 1 type: string x-kubernetes-validations: - - message: a lowercase RFC 1123 subdomain must consist of lower case - alphanumeric characters, '-' or '.', and must start and end with - an alphanumeric character. + - message: a lowercase RFC 1123 subdomain must consist of lowercase + alphanumeric characters, hyphens ('-'), and periods ('.'). Each + block, separated by periods, must start and end with an alphanumeric + character. Hyphens are not allowed at the start or end of a block, + and consecutive periods are not permitted. rule: '!format.dns1123Subdomain().validate(self).hasValue()' replicas: default: 3 diff --git a/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml b/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml index fd1d4ed47e9..a6f673d5683 100644 --- a/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml +++ b/payload-manifests/crds/0000_10_control-plane-machine-set_01_controlplanemachinesets-TechPreviewNoUpgrade.crd.yaml @@ -81,8 +81,9 @@ spec: Each machine name will consist of this prefix, followed by a randomly generated string of 5 characters, and the index of the machine. It must be a lowercase RFC 1123 subdomain, consisting of lowercase - alphanumeric characters, '-', or '.', and must start and end - with an alphanumeric character. + alphanumeric characters, hyphens ('-'), and periods ('.'). + Each block, separated by periods, must start and end with an alphanumeric character. + Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. The prefix must be between 1 and 245 characters in length. For example, if machineNamePrefix is set to 'control-plane', and three machines are created, their names might be: @@ -91,9 +92,11 @@ spec: minLength: 1 type: string x-kubernetes-validations: - - message: a lowercase RFC 1123 subdomain must consist of lower case - alphanumeric characters, '-' or '.', and must start and end with - an alphanumeric character. + - message: a lowercase RFC 1123 subdomain must consist of lowercase + alphanumeric characters, hyphens ('-'), and periods ('.'). Each + block, separated by periods, must start and end with an alphanumeric + character. Hyphens are not allowed at the start or end of a block, + and consecutive periods are not permitted. rule: '!format.dns1123Subdomain().validate(self).hasValue()' replicas: default: 3 From 601c52cd4d19a6ca909972805ca437f4f5173efd Mon Sep 17 00:00:00 2001 From: chiragkyal Date: Wed, 15 Jan 2025 14:08:34 +0530 Subject: [PATCH 2/2] update tests Signed-off-by: chiragkyal --- .../CPMSMachineNamePrefix.yaml | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/machine/v1/tests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml b/machine/v1/tests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml index aff24bd6b93..cde8933ea62 100644 --- a/machine/v1/tests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml +++ b/machine/v1/tests/controlplanemachinesets.machine.openshift.io/CPMSMachineNamePrefix.yaml @@ -131,4 +131,25 @@ tests: machine.openshift.io/cluster-api-cluster: cluster spec: providerSpec: {} - expectedError: 'Invalid value: "string": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, ''-'' or ''.'', and must start and end with an alphanumeric character.' + expectedError: 'Invalid value: "string": a lowercase RFC 1123 subdomain must consist of lowercase alphanumeric characters, hyphens (''-''), and periods (''.''). Each block, separated by periods, must start and end with an alphanumeric character. Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted.' + - name: Should reject to create ControlPlaneMachineSet with invalid machineNamePrefix - Consecutive periods are not permitted + initial: | + apiVersion: machine.openshift.io/v1 + kind: ControlPlaneMachineSet + spec: + machineNamePrefix: "control..plane" + selector: + matchLabels: + machine.openshift.io/cluster-api-machine-role: master + machine.openshift.io/cluster-api-machine-type: master + template: + machineType: machines_v1beta1_machine_openshift_io + machines_v1beta1_machine_openshift_io: + metadata: + labels: + machine.openshift.io/cluster-api-machine-role: master + machine.openshift.io/cluster-api-machine-type: master + machine.openshift.io/cluster-api-cluster: cluster + spec: + providerSpec: {} + expectedError: 'Invalid value: "string": a lowercase RFC 1123 subdomain must consist of lowercase alphanumeric characters, hyphens (''-''), and periods (''.''). Each block, separated by periods, must start and end with an alphanumeric character. Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted.'