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 v0.1.12 #236

Merged
merged 18 commits into from
Dec 9, 2024
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
3 changes: 1 addition & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ Run "nnf-deploy <command> --help" for more information on a command.
## Init

The `init` subcommand will install ArgoCD via helm. The user must have the helm
CLI installed and the argoproj helm repo added to their local cache. This init
command should be done only once on a new cluster.
CLI installed. This init command should be done only once on a new cluster.

```bash
./nnf-deploy init
Expand Down
Binary file added charts/argo-cd-7.6.12.tgz
Binary file not shown.
4 changes: 0 additions & 4 deletions config/helm-values/argocd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
# --version $CHART_VER -f $THIS_OVERRIDE_FILE

---
global:
image:
tag: "v2.6.6"

server:
extraArgs:
# Prevent argocd from generating self-cert and redirect http to https.
Expand Down
9 changes: 5 additions & 4 deletions config/repositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ repositories:
development: https://ghcr.io/dataworkflowservices/dws
master: https://ghcr.io/dataworkflowservices/dws
- name: nnf-dm
overlays: [kind, dp0]
development: https://ghcr.io/nearnodeflash/nnf-dm
master: https://ghcr.io/nearnodeflash/nnf-dm
- name: nnf-sos
Expand All @@ -40,7 +41,7 @@ repositories:
master: https://ghcr.io/nearnodeflash/lustre-fs-operator
useRemoteK: false
remoteReference:
build: v0.1.8
build: v0.1.9
url: https://github.com/NearNodeFlash/lustre-fs-operator.git/config/default/?ref=%s
buildConfiguration:
# Environment variables to set when calling any 'make' or 'deploy'
Expand All @@ -51,7 +52,7 @@ buildConfiguration:
# - A specific release build: 0.0.1 (without the "v" prefix)
# - The most recent build from the master branch: master
- name: NNFMFU_VERSION
value: 0.1.3
value: 0.1.4
thirdPartyServices:
# Other services that NNF requires to be available on the system.
# They will be installed in the order specified here.
Expand All @@ -66,5 +67,5 @@ thirdPartyServices:
url: https://raw.githubusercontent.com/kubeflow/mpi-operator/v0.4.0/deploy/v2beta1/mpi-operator.yaml
- name: argocd
useHelm: true
helmCmd: helm install argocd -n argocd --create-namespace argo/argo-cd --version 3.35.4 -f config/helm-values/argocd.yaml
waitCmd: kubectl wait deploy -n argocd --timeout=180s argocd-server --for jsonpath='{.status.availableReplicas}=1'
helmCmd: helm install nnf -n argocd --create-namespace charts/argo-cd-7.6.12.tgz -f config/helm-values/argocd.yaml
waitCmd: kubectl wait deploy -n argocd --timeout=180s nnf-argocd-server --for jsonpath='{.status.availableReplicas}=1'
2 changes: 1 addition & 1 deletion dws
2 changes: 1 addition & 1 deletion lustre-fs-operator
2 changes: 1 addition & 1 deletion nnf-dm
Submodule nnf-dm updated 88 files
+2 −1 .github/workflows/main.yml
+12 −0 .vscode/launch.json
+46 −5 Dockerfile
+45 −9 Makefile
+8 −8 cmd/main.go
+62 −0 config/copy-offload/copy_offload_role.yaml
+12 −0 config/copy-offload/copy_offload_role_binding.yaml
+18 −0 config/copy-offload/copy_offload_service_account.yaml
+14 −0 config/copy-offload/kustomization.yaml
+4 −0 config/copy-offload/kustomizeconfig.yaml
+6 −0 config/dp0/kustomization.yaml
+13 −0 config/dp0/manager_environment_deploy_patch.yaml
+6 −0 config/kind/kustomization.yaml
+13 −0 config/kind/manager_environment_deploy_patch.yaml
+2 −2 config/manager/kustomization.yaml
+1 −1 config/manager/manager.yaml
+1 −1 config/manager/manager_imagepullsecret_patch.yaml
+0 −2 config/rbac/prometheus/kustomization.yaml
+0 −20 config/rbac/prometheus/monitor.yaml
+3 −0 config/top/kustomization.yaml
+1 −1 crd-bumper.yaml
+44 −44 daemons/compute/server/servers/server_default.go
+126 −0 daemons/copy-offload/cmd/main.go
+82 −0 daemons/copy-offload/pkg/driver/dmrequest.go
+762 −0 daemons/copy-offload/pkg/driver/driver.go
+136 −0 daemons/copy-offload/pkg/server/server.go
+367 −0 daemons/copy-offload/pkg/server/server_test.go
+4 −4 go.mod
+8 −8 go.sum
+44 −764 internal/controller/datamovement_controller.go
+105 −101 internal/controller/datamovement_controller_test.go
+27 −16 internal/controller/datamovementmanager_controller.go
+7 −7 internal/controller/datamovementmanager_controller_test.go
+765 −0 internal/controller/helpers/datamovement_helpers.go
+2 −2 internal/controller/suite_test.go
+1 −0 vendor/github.com/DataWorkflowServices/dws/api/v1alpha2/owner_labels.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/conversion.go
+3 −3 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/groupversion_info.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnf_resource_condition_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnf_resource_health_type.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnf_resource_state_type.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnf_resource_status_type.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnf_resource_type.go
+4 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfaccess_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfaccess_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfcontainerprofile_types.go
+2 −2 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfcontainerprofile_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfdatamovement_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfdatamovement_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfdatamovementmanager_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfdatamovementmanager_webhook.go
+14 −2 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfdatamovementprofile_types.go
+2 −2 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfdatamovementprofile_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnflustremgt_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnflustremgt_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfnode_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfnode_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfnodeblockstorage_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfnodeblockstorage_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfnodeecdata_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfnodeecdata_webhook.go
+6 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfnodestorage_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfnodestorage_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfportmanager_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfportmanager_webhook.go
+28 −2 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfstorage_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfstorage_webhook.go
+17 −7 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfstorageprofile_types.go
+2 −2 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfstorageprofile_webhook.go
+9 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfsystemstorage_types.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/nnfsystemstorage_webhook.go
+1 −1 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/workflow_helpers.go
+60 −8 vendor/github.com/NearNodeFlash/nnf-sos/api/v1alpha4/zz_generated.deepcopy.go
+8 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfaccesses.yaml
+4 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfcontainerprofiles.yaml
+4 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml
+20 −5 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementprofiles.yaml
+4 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfdatamovements.yaml
+4 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnflustremgts.yaml
+4 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfnodeblockstorages.yaml
+4 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfnodeecdata.yaml
+4 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfnodes.yaml
+39 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfnodestorages.yaml
+4 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfportmanagers.yaml
+184 −27 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfstorageprofiles.yaml
+38 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfstorages.yaml
+21 −4 vendor/github.com/NearNodeFlash/nnf-sos/config/crd/bases/nnf.cray.hpe.com_nnfsystemstorages.yaml
+5 −5 vendor/modules.txt
2 changes: 1 addition & 1 deletion nnf-integration-test
2 changes: 1 addition & 1 deletion nnf-sos
Submodule nnf-sos updated 170 files
21 changes: 19 additions & 2 deletions tools/crd-bumper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,34 @@ Vendor this new API into another repository using the `vendor-new-api` tool. Thi

### Executing the Tool

The following example will vendor the new `v1beta2` API we created above for lustre-fs-operator into the nnf-sos repository. The module representing lustre-fs-operator is specified in the same form that it would appear in the `go.mod` file in nnf-sos. It begins by creating a new branch in nnf-sos off "master" named `api-lustre-fs-operator-v1beta2`, where it will do all of its work.
The following example will vendor the new `v1beta2` API we created above for lustre-fs-operator into the nnf-sos repository. The current hub version for nnf-sos is `v1alpha3`, and is specified with the `--hub-ver` option. The module representing lustre-fs-operator is specified in the same form that it would appear in the `go.mod` file in nnf-sos. The `--version` option can be used to specify a version if necessary. It begins by creating a new branch in nnf-sos off "master" named `api-lustre-fs-operator-v1beta2`, where it will do all of its work.

```console
[email protected]:NearNodeFlash/nnf-sos.git
vendor-new-api.py -r $DEST_REPO --hub-ver v1beta2 --module github.com/NearNodeFlash/lustre-fs-operator
vendor-new-api.py -r $DEST_REPO --hub-ver v1alpha3 --vendor-hub-ver v1beta2 --module github.com/NearNodeFlash/lustre-fs-operator --version master
```

The repository with its new API will be found under a directory named `workingspace/nnf-sos`.

The new `api-lustre-fs-operator-v1beta2` branch will have a commit containing the newly-vendored API and adjusted code. This commit message will have **ACTION** comments describing something that must be manually verified, and possibly adjusted, before the tests will succeed.

## Removing an Old API Version

An old API version should first be shipped in a deprecated state. Use the `unserve` tool to mark that API version as no longer being served by the API server. After that has shipped, that version of the API can be removed in a later release.

### Unserve the API

The following example will mark the old `v1alpha1` API in lustre-fs-operator as no longer being served. This will place a `+kubebuilder:unservedversion` in each CRD of that version, which `controller-gen` will translate into `served: false` for that version when it regenerates the CRD manifest. It begins by creating a new branch in lustre-fs-operator off "master" named `api-v1alpha1-unserve`, where it will do all of its work.

```console
[email protected]:NearNodeFlash/lustre-fs-operator.git
unserve.py -r $REPO --spoke-ver v1alpha1
```

The repository with its adjusted API will be found under a directory named `workingspace/lustre-fs-operator`.

The new `api-v1alpha1-unserve` branch will have a commit containing the adjusted API and adjusted code. This commit message will have **ACTION** comments describing something that must be manually verified, and possibly adjusted, before the tests will succeed.

## Library and Tool Support

The library and tool support is taken from the [Cluster API](https://github.com/kubernetes-sigs/cluster-api) project. See [release v1.6.6](https://github.com/kubernetes-sigs/cluster-api/tree/release-1.6) for a version that contains multi-version support for CRDs where they have a hub with one spoke. (Note: In v1.7.0 they removed the old API--the old spoke--and their repo contains only one version, the hub.)
Expand Down
13 changes: 7 additions & 6 deletions tools/crd-bumper/crd-bumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from pkg.git_cli import GitCLI
from pkg.conversion_gen import ConversionGen
from pkg.make_cmd import MakeCmd
from pkg.hub_spoke_util import HubSpokeUtil

WORKING_DIR = "workingspace"

Expand Down Expand Up @@ -148,7 +149,7 @@ def main():
project = Project(args.dryrun)

# Load any repo-specific local config.
bumper_cfg = None
bumper_cfg = {}
if os.path.isfile("crd-bumper.yaml"):
with open("crd-bumper.yaml", "r", encoding="utf-8") as fi:
bumper_cfg = yaml.safe_load(fi)
Expand All @@ -158,7 +159,7 @@ def main():
)
makecmd = MakeCmd(args.dryrun, project, args.prev_ver, args.new_ver)

validate_args(args, cgen)
validate_args(args)

if args.branch is None:
args.branch = f"api-{args.new_ver}"
Expand Down Expand Up @@ -335,11 +336,11 @@ def bump_controllers(cgen, makecmd, git, stage, project, args, bumper_cfg):
controllers.edit_util_conversion_test()

# Bump any other, non-controller, directories of code.
if bumper_cfg is not None and "extra_go_dirs" in bumper_cfg:
if "extra_go_dirs" in bumper_cfg:
for extra_dir in bumper_cfg["extra_go_dirs"].split(","):
controllers.update_extras(extra_dir)
# Bump any necessary references in the config/ dir.
if bumper_cfg is not None and "extra_config_dirs" in bumper_cfg:
if "extra_config_dirs" in bumper_cfg:
for extra_dir in bumper_cfg["extra_config_dirs"].split(","):
controllers.update_extra_config(extra_dir)

Expand Down Expand Up @@ -423,11 +424,11 @@ def prologue(git, cmd_elem, operation_order):
git.expect_previous(cmd_elem[0], op_cmd_list)


def validate_args(args, cgen):
def validate_args(args):
"""Validate the commandline args"""

if args.most_recent_spoke:
if not cgen.is_spoke(args.most_recent_spoke):
if not HubSpokeUtil.is_spoke(args.most_recent_spoke):
print(f"API --most-recent-spoke {args.most_recent_spoke} is not a spoke.")
sys.exit(1)
if args.most_recent_spoke in [args.prev_ver, args.new_ver]:
Expand Down
19 changes: 5 additions & 14 deletions tools/crd-bumper/pkg/conversion_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,13 @@ def __init__(self, dryrun, project, prev_ver, new_ver, most_recent_spoke):
self._most_recent_spoke = most_recent_spoke
self._module = None
self.module()
self._preferred_alias = self.preferred_api_alias()

def is_spoke(self, ver):
"""
Determine whether or not the 'ver' API is a spoke.
"""
path = f"api/{ver}/conversion.go"
if not os.path.isfile(path):
return False
fu = FileUtil(self._dryrun, path)
line = fu.find_in_file(" ConvertTo(dstRaw conversion.Hub) ")
if line is None:
return False
return True
self._preferred_alias = self.set_preferred_api_alias()

def preferred_api_alias(self):
"""Return the preferred alias."""
return self._preferred_alias

def set_preferred_api_alias(self):
"""
Is this repo using the API "group" as the alias or is it using something
else?
Expand Down
10 changes: 2 additions & 8 deletions tools/crd-bumper/pkg/create_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from .project import Project
from .fileutil import FileUtil
from .hub_spoke_util import HubSpokeUtil


class CreateApis:
Expand All @@ -45,14 +46,7 @@ def prev_is_hub(self):

for _, dir_names, _ in os.walk("api", followlinks=False):
if len(dir_names) > 1:
path = f"api/{self._prev_ver}/conversion.go"
if not os.path.isfile(path):
return False
fu = FileUtil(self._dryrun, path)
line = fu.find_in_file(" Hub() ")
if line is None:
return False
break
return HubSpokeUtil.is_hub(self._prev_ver)
return True

def create(self):
Expand Down
52 changes: 52 additions & 0 deletions tools/crd-bumper/pkg/hub_spoke_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2024 Hewlett Packard Enterprise Development LP
# Other additional copyright holders may be indicated within.
#
# The entirety of this work is 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.

import os

from .fileutil import FileUtil


class HubSpokeUtil:
"""Simple utilities related to hub and spokes."""

@staticmethod
def is_spoke(ver):
"""
Determine whether or not the 'ver' API is a spoke.
"""
path = f"api/{ver}/conversion.go"
if not os.path.isfile(path):
return False
fu = FileUtil(False, path)
line = fu.find_in_file(" ConvertTo(dstRaw conversion.Hub) ")
if line is None:
return False
return True

@staticmethod
def is_hub(ver):
"""
Determine whether or not the 'ver' API is a hub.
"""
path = f"api/{ver}/conversion.go"
if not os.path.isfile(path):
return False
fu = FileUtil(False, path)
line = fu.find_in_file(" Hub() ")
if line is None:
return False
return True
130 changes: 130 additions & 0 deletions tools/crd-bumper/pkg/unserve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Copyright 2024 Hewlett Packard Enterprise Development LP
# Other additional copyright holders may be indicated within.
#
# The entirety of this work is 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.

import os
import re

from .fileutil import FileUtil


class Unserve:
"""Tools to mark an API as unserved."""

def __init__(self, dryrun, project, spoke_ver, preferred_alias):
self._dryrun = dryrun
self._project = project
self._spoke_ver = spoke_ver
self._preferred_alias = self.set_preferred_alias(preferred_alias)

def set_preferred_alias(self, preferred_alias):
"""
Take the preferred alias if it's provided, else grab it from the
first Kind of this API.
"""
if preferred_alias is None:
# Pick the first kind, use its group.
kinds = self._project.kinds(self._spoke_ver)
group = self._project.group(kinds[0], self._spoke_ver)
else:
group = preferred_alias
return group

def set_unserved(self):
"""
Set the kubebuilder:unservedversion marker in the specified spoke API,
for any Kind that does not yet have it.
"""

kinds = self._project.kinds(self._spoke_ver)
for kind in kinds:
fname = f"api/{self._spoke_ver}/{kind.lower()}_types.go"
if os.path.isfile(fname):
fu = FileUtil(self._dryrun, fname)
found = fu.find_in_file("+kubebuilder:unservedversion")
if found:
continue
# Prefer to pair with kubebuilder:subresource:status, but fall back
# to kubebuilder:object:root=true if status cannot be found.
line = fu.find_in_file("+kubebuilder:subresource:status")
if line is None:
line = fu.find_in_file("+kubebuilder:object:root=true")
if line is None:
raise LookupError(
f"Unable to place kubebuilder:unservedversion in {fname}"
)
fu.replace_in_file(line, f"""{line}\n// +kubebuilder:unservedversion""")
fu.store()

def modify_conversion_webhook_suite_test(self):
"""
Modify the suite test that exercises the conversion webhook.

Update the tests for the specified spoke API.

Recall that this verifies that the conversion routines are accessed via
the conversion webhook, and that is not intended to be an exhaustive
conversion test.

WARNING WARNING: This contains a series of multi-line Python f-strings
which contain large chunks of Go code. So it's confusing. Stay sharp.
"""

conv_go = "internal/controller/conversion_test.go"
if not os.path.isfile(conv_go):
print(f"NOTE: Unable to find {conv_go}!")
return

fu = FileUtil(self._dryrun, conv_go)

# An ACTION note to be added to each test that we think should be removed.
action_note = f"// ACTION: {self._spoke_ver} is no longer served, and this test can be removed."
# Pattern to find the "It()" method so we can change it to "PIt()".
pat = r"^(\s+)It(\(.*)"
kinds = self._project.kinds(self._spoke_ver)
for kind in kinds:
spec = fu.find_in_file(
f"""It("reads {kind} resource via hub and via spoke {self._spoke_ver}", func()"""
)
if spec is not None:
newspec = spec
m = re.search(pat, spec)
if m is not None:
newspec = f"{m.group(1)}PIt{m.group(2)}"

# Wake up! Multi-line f-string:
template = f"""
It("is unable to read {kind} resource via spoke {self._spoke_ver}", func() {{
resSpoke := &{self._preferred_alias}{self._spoke_ver}.{kind}{{}}
Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(resHub), resSpoke)).ToNot(Succeed())
}})
""" # END multi-line f-string.

fu.replace_in_file(spec, f"{template}\n{newspec}\n{action_note}\n")
fu.store()

def commit(self, git, stage):
"""Create a commit message."""

msg = f"""Mark the {self._spoke_ver} API as unserved.

ACTION: Address the ACTION comments in internal/controller/conversion_test.go.

ACTION: Begin by running "make vet". Repair any issues that it finds.
Then run "make test" and continue repairing issues until the tests
pass.
"""
git.commit_stage(stage, msg)
Loading
Loading