diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 4dd2a8fb4..67f87d2ec 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -400,7 +400,8 @@ jobs: mv cnf-testsuite /shared/$DIR cd /shared/$DIR ./cnf-testsuite setup - wget -O cnf-testsuite.yml https://raw.githubusercontent.com/cnti-testcatalog/testsuite/main/example-cnfs/coredns/cnf-testsuite.yml + BRANCH_NAME=${GITHUB_REF#refs/heads/} + wget -O cnf-testsuite.yml https://raw.githubusercontent.com/cnti-testcatalog/testsuite/${BRANCH_NAME}/example-cnfs/coredns/cnf-testsuite.yml ./cnf-testsuite cnf_setup cnf-config=./cnf-testsuite.yml LOG_LEVEL=info ./cnf-testsuite all ~compatibility ~resilience ~reasonable_startup_time ~reasonable_image_size ~platform ~increase_capacity ~decrease_capacity ~install_script_helm ~helm_chart_valid ~helm_chart_published verbose - name: Delete Cluster @@ -475,7 +476,8 @@ jobs: mv cnf-testsuite /shared/$DIR cd /shared/$DIR ./cnf-testsuite setup - wget -O cnf-testsuite.yml https://raw.githubusercontent.com/cnti-testcatalog/testsuite/main/example-cnfs/coredns/cnf-testsuite.yml + BRANCH_NAME=${GITHUB_REF#refs/heads/} + wget -O cnf-testsuite.yml https://raw.githubusercontent.com/cnti-testcatalog/testsuite/${BRANCH_NAME}/example-cnfs/coredns/cnf-testsuite.yml ./cnf-testsuite cnf_setup cnf-config=./cnf-testsuite.yml LOG_LEVEL=info ./cnf-testsuite all ~resilience ~compatibility ~pod_network_latency ~platform ~increase_capacity ~decrease_capacity ~ip_addresses ~liveness ~readiness ~rolling_update ~rolling_downgrade ~rolling_version_change ~nodeport_not_used ~hostport_not_used ~hardcoded_ip_addresses_in_k8s_runtime_configuration ~install_script_helm ~helm_chart_valid ~helm_chart_published ~rollback ~secrets_used ~immutable_configmap verbose - name: Delete Cluster @@ -550,7 +552,8 @@ jobs: mv cnf-testsuite /shared/$DIR cd /shared/$DIR ./cnf-testsuite setup - wget -O cnf-testsuite.yml https://raw.githubusercontent.com/cnti-testcatalog/testsuite/main/example-cnfs/coredns/cnf-testsuite.yml + BRANCH_NAME=${GITHUB_REF#refs/heads/} + wget -O cnf-testsuite.yml https://raw.githubusercontent.com/cnti-testcatalog/testsuite/${BRANCH_NAME}/example-cnfs/coredns/cnf-testsuite.yml ./cnf-testsuite cnf_setup cnf-config=./cnf-testsuite.yml LOG_LEVEL=info ./cnf-testsuite all ~resilience ~platform ~ip_addresses ~liveness ~readiness ~rolling_update ~rolling_downgrade ~rolling_version_change ~nodeport_not_used ~hostport_not_used ~hardcoded_ip_addresses_in_k8s_runtime_configuration ~rollback ~secrets_used ~immutable_configmap ~reasonable_startup_time ~reasonable_image_size verbose - name: Delete Cluster diff --git a/CNF_TESTSUITE_YML_USAGE.md b/CNF_TESTSUITE_YML_USAGE.md index 18b034a28..1ca80d4bc 100644 --- a/CNF_TESTSUITE_YML_USAGE.md +++ b/CNF_TESTSUITE_YML_USAGE.md @@ -4,7 +4,7 @@ The cnf-testsuite.yml is used by `cnf_setup` in order to install the CNF to be tested onto an existing K8s cluster. -The information in the cnf-testsuite.yml is also used for additional configuration of some tests e.g. `allowlist_helm_chart_container_names` is used for exculding containers from the [privileged_containers](https://github.com/cnti-testcatalog/testsuite/blob/main/src/tasks/workload/security.cr#L138) container test. +The information in the cnf-testsuite.yml is also used for additional configuration of some tests e.g. `white_list_container_names` is used for exculding containers from the [privileged_containers](https://github.com/cnti-testcatalog/testsuite/blob/main/src/tasks/workload/security.cr#L138) container test. ### Table of Contents @@ -16,26 +16,36 @@ The information in the cnf-testsuite.yml is also used for additional configurati ### Overview of all cnf-testsuite.yml -The following is a basic working example cnf-testsuite.yml file that can be found in the cnf-testsuite respository: [cnf-testsuite.example.yml](https://github.com/cnti-testcatalog/testsuite/blob/CNF_TESTSUITE_YML%231357/example-cnfs/coredns/cnf-testsuite.yml) +The following is a basic working example cnf-testsuite.yml file that can be found in the cnf-testsuite respository: [cnf-testsuite/embedded_files/cnf-testsuite-v2-example.yml](https://github.com/cnti-testcatalog/testsuite/blob/main/embedded_files/cnf-testsuite-v2-example.yml) ```yaml= --- -allowlist_helm_chart_container_names: [] # [LIST_OF_CONTAINERS_ALLOWED_TO_RUN_PRIVLIDGED] -helm_chart: stable/coredns # PUBLISHED_CNFS_HELM_CHART_REPO/NAME ; or -helm_repository: # CONFIGURATION OF HELM REPO - ONLY NEEDED WHEN USING helm_chart - name: stable # HELM_CHART_REPOSITORY_NAME - repo_url: https://cncf.gitlab.io/stable # HELM_CHART_REPOSITORY_URL -#helm_directory: coredns # PATH_TO_CNFS_HELM_CHART ; or -#manifest_directory: coredns # PATH_TO_DIRECTORY_OF_CNFS_MANIFEST_FILES ; or -release_name: coredns # DESIRED_HELM_RELEASE_NAME -helm_values: --versions 16.2.0 --set persistence.enabled=false -helm_install_namespace: cnf-coredns # Installs the CNF to it's own namespace - - +config_version: "v2" +common: + container_names: + - name: coredns + rolling_update_test_tag: "1.8.0" + rolling_downgrade_test_tag: 1.6.7 + rolling_version_change_test_tag: 1.8.0 + rollback_from_tag: 1.8.0 + +deployments: + helm_charts: + - name: coredns + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable + helm_chart_name: stable/coredns +# helm_dirs: +# - name: envoy +# helm_directory: ../example-cnfs/envoy/envoy +# manifests: +# - name: nginx +# manifest_directory: manifests ``` ### Generator Quick Start -You can quickly generate your own cnf-testsuite.yml dynamically for a CNF by running one of the below commands. +You can quickly generate your own cnf-testsuite.yml dynamically by running `./cnf-testsuite generate_config`. +The process is interactive an should be friendly to new users. Prereqs: You must have kubernetes cluster, curl, and helm 3.1.1 or greater on your system already. - Generate a cnf-testsuite.yml based on a helm chart: `./cnf-testsuite generate_config config-src=stable/coredns output-file=./cnf-testsuite.yml` @@ -53,141 +63,138 @@ New releases may change the format of cnf-testsuite.yml. To update your older co ### Keys and Values -#### allowlist_helm_chart_container_names - -The values of this key are the names of the 'containers' defined in the Kubernetes pod spec of pods that are allowed to be running in privileged mode. (Optional) - -This value is used to allow 'particular' pods to run in privileged mode on the K8s cluster where is CNF being tested is installed. +#### Config version -The reason this is needed is because the Test Suite will check, 'all' pods in the cluster, to see if they're running in privileged mode. - -This is done because it's a common cloud-native practice to delegate 'privileged' networking tasks to only a single app e.g Multus, NSM vs making the CNF privileged itself. As a consequence the allowlist can only be used to exempt 'privileged' infrastructure services running as pods e.g NSM, Multus and cannot be used to exempt the CNF being tested. - -Example setting: +Current config version is `"v2"` +Missing config version is presumed to be config version `"v1"`, which is not supported, but should be transformed to new version if written correctly. -`allowlist_helm_chart_container_names: [coredns]` +#### Common Parameters +Common parameters required for proper functioning of some tests. +`common: ...` +##### container_names +Array of container parameters for rolling version change tests, example: + name: coredns + rolling_update_test_tag: 1.8.0 + rolling_downgrade_test_tag: 1.6.7 + rolling_version_change_test_tag: 1.8.0 + rollback_from_tag: 1.8.0 -#### helm_chart -The published helm repository & chart name. This, or [helm_directory](#helm_directory), or [manifest_directory](#manifest_directory) must be set, but only one **(mutually exclusive)**. This argument is used by cnf_setup in order to install the helm chart for the CNF being tested onto an existing K8s cluster. +##### whitelist_container_names - -Exmple setting: - -`helm_chart: stable/coredns` - -An example of a publishe helm chart repo/image can be found [here](https://github.com/helm/charts/tree/master/stable/coredns#tldr). - -#### helm_repository - -This is used for configuring the name and URL of the helm chart repository being used for installing the cnf. (Optional) - -This agument is used in conjunction with the above argument, [helm_chart](#helm_chart). e.g. if [helm_chart](#helm_chart) is set to `stable/coredns`, the stable component refers to a local helm repository that has already been configured, you can list your local helm repositories by running `helm repo list`. If you don't want to use an already configured repo, you can define it by using the [helm_repository](#helm_repository) argument, and cnf_setup will configure and manage the local helm repository for you. +The values of this key are the names of the 'containers' defined in the Kubernetes pod spec of pods that are allowed to be running in privileged mode. (Optional) +This value is used to allow 'particular' pods to run in privileged mode on the K8s cluster where the CNF is installed. +The reason this is needed is because the Test Suite will check, 'all' pods in the cluster, to see if they're running in privileged mode. +This is done because it's a common cloud-native practice to delegate 'privileged' networking tasks to only a single app e.g Multus, NSM vs making the CNF privileged itself. As a consequence the whitelist can only be used to exempt 'privileged' infrastructure services running as pods e.g NSM, Multus and cannot be used to exempt the CNF under test. Example setting: -```yaml= -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -``` - - -#### helm_directory - -This is the path to the helm chart directory (relative to the location of the cnf-testsuite.yml). This, or [helm_chart](#helm_chart), or [manifest_directory](#manifest_directory) must be set, but only one **(mutually exclusive)**. This argument is used by cnf_setup in order to install the helm chart for the CNF being tested onto an existing K8s cluster. - - -An example of a helm directory can be found [here](https://github.com/helm/charts/tree/master/stable/coredns). - -The PATH is also relative to the location of the cnf-testsuite.yml. So if the cnf-testsuite.yml is in the directory `sample-cnfs/sample_coredns/cnf-testsuite.yml` and helm_directory is set to `helm_directory: chart` the test suite would expect to find the chart under [`sample-cnfs/sample_coredns/chart`](https://github.com/cnti-testcatalog/testsuite/tree/main/sample-cnfs/sample_coredns/chart) - -Example Setting: - -`helm_directory: coredns` - - -#### helm_install_namespace - -This configuration option specifies the namespace that Helm will use to install the CNF. Following best practices, it is recommended not to install your CNF into the `default` namespace of your cluster. For more information on this best practice, see [here](./docs/LIST_OF_TESTS.md#default-namespaces). - -This setting is OPTIONAL. If not specified, the CNF will be installed into the `cnf-default` namespace. - -For more details about Kubernetes namespaces, visit [here](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) - -Example Setting: - -`helm_install_namespace: your_custom_namespace` - +`white_list_container_names: [coredns]` -#### manifest_directory - -This is the path to a directory of manifest files for installing the cnf (relative to the location of the cnf-testsuite.yml). This, or [helm_chart](#helm_chart), or [helm_directory](#helm_directory) must be set, but only one **(mutually exclusive)**. This argument is used by cnf_setup in order to deploy the CNF being tested onto an existing K8s cluster. +##### `docker_insecure_registries` +The docker client expects the image registries to be using an HTTPS API endpoint. This option is used to configure insecure registries that the docker client should be allowed to access. -An example of a manifest directory can be found [here](https://github.com/cnti-testcatalog/testsuite/tree/main/sample-cnfs/sample_nonroot/manifests). +Please use this option to configure Docker to use HTTP to access the registry API. -The PATH is also relative to the location of the cnf-testsuite.yml. So if the cnf-testsuite.yml is in the directory `sample-cnfs/sample_nonroot/cnf-testsuite.yml` and manifest_directory is set to `manifest_directory: manifests` the test suite would expect to find the manifest files under [`sample-cnfs/sample_nonroot/manifests`](https://github.com/cnti-testcatalog/testsuite/tree/main/sample-cnfs/sample_nonroot/manifests) +For an image registry service named `foobar`, running in `default` namespace, on port `5000`, the following would be the expected configuration. -Example Setting: +```yaml +docker_insecure_registries: ["foobar.default.svc.cluster.local:5000"] +``` -`helm_directory: coredns` +##### `image_registry_fqdns` +When using a private registry hosted on the cluster, the image references in the CNF's helm chart may refer to the registry host with the Kubernetes service name alone. The CNF Testsuite runs a docker daemon in a separate `cnf-testsuite` namespace on the Kubernetes cluster. So it is required for the testsuite to be aware of the FQDN of the service, along with the port. +Use this option to configure FQDNs of image registries for the testsuite to access. -#### release_name +If the CNF's helm charts use the image url `foobar:5000/hello:latest`, then please use the configuration in below in `cnf-testsuite.yml` to provide the FQDN mapping for the image registry. -This is the release name of the CNF. (Optional) +```yaml +image_registry_fqdns: + "foobar:5000": "foobar.default.svc.cluster.local:5000" +``` -When cnf_setup runs this argument is used forfilesystem path version, so the testsuite is able to track what cnfs are currently installed on the cluster. It is also used for the helm release version, when either the [helm_chart](#helm_chart) or [helm_directory](#helm_directory) arguments are in use. Some tests also use this argument for finding and interacting with cluster reasouces for the installed CNF. +##### five_g_parameters -This MAY be set. If release_name is not set, a release name will be generated. +Described below: [link](#5G-parameters) -Example setting: +#### Dynamic parameters -`release_name: privileged-coredns` +Dynamic parameters are not meant to be set up manually. They exist due to limitations of testsuite design. -#### helm_values +##### source_cnf_dir -This is for any helm argument. (Optional) +Directory where config is located. -When installing from helm, there are helm arguments (e.g. --version 1234 ) and helm values (e.g. --set myvalue=42). Both of these will be passed on to the underlying helm installation command when it is run. +##### destintaion_cnf_dir +Internal directory where CNF installation files are copied, currently in `cnfs` folder -Example setting: +##### installation_method -`--set myvalue=42` +Installation method of the CNF and additional info according to it. +#### Deployments -#### `image_registry_fqdns` +Deployments are defined as three arrays, each for different installation method. Each array element represents one deployment, and they are meant to represent a single CNF together (Not implemented yet). +At least one deployment should exist in CNF config for it to be a proper config. +All info for deployments is used in cnf_setup and cnf_cleanup tasks. -When using a private registry hosted on the cluster, the image references in the CNF's helm chart may refer to the registry host with the Kubernetes service name alone. The CNF Testsuite runs a docker daemon in a separate `cnf-testsuite` namespace on the Kubernetes cluster. So it is required for the testsuite to be aware of the FQDN of the service, along with the port. +```yaml +deployments: + helm_charts: + ... + helm_dirs: + ... + manifests: + ... +``` -Use this option to configure FQDNs of image registries for the testsuite to access. +##### helm_charts -If the CNF's helm charts use the image url `foobar:5000/hello:latest`, then please use the configuration in below in `cnf-testsuite.yml` to provide the FQDN mapping for the image registry. +Deployment, defined by helm chart and helm repository. +Helm repository name and url can be omitted if repository is already present locally. +Explanations with example: ```yaml -image_registry_fqdns: - "foobar:5000": "foobar.default.svc.cluster.local:5000" +helm_charts: + - name: coredns # Name of the deployment + helm_repo_name: stable # Name of the repository for the helm chart + helm_repo_url: https://cncf.gitlab.io/stable # Repository URL + helm_chart_name: stable/coredns # Name of the helm chart in format repo_name/chart_name + helm_values: --set myvalue=42 # Additional values that would be used for helm installation + namespace: cnf-default # Namespace to which deployment would be installed (cnf-default is default) ``` -> *The above example assumes that the `foobar` registry service is running on the `default` namespace.* - -#### `docker_insecure_registries` - -The docker client expects the image registries to be using an HTTPS API endpoint. This option is used to configure insecure registries that the docker client should be allowed to access. +##### helm_dirs -Please use this option to configure Docker to use HTTP to access the registry API. +Deployment, defined by directory with Chart.yaml file and all templates for resources. +Explanations with example: +```yaml +helm_dirs: + - name: envoy # Name of the deployment + helm_directory: chart # Path to the directory with Chart.yaml, relative to CNF configuration file + helm_values: --set myvalue=42 # Additional values that would be used for helm installation + namespace: cnf-default # Namespace to which deployment would be installed (cnf-default is default) +``` -For an image registry service named `foobar`, running in `default` namespace, on port `5000`, the following would be the expected configuration. +##### manifests +Deployment, defined by directory with manifest files, that are meant to be directly installed by Kubernetes. +Explanations with example: ```yaml -docker_insecure_registries: ["foobar.default.svc.cluster.local:5000"] +manifests: + - name: nginx # Name of the deployment + manifest_directory: manifests # Path to the directory with deployment manifests, relative to CNF configuration file ``` -### RAN configuration + +### 5G Parameters + +These parameters are needed for RAN, Open5gs and UERANSIM tests #### `ric_label` @@ -198,7 +205,6 @@ For a ric named `flexrric`, under the label key `app.kubernetes.io/name` the fol ```yaml ric_label: app.kubernetes.io/name=flexric ``` -### Open5gs and UERANSIM configuration #### mmc diff --git a/embedded_files/cnf-testsuite-v1-example.yml b/embedded_files/cnf-testsuite-v1-example.yml new file mode 100644 index 000000000..3ba8ce0ba --- /dev/null +++ b/embedded_files/cnf-testsuite-v1-example.yml @@ -0,0 +1,5 @@ +release_name: coredns +helm_chart: stable/coredns +helm_repository: + name: stable + repo_url: https://cncf.gitlab.io/stable \ No newline at end of file diff --git a/embedded_files/cnf-testsuite-v2-example.yml b/embedded_files/cnf-testsuite-v2-example.yml index 0ac3d2066..bd9aad931 100644 --- a/embedded_files/cnf-testsuite-v2-example.yml +++ b/embedded_files/cnf-testsuite-v2-example.yml @@ -13,7 +13,7 @@ deployments: - name: coredns helm_repo_name: stable helm_repo_url: https://cncf.gitlab.io/stable - helm_chart_name: coredns + helm_chart_name: stable/coredns # helm_dirs: # - name: envoy # helm_directory: ../example-cnfs/envoy/envoy diff --git a/example-cnfs/coredns/cnf-testsuite.yml b/example-cnfs/coredns/cnf-testsuite.yml index a302ba806..4ced74747 100644 --- a/example-cnfs/coredns/cnf-testsuite.yml +++ b/example-cnfs/coredns/cnf-testsuite.yml @@ -1,14 +1,15 @@ --- -helm_chart: stable/coredns # PUBLISHED_CNFS_HELM_CHART_REPO/NAME ; or -helm_repository: # CONFIGURATION OF HELM REPO - ONLY NEEDED WHEN USING helm_chart - name: stable # HELM_CHART_REPOSITORY_NAME - repo_url: https://cncf.gitlab.io/stable # HELM_CHART_REPOSITORY_URL -#helm_directory: coredns # PATH_TO_CNFS_HELM_CHART ; or -#manifest_directory: coredns # PATH_TO_DIRECTORY_OF_CNFS_MANIFEST_FILES ; or -release_name: coredns # DESIRED_HELM_RELEASE_NAME -container_names: +config_version: v2 +common: + container_names: - name: coredns - rolling_update_test_tag: "1.8.0" + rollback_from_tag: 1.8.0 + rolling_update_test_tag: 1.8.0 rolling_downgrade_test_tag: 1.6.7 rolling_version_change_test_tag: 1.8.0 - rollback_from_tag: 1.8.0 +deployments: + helm_charts: + - name: coredns + helm_chart_name: stable/coredns + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable diff --git a/example-cnfs/envoy/cnf-testsuite.yml b/example-cnfs/envoy/cnf-testsuite.yml index 65e0e0ada..513eb9af4 100644 --- a/example-cnfs/envoy/cnf-testsuite.yml +++ b/example-cnfs/envoy/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -release_name: envoy -helm_directory: envoy +config_version: v2 +deployments: + helm_dirs: + - name: envoy + helm_directory: envoy diff --git a/example-cnfs/ip-forwarder/cnf-testsuite.yml b/example-cnfs/ip-forwarder/cnf-testsuite.yml index 966c3af64..02e6bfd0d 100644 --- a/example-cnfs/ip-forwarder/cnf-testsuite.yml +++ b/example-cnfs/ip-forwarder/cnf-testsuite.yml @@ -1,5 +1,14 @@ --- -helm_directory: vpp -release_name: vpp -rolling_update_test_tag: latest -allowlist_helm_chart_container_names: [nginx, calico-node, kube-proxy, nginx-proxy, node-cache, kube-multus] +config_version: v2 +common: + white_list_container_names: + - nginx + - calico-node + - kube-proxy + - nginx-proxy + - node-cache + - kube-multus +deployments: + helm_dirs: + - name: vpp + helm_directory: vpp diff --git a/example-cnfs/linkerd2/cnf-testsuite.yml b/example-cnfs/linkerd2/cnf-testsuite.yml index 985498a62..24459f48c 100644 --- a/example-cnfs/linkerd2/cnf-testsuite.yml +++ b/example-cnfs/linkerd2/cnf-testsuite.yml @@ -1,7 +1,9 @@ --- -release_name: linkerd -helm_values: "--set-file identityTrustAnchorsPEM=$(pwd)/ca.crt --set-file identity.issuer.tls.crtPEM=$(pwd)/issuer.crt --set-file identity.issuer.tls.keyPEM=$(pwd)/issuer-private.pem" -helm_repository: - name: linkerd - repo_url: https://helm.linkerd.io/stable -helm_chart: linkerd/linkerd-control-plane +config_version: v2 +deployments: + helm_charts: + - name: linkerd + helm_chart_name: linkerd/linkerd-control-plane + helm_values: --set-file identityTrustAnchorsPEM=$(pwd)/ca.crt --set-file identity.issuer.tls.crtPEM=$(pwd)/issuer.crt --set-file identity.issuer.tls.keyPEM=$(pwd)/issuer-private.pem + helm_repo_name: linkerd + helm_repo_url: https://helm.linkerd.io/stable diff --git a/example-cnfs/nsm/cnf-testsuite.yml b/example-cnfs/nsm/cnf-testsuite.yml index fbefd0659..0980b4c80 100644 --- a/example-cnfs/nsm/cnf-testsuite.yml +++ b/example-cnfs/nsm/cnf-testsuite.yml @@ -1,6 +1,7 @@ --- -helm_directory: helm_chart -release_name: nsm --set insecure=true -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + # (kosstennbl) TODO: move helm addoional arguments from name to helm_values + - name: nsm --set insecure=true + helm_directory: helm_chart diff --git a/example-cnfs/pantheon-nsm-nat/cnf-testsuite.yml b/example-cnfs/pantheon-nsm-nat/cnf-testsuite.yml index 618e5d914..d5f200196 100644 --- a/example-cnfs/pantheon-nsm-nat/cnf-testsuite.yml +++ b/example-cnfs/pantheon-nsm-nat/cnf-testsuite.yml @@ -1,4 +1,15 @@ --- -helm_directory: nat-cnf -release_name: cnf-nat -allowlist_helm_chart_container_names: [node-cache, nginx, coredns, calico-node, kube-proxy, nginx-proxy, kube-multus] +config_version: v2 +common: + white_list_container_names: + - node-cache + - nginx + - coredns + - calico-node + - kube-proxy + - nginx-proxy + - kube-multus +deployments: + helm_dirs: + - name: cnf-nat + helm_directory: nat-cnf diff --git a/example-cnfs/vpp-3c2n-csp-use-case/cnf-testsuite.yml b/example-cnfs/vpp-3c2n-csp-use-case/cnf-testsuite.yml index 6701914e2..f7ce6acce 100644 --- a/example-cnfs/vpp-3c2n-csp-use-case/cnf-testsuite.yml +++ b/example-cnfs/vpp-3c2n-csp-use-case/cnf-testsuite.yml @@ -1,4 +1,13 @@ --- -helm_directory: csp -release_name: ip-forwarder-csp -allowlist_helm_chart_container_names: [nginx, calico-node, kube-proxy, nginx-proxy, node-cache] +config_version: v2 +common: + white_list_container_names: + - nginx + - calico-node + - kube-proxy + - nginx-proxy + - node-cache +deployments: + helm_dirs: + - name: ip-forwarder-csp + helm_directory: csp diff --git a/sample-cnfs/k8s-multiple-deployments/cnf-testsuite.yml b/sample-cnfs/k8s-multiple-deployments/cnf-testsuite.yml index 25857dc18..ef5d2da20 100644 --- a/sample-cnfs/k8s-multiple-deployments/cnf-testsuite.yml +++ b/sample-cnfs/k8s-multiple-deployments/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: chart -release_name: sidecar-container-demo -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: sidecar-container-demo + helm_directory: chart diff --git a/sample-cnfs/k8s-multiple-processes/cnf-testsuite.yml b/sample-cnfs/k8s-multiple-processes/cnf-testsuite.yml index 78378d1fd..ef5d2da20 100644 --- a/sample-cnfs/k8s-multiple-processes/cnf-testsuite.yml +++ b/sample-cnfs/k8s-multiple-processes/cnf-testsuite.yml @@ -1,7 +1,6 @@ --- -helm_directory: chart -release_name: sidecar-container-demo -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -rolling_update_test_tag: 1.6.7 +config_version: v2 +deployments: + helm_dirs: + - name: sidecar-container-demo + helm_directory: chart diff --git a/sample-cnfs/k8s-non-helm-no-image-policy/cnf-testsuite.yml b/sample-cnfs/k8s-non-helm-no-image-policy/cnf-testsuite.yml index 5ac25d5ed..ed7483831 100644 --- a/sample-cnfs/k8s-non-helm-no-image-policy/cnf-testsuite.yml +++ b/sample-cnfs/k8s-non-helm-no-image-policy/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx-webapp -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx-webapp + manifest_directory: manifests diff --git a/sample-cnfs/k8s-non-helm/cnf-testsuite.yml b/sample-cnfs/k8s-non-helm/cnf-testsuite.yml index 5ac25d5ed..ed7483831 100644 --- a/sample-cnfs/k8s-non-helm/cnf-testsuite.yml +++ b/sample-cnfs/k8s-non-helm/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx-webapp -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx-webapp + manifest_directory: manifests diff --git a/sample-cnfs/k8s-sidecar-container-pattern/cnf-testsuite.yml b/sample-cnfs/k8s-sidecar-container-pattern/cnf-testsuite.yml index 8d2db1eca..ef5d2da20 100644 --- a/sample-cnfs/k8s-sidecar-container-pattern/cnf-testsuite.yml +++ b/sample-cnfs/k8s-sidecar-container-pattern/cnf-testsuite.yml @@ -1,9 +1,6 @@ --- -helm_directory: chart -git_clone_url: -install_script: -release_name: sidecar-container-demo -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -rolling_update_test_tag: 1.6.7 +config_version: v2 +deployments: + helm_dirs: + - name: sidecar-container-demo + helm_directory: chart diff --git a/sample-cnfs/multi_helm_directories/cnf-testsuite.yml b/sample-cnfs/multi_helm_directories/cnf-testsuite.yml index 491f04f86..2fa078ba6 100644 --- a/sample-cnfs/multi_helm_directories/cnf-testsuite.yml +++ b/sample-cnfs/multi_helm_directories/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: multiple/directory/chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: multiple/directory/chart diff --git a/sample-cnfs/ndn-immutable-configmap/cnf-testsuite.yml b/sample-cnfs/ndn-immutable-configmap/cnf-testsuite.yml index 3bfb83f9e..1e58c30e5 100644 --- a/sample-cnfs/ndn-immutable-configmap/cnf-testsuite.yml +++ b/sample-cnfs/ndn-immutable-configmap/cnf-testsuite.yml @@ -1,15 +1,13 @@ --- -git_clone_url: -install_script: -manifest_directory: manifests -release_name: nginx -docker_repository: -helm_repository: - name: - repo_url: -container_names: +config_version: v2 +common: + container_names: - name: nginx - rolling_update_test_tag: "latest" + rollback_from_tag: latest + rolling_update_test_tag: latest rolling_downgrade_test_tag: latest rolling_version_change_test_tag: latest - rollback_from_tag: latest +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/ndn-multi-db-connections-fail/cnf-testsuite.yml b/sample-cnfs/ndn-multi-db-connections-fail/cnf-testsuite.yml index 19ef1e498..501bf5367 100644 --- a/sample-cnfs/ndn-multi-db-connections-fail/cnf-testsuite.yml +++ b/sample-cnfs/ndn-multi-db-connections-fail/cnf-testsuite.yml @@ -1,4 +1,7 @@ --- -helm_directory: wordpress -helm_install_namespace: wordpress -release_name: test +config_version: v2 +deployments: + helm_dirs: + - name: test + helm_directory: wordpress + namespace: wordpress diff --git a/sample-cnfs/ndn-mutable-configmap/cnf-testsuite.yml b/sample-cnfs/ndn-mutable-configmap/cnf-testsuite.yml index 3bfb83f9e..1e58c30e5 100644 --- a/sample-cnfs/ndn-mutable-configmap/cnf-testsuite.yml +++ b/sample-cnfs/ndn-mutable-configmap/cnf-testsuite.yml @@ -1,15 +1,13 @@ --- -git_clone_url: -install_script: -manifest_directory: manifests -release_name: nginx -docker_repository: -helm_repository: - name: - repo_url: -container_names: +config_version: v2 +common: + container_names: - name: nginx - rolling_update_test_tag: "latest" + rollback_from_tag: latest + rolling_update_test_tag: latest rolling_downgrade_test_tag: latest rolling_version_change_test_tag: latest - rollback_from_tag: latest +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/ndn-non-root-user/cnf-testsuite.yml b/sample-cnfs/ndn-non-root-user/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/ndn-non-root-user/cnf-testsuite.yml +++ b/sample-cnfs/ndn-non-root-user/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/ndn-reasonable-image-size/cnf-testsuite.yml b/sample-cnfs/ndn-reasonable-image-size/cnf-testsuite.yml index 9980a86d8..276e2445e 100644 --- a/sample-cnfs/ndn-reasonable-image-size/cnf-testsuite.yml +++ b/sample-cnfs/ndn-reasonable-image-size/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: gateway-helm -release_name: envoy-gateway +config_version: v2 +deployments: + helm_dirs: + - name: envoy-gateway + helm_directory: gateway-helm diff --git a/sample-cnfs/sample-alpha-apis/cnf-testsuite.yml b/sample-cnfs/sample-alpha-apis/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-alpha-apis/cnf-testsuite.yml +++ b/sample-cnfs/sample-alpha-apis/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-appliciation-credentials/cnf-testsuite.yml b/sample-cnfs/sample-appliciation-credentials/cnf-testsuite.yml index ab73fef5e..65738a52a 100644 --- a/sample-cnfs/sample-appliciation-credentials/cnf-testsuite.yml +++ b/sample-cnfs/sample-appliciation-credentials/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample-bad-helm-repo/cnf-testsuite.yml b/sample-cnfs/sample-bad-helm-repo/cnf-testsuite.yml index bec56f08b..f6263bddb 100644 --- a/sample-cnfs/sample-bad-helm-repo/cnf-testsuite.yml +++ b/sample-cnfs/sample-bad-helm-repo/cnf-testsuite.yml @@ -1,6 +1,8 @@ --- -release_name: coredns -helm_repository: - name: badrepo - repo_url: https://bad-helm-repo.googleapis.com -helm_chart: badrepo/coredns +config_version: v2 +deployments: + helm_charts: + - name: coredns + helm_chart_name: badrepo/coredns + helm_repo_name: badrepo + helm_repo_url: https://bad-helm-repo.googleapis.com diff --git a/sample-cnfs/sample-bad-zombie/cnf-testsuite.yml b/sample-cnfs/sample-bad-zombie/cnf-testsuite.yml index 6ce0dd7a0..ad71fbc4d 100644 --- a/sample-cnfs/sample-bad-zombie/cnf-testsuite.yml +++ b/sample-cnfs/sample-bad-zombie/cnf-testsuite.yml @@ -1,6 +1,8 @@ --- -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -helm_chart: stable/coredns +config_version: v2 +deployments: + helm_charts: + - name: coredns + helm_chart_name: stable/coredns + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable diff --git a/sample-cnfs/sample-bad_helm_coredns-cnf/cnf-testsuite.yml b/sample-cnfs/sample-bad_helm_coredns-cnf/cnf-testsuite.yml index 8d615ab61..5a468866c 100644 --- a/sample-cnfs/sample-bad_helm_coredns-cnf/cnf-testsuite.yml +++ b/sample-cnfs/sample-bad_helm_coredns-cnf/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: bad-helm-coredns-coredns +config_version: v2 +deployments: + helm_dirs: + - name: bad-helm-coredns-coredns + helm_directory: chart diff --git a/sample-cnfs/sample-coredns-cnf-bad-chart/cnf-testsuite.yml b/sample-cnfs/sample-coredns-cnf-bad-chart/cnf-testsuite.yml index d1206bfb1..01f4ee223 100644 --- a/sample-cnfs/sample-coredns-cnf-bad-chart/cnf-testsuite.yml +++ b/sample-cnfs/sample-coredns-cnf-bad-chart/cnf-testsuite.yml @@ -1,6 +1,8 @@ --- -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -helm_chart: stable/corsdsdsdedns +config_version: v2 +deployments: + helm_charts: + - name: coredns + helm_chart_name: stable/corsdsdsdedns + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable diff --git a/sample-cnfs/sample-coredns-cnf-source/cnf-testsuite.yml b/sample-cnfs/sample-coredns-cnf-source/cnf-testsuite.yml index a3f862543..3393d86ac 100644 --- a/sample-cnfs/sample-coredns-cnf-source/cnf-testsuite.yml +++ b/sample-cnfs/sample-coredns-cnf-source/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -release_name: coredns -helm_chart: stable/coredns +config_version: v2 +deployments: + helm_charts: + - name: coredns + helm_chart_name: stable/coredns diff --git a/sample-cnfs/sample-coredns-cnf/cnf-testsuite.yml b/sample-cnfs/sample-coredns-cnf/cnf-testsuite.yml index 6ce0dd7a0..ad71fbc4d 100644 --- a/sample-cnfs/sample-coredns-cnf/cnf-testsuite.yml +++ b/sample-cnfs/sample-coredns-cnf/cnf-testsuite.yml @@ -1,6 +1,8 @@ --- -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -helm_chart: stable/coredns +config_version: v2 +deployments: + helm_charts: + - name: coredns + helm_chart_name: stable/coredns + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable diff --git a/sample-cnfs/sample-coredns-cnf2/cnf-testsuite.yml b/sample-cnfs/sample-coredns-cnf2/cnf-testsuite.yml index 84ad7d477..cb029727e 100644 --- a/sample-cnfs/sample-coredns-cnf2/cnf-testsuite.yml +++ b/sample-cnfs/sample-coredns-cnf2/cnf-testsuite.yml @@ -1,7 +1,9 @@ --- -release_name: coredns2 -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -helm_chart: stable/coredns -helm_install_namespace: cnfspace2 +config_version: v2 +deployments: + helm_charts: + - name: coredns2 + helm_chart_name: stable/coredns + namespace: cnfspace2 + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable diff --git a/sample-cnfs/sample-coredns-cnf3/cnf-testsuite.yml b/sample-cnfs/sample-coredns-cnf3/cnf-testsuite.yml index bcfe6b45a..eaf3bff64 100644 --- a/sample-cnfs/sample-coredns-cnf3/cnf-testsuite.yml +++ b/sample-cnfs/sample-coredns-cnf3/cnf-testsuite.yml @@ -1,7 +1,9 @@ --- -release_name: coredns3 -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -helm_chart: stable/coredns -helm_install_namespace: cnfspace3 +config_version: v2 +deployments: + helm_charts: + - name: coredns3 + helm_chart_name: stable/coredns + namespace: cnfspace3 + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable diff --git a/sample-cnfs/sample-coredns-cnf4/cnf-testsuite.yml b/sample-cnfs/sample-coredns-cnf4/cnf-testsuite.yml index 7c6b20d64..732cd44f2 100644 --- a/sample-cnfs/sample-coredns-cnf4/cnf-testsuite.yml +++ b/sample-cnfs/sample-coredns-cnf4/cnf-testsuite.yml @@ -1,7 +1,9 @@ --- -release_name: coredns4 -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -helm_chart: stable/coredns -helm_install_namespace: cnfspace4 +config_version: v2 +deployments: + helm_charts: + - name: coredns4 + helm_chart_name: stable/coredns + namespace: cnfspace4 + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable diff --git a/sample-cnfs/sample-elastic-volume/cnf-testsuite.yml b/sample-cnfs/sample-elastic-volume/cnf-testsuite.yml index e5c64920a..bab9c64aa 100644 --- a/sample-cnfs/sample-elastic-volume/cnf-testsuite.yml +++ b/sample-cnfs/sample-elastic-volume/cnf-testsuite.yml @@ -1,6 +1,8 @@ --- -release_name: prometheus -helm_repository: - name: prometheus-community - repo_url: https://prometheus-community.github.io/helm-charts -helm_chart: prometheus-community/prometheus +config_version: v2 +deployments: + helm_charts: + - name: prometheus + helm_chart_name: prometheus-community/prometheus + helm_repo_name: prometheus-community + helm_repo_url: https://prometheus-community.github.io/helm-charts diff --git a/sample-cnfs/sample-fluentbit/cnf-testsuite.yml b/sample-cnfs/sample-fluentbit/cnf-testsuite.yml index bf1633f90..7c19c82e7 100644 --- a/sample-cnfs/sample-fluentbit/cnf-testsuite.yml +++ b/sample-cnfs/sample-fluentbit/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx-fluentbit -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx-fluentbit + manifest_directory: manifests diff --git a/sample-cnfs/sample-fragile-state/cnf-testsuite.yml b/sample-cnfs/sample-fragile-state/cnf-testsuite.yml index 6981ed8be..65738a52a 100644 --- a/sample-cnfs/sample-fragile-state/cnf-testsuite.yml +++ b/sample-cnfs/sample-fragile-state/cnf-testsuite.yml @@ -1,4 +1,6 @@ --- -helm_directory: chart -release_name: coredns -rolling_update_test_tag: 1.6.7 +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample-generic-cnf/cnf-testsuite.yml b/sample-cnfs/sample-generic-cnf/cnf-testsuite.yml index 8313b5d28..065e6632a 100644 --- a/sample-cnfs/sample-generic-cnf/cnf-testsuite.yml +++ b/sample-cnfs/sample-generic-cnf/cnf-testsuite.yml @@ -1,6 +1,8 @@ --- -release_name: coredns-1609263557 -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -helm_chart: stable/coredns +config_version: v2 +deployments: + helm_charts: + - name: coredns-1609263557 + helm_chart_name: stable/coredns + helm_repo_name: stable + helm_repo_url: https://cncf.gitlab.io/stable diff --git a/sample-cnfs/sample-hostpath/cnf-testsuite.yml b/sample-cnfs/sample-hostpath/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-hostpath/cnf-testsuite.yml +++ b/sample-cnfs/sample-hostpath/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-immutable-fs/cnf-testsuite.yml b/sample-cnfs/sample-immutable-fs/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-immutable-fs/cnf-testsuite.yml +++ b/sample-cnfs/sample-immutable-fs/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-init-systems/cnf-testsuite.yml b/sample-cnfs/sample-init-systems/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-init-systems/cnf-testsuite.yml +++ b/sample-cnfs/sample-init-systems/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-insecure-capabilities/cnf-testsuite.yml b/sample-cnfs/sample-insecure-capabilities/cnf-testsuite.yml index ab73fef5e..65738a52a 100644 --- a/sample-cnfs/sample-insecure-capabilities/cnf-testsuite.yml +++ b/sample-cnfs/sample-insecure-capabilities/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample-large-cnf/cnf-testsuite.yml b/sample-cnfs/sample-large-cnf/cnf-testsuite.yml index ecf3e282f..65738a52a 100644 --- a/sample-cnfs/sample-large-cnf/cnf-testsuite.yml +++ b/sample-cnfs/sample-large-cnf/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample-local-storage/cnf-testsuite.yml b/sample-cnfs/sample-local-storage/cnf-testsuite.yml index 40c14e685..65738a52a 100644 --- a/sample-cnfs/sample-local-storage/cnf-testsuite.yml +++ b/sample-cnfs/sample-local-storage/cnf-testsuite.yml @@ -1,4 +1,6 @@ --- -helm_directory: chart -helm_values: -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample-memcached-operator/cnf-testsuite.yml b/sample-cnfs/sample-memcached-operator/cnf-testsuite.yml index 7fde0525e..f038a47eb 100644 --- a/sample-cnfs/sample-memcached-operator/cnf-testsuite.yml +++ b/sample-cnfs/sample-memcached-operator/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -release_name: memcached-operator -helm_directory: bundle/manifests +config_version: v2 +deployments: + helm_dirs: + - name: memcached-operator + helm_directory: bundle/manifests diff --git a/sample-cnfs/sample-minimal-cnf/cnf-testsuite.yml b/sample-cnfs/sample-minimal-cnf/cnf-testsuite.yml index c70b568cc..91585f88d 100644 --- a/sample-cnfs/sample-minimal-cnf/cnf-testsuite.yml +++ b/sample-cnfs/sample-minimal-cnf/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_chart: stable/coredns -release_name: coredns-1614713069 +config_version: v2 +deployments: + helm_charts: + - name: coredns-1614713069 + helm_chart_name: stable/coredns diff --git a/sample-cnfs/sample-multi-db-connections-exempt/cnf-testsuite.yml b/sample-cnfs/sample-multi-db-connections-exempt/cnf-testsuite.yml index 130d4c094..8d08c4ba3 100644 --- a/sample-cnfs/sample-multi-db-connections-exempt/cnf-testsuite.yml +++ b/sample-cnfs/sample-multi-db-connections-exempt/cnf-testsuite.yml @@ -1,4 +1,7 @@ --- -helm_directory: wordpress -helm_values: "--set mariadb.primary.persistence.enabled=false --set persistence.enabled=false" -release_name: test +config_version: v2 +deployments: + helm_dirs: + - name: test + helm_directory: wordpress + helm_values: --set mariadb.primary.persistence.enabled=false --set persistence.enabled=false diff --git a/sample-cnfs/sample-multi-db-connections-fail/cnf-testsuite.yml b/sample-cnfs/sample-multi-db-connections-fail/cnf-testsuite.yml index 076eff107..4be67e138 100644 --- a/sample-cnfs/sample-multi-db-connections-fail/cnf-testsuite.yml +++ b/sample-cnfs/sample-multi-db-connections-fail/cnf-testsuite.yml @@ -1,3 +1,7 @@ --- -helm_directory: wordpress -release_name: test --set mariadb.primary.persistence.enabled=false --set persistence.enabled=false +config_version: v2 +deployments: + helm_dirs: + # (kosstennbl) TODO: move helm addoional arguments from name to helm_values + - name: test --set mariadb.primary.persistence.enabled=false --set persistence.enabled=false + helm_directory: wordpress diff --git a/sample-cnfs/sample-multiple-processes/cnf-testsuite.yml b/sample-cnfs/sample-multiple-processes/cnf-testsuite.yml index 26f8a5bc8..d8a5731f9 100644 --- a/sample-cnfs/sample-multiple-processes/cnf-testsuite.yml +++ b/sample-cnfs/sample-multiple-processes/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: multi-proc -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: multi-proc + manifest_directory: manifests diff --git a/sample-cnfs/sample-mysql/cnf-testsuite.yml b/sample-cnfs/sample-mysql/cnf-testsuite.yml index eded1914d..907379101 100644 --- a/sample-cnfs/sample-mysql/cnf-testsuite.yml +++ b/sample-cnfs/sample-mysql/cnf-testsuite.yml @@ -1,6 +1,8 @@ --- -release_name: mysql -helm_chart: bitnami/mysql -helm_repository: - name: bitnami - repo_url: https://charts.bitnami.com/bitnami +config_version: v2 +deployments: + helm_charts: + - name: mysql + helm_chart_name: bitnami/mysql + helm_repo_name: bitnami + helm_repo_url: https://charts.bitnami.com/bitnami diff --git a/sample-cnfs/sample-ndn-privileged/cnf-testsuite.yml b/sample-cnfs/sample-ndn-privileged/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-ndn-privileged/cnf-testsuite.yml +++ b/sample-cnfs/sample-ndn-privileged/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-nonroot-containers/cnf-testsuite.yml b/sample-cnfs/sample-nonroot-containers/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-nonroot-containers/cnf-testsuite.yml +++ b/sample-cnfs/sample-nonroot-containers/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-nonroot/cnf-testsuite.yml b/sample-cnfs/sample-nonroot/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-nonroot/cnf-testsuite.yml +++ b/sample-cnfs/sample-nonroot/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-openmetrics/cnf-testsuite.yml b/sample-cnfs/sample-openmetrics/cnf-testsuite.yml index 4b2ff0124..897d7a8f5 100644 --- a/sample-cnfs/sample-openmetrics/cnf-testsuite.yml +++ b/sample-cnfs/sample-openmetrics/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: openmetrics-compliant -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: openmetrics-compliant + manifest_directory: manifests diff --git a/sample-cnfs/sample-oran-noric/cnf-testsuite.yml b/sample-cnfs/sample-oran-noric/cnf-testsuite.yml index 527fad195..77ff4f874 100644 --- a/sample-cnfs/sample-oran-noric/cnf-testsuite.yml +++ b/sample-cnfs/sample-oran-noric/cnf-testsuite.yml @@ -1,4 +1,9 @@ --- -manifest_directory: manifests -release_name: oran-ric -ric_label: app.kubernetes.io/name=flexric +config_version: v2 +common: + five_g_parameters: + ric_label: app.kubernetes.io/name=flexric +deployments: + manifests: + - name: oran-ric + manifest_directory: manifests diff --git a/sample-cnfs/sample-oran-ric/cnf-testsuite.yml b/sample-cnfs/sample-oran-ric/cnf-testsuite.yml index 527fad195..77ff4f874 100644 --- a/sample-cnfs/sample-oran-ric/cnf-testsuite.yml +++ b/sample-cnfs/sample-oran-ric/cnf-testsuite.yml @@ -1,4 +1,9 @@ --- -manifest_directory: manifests -release_name: oran-ric -ric_label: app.kubernetes.io/name=flexric +config_version: v2 +common: + five_g_parameters: + ric_label: app.kubernetes.io/name=flexric +deployments: + manifests: + - name: oran-ric + manifest_directory: manifests diff --git a/sample-cnfs/sample-privilege-escalation/cnf-testsuite.yml b/sample-cnfs/sample-privilege-escalation/cnf-testsuite.yml index ab73fef5e..65738a52a 100644 --- a/sample-cnfs/sample-privilege-escalation/cnf-testsuite.yml +++ b/sample-cnfs/sample-privilege-escalation/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample-prom-pod-discovery/cnf-testsuite.yml b/sample-cnfs/sample-prom-pod-discovery/cnf-testsuite.yml index ab73fef5e..65738a52a 100644 --- a/sample-cnfs/sample-prom-pod-discovery/cnf-testsuite.yml +++ b/sample-cnfs/sample-prom-pod-discovery/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample-service-accounts/cnf-testsuite.yml b/sample-cnfs/sample-service-accounts/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-service-accounts/cnf-testsuite.yml +++ b/sample-cnfs/sample-service-accounts/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-statefulset-cnf/cnf-testsuite.yml b/sample-cnfs/sample-statefulset-cnf/cnf-testsuite.yml index 63c6b0e5b..6516d77f6 100644 --- a/sample-cnfs/sample-statefulset-cnf/cnf-testsuite.yml +++ b/sample-cnfs/sample-statefulset-cnf/cnf-testsuite.yml @@ -1,32 +1,23 @@ --- -release_name: test - -helm_repository: - name: bitnami - repo_url: https://charts.bitnami.com/bitnami -helm_chart: bitnami/wordpress - -# The below configuration for the rolling tests -# refer to container image versions that are -# one version behind the images used in the specific chart version. -helm_values: "--version 15.2.0 --set mariadb.primary.persistence.enabled=false --set persistence.enabled=false" - -# Order of tests: -# 1. rollback -# 2. rolling_update -# 3. rolling_downgrade -# 4. rolling_version_change -container_names: +config_version: v2 +common: + container_names: # Default container image bitnami/wordpress:6.0.2-debian-11-r0 - name: wordpress rollback_from_tag: 6.0.1-debian-11-r21 rolling_update_test_tag: 6.0.2-debian-11-r0 rolling_downgrade_test_tag: 6.0.1-debian-11-r21 rolling_version_change_test_tag: 6.0.2-debian-11-r0 - # Default container image bitnami/mariadb:10.6.9-debian-11-r0 - name: mariadb rollback_from_tag: 10.6.8-debian-11-r2 rolling_update_test_tag: 10.6.9-debian-11-r0 rolling_downgrade_test_tag: 10.6.8-debian-11-r2 rolling_version_change_test_tag: 10.6.9-debian-11-r0 +deployments: + helm_charts: + - name: test + helm_chart_name: bitnami/wordpress + helm_values: --version 15.2.0 --set mariadb.primary.persistence.enabled=false --set persistence.enabled=false + helm_repo_name: bitnami + helm_repo_url: https://charts.bitnami.com/bitnami diff --git a/sample-cnfs/sample-statefulset-nginx/cnf-testsuite.yml b/sample-cnfs/sample-statefulset-nginx/cnf-testsuite.yml index c4b295167..7a9a3ce36 100644 --- a/sample-cnfs/sample-statefulset-nginx/cnf-testsuite.yml +++ b/sample-cnfs/sample-statefulset-nginx/cnf-testsuite.yml @@ -1,23 +1,14 @@ --- -release_name: test-ss -manifest_directory: manifests -helm_repository: - name: - repo_url: - -# The below configuration for the rolling tests -# refer to container image versions that are -# one version behind the images used in the specific chart version. - -# Order of tests: -# 1. rollback -# 2. rolling_update -# 3. rolling_downgrade -# 4. rolling_version_change -container_names: +config_version: v2 +common: + container_names: # Default container image registry.k8s.io/nginx-slim:0.8 - name: nginx rollback_from_tag: "0.7" rolling_update_test_tag: "0.9" rolling_downgrade_test_tag: "0.7" rolling_version_change_test_tag: "0.9" +deployments: + manifests: + - name: test-ss + manifest_directory: manifests diff --git a/sample-cnfs/sample-statefulsets/cnf-testsuite.yml b/sample-cnfs/sample-statefulsets/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample-statefulsets/cnf-testsuite.yml +++ b/sample-cnfs/sample-statefulsets/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample-tracing/cnf-testsuite.yml b/sample-cnfs/sample-tracing/cnf-testsuite.yml index 7c919c8ac..7d02a3cbb 100644 --- a/sample-cnfs/sample-tracing/cnf-testsuite.yml +++ b/sample-cnfs/sample-tracing/cnf-testsuite.yml @@ -1,7 +1,10 @@ --- -helm_directory: jaeger -release_name: test -helm_install_namespace: jaeger -helm_repository: - name: jaegertracing - repo_url: https://jaegertracing.github.io/helm-charts +config_version: v2 +deployments: + helm_dirs: + - name: test + helm_directory: jaeger + namespace: jaeger + # Repository was there, but it seems unnecessary: + # helm_repo_name: jaegertracing + # helm_repo_url: https://jaegertracing.github.io/helm-charts \ No newline at end of file diff --git a/sample-cnfs/sample_bad_signal_handling/cnf-testsuite.yml b/sample-cnfs/sample_bad_signal_handling/cnf-testsuite.yml index 451548f34..6ad0b3c40 100644 --- a/sample-cnfs/sample_bad_signal_handling/cnf-testsuite.yml +++ b/sample-cnfs/sample_bad_signal_handling/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: envoy +config_version: v2 +deployments: + helm_dirs: + - name: envoy + helm_directory: chart diff --git a/sample-cnfs/sample_container_sock_mount/cnf-testsuite.yml b/sample-cnfs/sample_container_sock_mount/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample_container_sock_mount/cnf-testsuite.yml +++ b/sample-cnfs/sample_container_sock_mount/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample_coredns/cnf-testsuite.yml b/sample-cnfs/sample_coredns/cnf-testsuite.yml index ab73fef5e..65738a52a 100644 --- a/sample-cnfs/sample_coredns/cnf-testsuite.yml +++ b/sample-cnfs/sample_coredns/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_coredns_bad_liveness/cnf-testsuite.yml b/sample-cnfs/sample_coredns_bad_liveness/cnf-testsuite.yml index 709d0e987..f43a96c4e 100644 --- a/sample-cnfs/sample_coredns_bad_liveness/cnf-testsuite.yml +++ b/sample-cnfs/sample_coredns_bad_liveness/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: bad-liveness +config_version: v2 +deployments: + helm_dirs: + - name: bad-liveness + helm_directory: chart diff --git a/sample-cnfs/sample_coredns_chart_directory/cnf-testsuite.yml b/sample-cnfs/sample_coredns_chart_directory/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_coredns_chart_directory/cnf-testsuite.yml +++ b/sample-cnfs/sample_coredns_chart_directory/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_coredns_default_namespace/cnf-testsuite.yml b/sample-cnfs/sample_coredns_default_namespace/cnf-testsuite.yml index b8cf4c905..a6c22e578 100644 --- a/sample-cnfs/sample_coredns_default_namespace/cnf-testsuite.yml +++ b/sample-cnfs/sample_coredns_default_namespace/cnf-testsuite.yml @@ -1,7 +1,7 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -helm_install_namespace: default +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart + namespace: default diff --git a/sample-cnfs/sample_coredns_hardcoded_ips/cnf-testsuite.yml b/sample-cnfs/sample_coredns_hardcoded_ips/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_coredns_hardcoded_ips/cnf-testsuite.yml +++ b/sample-cnfs/sample_coredns_hardcoded_ips/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_coredns_protected/cnf-testsuite.yml b/sample-cnfs/sample_coredns_protected/cnf-testsuite.yml index 477628192..02cb82643 100644 --- a/sample-cnfs/sample_coredns_protected/cnf-testsuite.yml +++ b/sample-cnfs/sample_coredns_protected/cnf-testsuite.yml @@ -1,3 +1,7 @@ --- -helm_directory: chart -release_name: coredns --set imageCredentials.registry=https://index.docker.io/v1/ --set imageCredentials.username=$PROTECTED_DOCKERHUB_USERNAME --set imageCredentials.password=$PROTECTED_DOCKERHUB_PASSWORD --set imageCredentials.email=$PROTECTED_DOCKERHUB_EMAIL --set image.repository=$PROTECTED_IMAGE_REPO +config_version: v2 +deployments: + helm_dirs: + # (kosstennbl) TODO: move helm addoional arguments from name to helm_values + - name: coredns --set imageCredentials.registry=https://index.docker.io/v1/ --set imageCredentials.username=$PROTECTED_DOCKERHUB_USERNAME --set imageCredentials.password=$PROTECTED_DOCKERHUB_PASSWORD --set imageCredentials.email=$PROTECTED_DOCKERHUB_EMAIL --set image.repository=$PROTECTED_IMAGE_REPO + helm_directory: chart diff --git a/sample-cnfs/sample_coredns_values/cnf-testsuite.yml b/sample-cnfs/sample_coredns_values/cnf-testsuite.yml index 59135cbea..48cbd7d12 100644 --- a/sample-cnfs/sample_coredns_values/cnf-testsuite.yml +++ b/sample-cnfs/sample_coredns_values/cnf-testsuite.yml @@ -1,7 +1,7 @@ --- -helm_directory: chart -release_name: coredns -helm_values: "--set image.tag=1.6.9" -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart + helm_values: --set image.tag=1.6.9 diff --git a/sample-cnfs/sample_envoy_slow_startup/cnf-testsuite.yml b/sample-cnfs/sample_envoy_slow_startup/cnf-testsuite.yml index 451548f34..6ad0b3c40 100644 --- a/sample-cnfs/sample_envoy_slow_startup/cnf-testsuite.yml +++ b/sample-cnfs/sample_envoy_slow_startup/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: envoy +config_version: v2 +deployments: + helm_dirs: + - name: envoy + helm_directory: chart diff --git a/sample-cnfs/sample_external_ips/cnf-testsuite.yml b/sample-cnfs/sample_external_ips/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample_external_ips/cnf-testsuite.yml +++ b/sample-cnfs/sample_external_ips/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample_good_signal_handling/cnf-testsuite.yml b/sample-cnfs/sample_good_signal_handling/cnf-testsuite.yml index 451548f34..6ad0b3c40 100644 --- a/sample-cnfs/sample_good_signal_handling/cnf-testsuite.yml +++ b/sample-cnfs/sample_good_signal_handling/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: envoy +config_version: v2 +deployments: + helm_dirs: + - name: envoy + helm_directory: chart diff --git a/sample-cnfs/sample_good_signal_handling_tini/cnf-testsuite.yml b/sample-cnfs/sample_good_signal_handling_tini/cnf-testsuite.yml index 5ad707c23..dedb55924 100644 --- a/sample-cnfs/sample_good_signal_handling_tini/cnf-testsuite.yml +++ b/sample-cnfs/sample_good_signal_handling_tini/cnf-testsuite.yml @@ -1,7 +1,9 @@ --- -release_name: jenkins -helm_repository: - name: jenkins - repo_url: https://charts.jenkins.io -helm_chart: jenkins/jenkins -helm_values: "--set controller.sidecars.configAutoReload.enabled=false" +config_version: v2 +deployments: + helm_charts: + - name: jenkins + helm_chart_name: jenkins/jenkins + helm_values: --set controller.sidecars.configAutoReload.enabled=false + helm_repo_name: jenkins + helm_repo_url: https://charts.jenkins.io diff --git a/sample-cnfs/sample_good_zombie_handling/cnf-testsuite.yml b/sample-cnfs/sample_good_zombie_handling/cnf-testsuite.yml index 451548f34..6ad0b3c40 100644 --- a/sample-cnfs/sample_good_zombie_handling/cnf-testsuite.yml +++ b/sample-cnfs/sample_good_zombie_handling/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: envoy +config_version: v2 +deployments: + helm_dirs: + - name: envoy + helm_directory: chart diff --git a/sample-cnfs/sample_hostport/cnf-testsuite.yml b/sample-cnfs/sample_hostport/cnf-testsuite.yml index f54caba50..ae5be025e 100644 --- a/sample-cnfs/sample_hostport/cnf-testsuite.yml +++ b/sample-cnfs/sample_hostport/cnf-testsuite.yml @@ -1,5 +1,6 @@ --- -helm_directory: chart -git_clone_url: -install_script: chart -release_name: unifi +config_version: v2 +deployments: + helm_dirs: + - name: unifi + helm_directory: chart diff --git a/sample-cnfs/sample_immutable_configmap_all/cnf-testsuite.yml b/sample-cnfs/sample_immutable_configmap_all/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_immutable_configmap_all/cnf-testsuite.yml +++ b/sample-cnfs/sample_immutable_configmap_all/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_immutable_configmap_all_plus_env/cnf-testsuite.yml b/sample-cnfs/sample_immutable_configmap_all_plus_env/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_immutable_configmap_all_plus_env/cnf-testsuite.yml +++ b/sample-cnfs/sample_immutable_configmap_all_plus_env/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_immutable_configmap_all_plus_env_but_fail/cnf-testsuite.yml b/sample-cnfs/sample_immutable_configmap_all_plus_env_but_fail/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_immutable_configmap_all_plus_env_but_fail/cnf-testsuite.yml +++ b/sample-cnfs/sample_immutable_configmap_all_plus_env_but_fail/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_immutable_configmap_some/cnf-testsuite.yml b/sample-cnfs/sample_immutable_configmap_some/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_immutable_configmap_some/cnf-testsuite.yml +++ b/sample-cnfs/sample_immutable_configmap_some/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_latest_tag/cnf-testsuite.yml b/sample-cnfs/sample_latest_tag/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample_latest_tag/cnf-testsuite.yml +++ b/sample-cnfs/sample_latest_tag/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample_local_registry/cnf-testsuite.yml b/sample-cnfs/sample_local_registry/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_local_registry/cnf-testsuite.yml +++ b/sample-cnfs/sample_local_registry/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_local_registry_org_image/cnf-testsuite.yml b/sample-cnfs/sample_local_registry_org_image/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_local_registry_org_image/cnf-testsuite.yml +++ b/sample-cnfs/sample_local_registry_org_image/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_local_registry_rolling/cnf-testsuite.yml b/sample-cnfs/sample_local_registry_rolling/cnf-testsuite.yml index acc179a44..4c1df508d 100644 --- a/sample-cnfs/sample_local_registry_rolling/cnf-testsuite.yml +++ b/sample-cnfs/sample_local_registry_rolling/cnf-testsuite.yml @@ -1,9 +1,13 @@ --- -helm_directory: chart -release_name: coredns -container_names: - - name: coredns - rolling_update_test_tag: "1.8.0" +config_version: v2 +common: + container_names: + - name: coredns + rollback_from_tag: 1.8.0 + rolling_update_test_tag: 1.8.0 rolling_downgrade_test_tag: 1.6.7 rolling_version_change_test_tag: 1.8.0 - rollback_from_tag: 1.8.0 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_network_loss/cnf-testsuite.yml b/sample-cnfs/sample_network_loss/cnf-testsuite.yml index c77d8f06f..65738a52a 100644 --- a/sample-cnfs/sample_network_loss/cnf-testsuite.yml +++ b/sample-cnfs/sample_network_loss/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: coredns +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_no_logs/cnf-testsuite.yml b/sample-cnfs/sample_no_logs/cnf-testsuite.yml index bbdf6d26d..51aa1c229 100644 --- a/sample-cnfs/sample_no_logs/cnf-testsuite.yml +++ b/sample-cnfs/sample_no_logs/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: python-http-server -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: python-http-server + manifest_directory: manifests diff --git a/sample-cnfs/sample_nodeport/cnf-testsuite.yml b/sample-cnfs/sample_nodeport/cnf-testsuite.yml index f54caba50..ae5be025e 100644 --- a/sample-cnfs/sample_nodeport/cnf-testsuite.yml +++ b/sample-cnfs/sample_nodeport/cnf-testsuite.yml @@ -1,5 +1,6 @@ --- -helm_directory: chart -git_clone_url: -install_script: chart -release_name: unifi +config_version: v2 +deployments: + helm_dirs: + - name: unifi + helm_directory: chart diff --git a/sample-cnfs/sample_nonroot/cnf-testsuite.yml b/sample-cnfs/sample_nonroot/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample_nonroot/cnf-testsuite.yml +++ b/sample-cnfs/sample_nonroot/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample_open5gs/cnf-testsuite.yml b/sample-cnfs/sample_open5gs/cnf-testsuite.yml index f74fe81bb..a1b619e90 100644 --- a/sample-cnfs/sample_open5gs/cnf-testsuite.yml +++ b/sample-cnfs/sample_open5gs/cnf-testsuite.yml @@ -1,27 +1,31 @@ --- -helm_directory: open5gs -release_name: open5gs -helm_install_namespace: testsuite-5g -#optional 5gcore tag -amf_label: app.kubernetes.io/name=amf -smf_label: app.kubernetes.io/name=smf -upf_label: app.kubernetes.io/name=upf -amf_service_name: open5gs-amf-ngap -mmc: '999' -mnc: '70' -sst: 1 -sd: '0x111111' -tac: '0001' -protectionScheme: 1 -publicKey: 0ac95ceeb93308df01be82ff9994d8330e38804ece1700ee4b972d8028796275 -publicKeyId: 1 -routingIndicator: '0000' -enabled: true -count: 1 -initialMSISDN: '0000000001' -key: 465B5CE8B199B49FAA5F0A2EE238A6BC -op: E8ED289DEBA952E4283B54E88E6183CA -opType: OPC -type: 'IPv4' -apn: 'internet' -emergency: false +config_version: v2 +common: + five_g_parameters: + amf_label: app.kubernetes.io/name=amf + smf_label: app.kubernetes.io/name=smf + upf_label: app.kubernetes.io/name=upf + amf_service_name: open5gs-amf-ngap + mmc: "999" + mnc: "70" + sst: "1" + sd: "0x111111" + tac: "0001" + protectionScheme: "1" + publicKey: 0ac95ceeb93308df01be82ff9994d8330e38804ece1700ee4b972d8028796275 + publicKeyId: "1" + routingIndicator: "0000" + enabled: "true" + count: "1" + initialMSISDN: "0000000001" + key: 465B5CE8B199B49FAA5F0A2EE238A6BC + op: E8ED289DEBA952E4283B54E88E6183CA + opType: OPC + type: IPv4 + apn: internet + emergency: "false" +deployments: + helm_dirs: + - name: open5gs + helm_directory: open5gs + namespace: testsuite-5g diff --git a/sample-cnfs/sample_open5gs_no_auth/cnf-testsuite.yml b/sample-cnfs/sample_open5gs_no_auth/cnf-testsuite.yml index 3615cfee2..386fa02e2 100644 --- a/sample-cnfs/sample_open5gs_no_auth/cnf-testsuite.yml +++ b/sample-cnfs/sample_open5gs_no_auth/cnf-testsuite.yml @@ -1,24 +1,28 @@ --- -helm_directory: open5gs -release_name: open5gs -#optional 5gcore tag -amf_label: app.kubernetes.io/name=amf -amf_service_name: open5gs-amf-ngap -mmc: '999' -mnc: '70' -sst: 1 -sd: '0x111111' -tac: '0001' -# protectionScheme: 1 -# publicKey: 0ac95ceeb93308df01be82ff9994d8330e38804ece1700ee4b972d8028796275 -# publicKeyId: 1 -# routingIndicator: '0000' -enabled: true -count: 1 -initialMSISDN: '0000000001' -key: 465B5CE8B199B49FAA5F0A2EE238A6BC -op: E8ED289DEBA952E4283B54E88E6183CA -opType: OPC -type: 'IPv4' -apn: 'internet' -emergency: false +config_version: v2 +common: + five_g_parameters: + amf_label: app.kubernetes.io/name=amf + amf_service_name: open5gs-amf-ngap + mmc: "999" + mnc: "70" + sst: "1" + sd: "0x111111" + tac: "0001" + enabled: "true" + count: "1" + initialMSISDN: "0000000001" + # protectionScheme: 1 + # publicKey: 0ac95ceeb93308df01be82ff9994d8330e38804ece1700ee4b972d8028796275 + # publicKeyId: 1 + # routingIndicator: '0000' + key: 465B5CE8B199B49FAA5F0A2EE238A6BC + op: E8ED289DEBA952E4283B54E88E6183CA + opType: OPC + type: IPv4 + apn: internet + emergency: "false" +deployments: + helm_dirs: + - name: open5gs + helm_directory: open5gs diff --git a/sample-cnfs/sample_operator/cnf-testsuite.yml b/sample-cnfs/sample_operator/cnf-testsuite.yml index ab73fef5e..65738a52a 100644 --- a/sample-cnfs/sample_operator/cnf-testsuite.yml +++ b/sample-cnfs/sample_operator/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable +config_version: v2 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_privileged_cnf/cnf-testsuite.yml b/sample-cnfs/sample_privileged_cnf/cnf-testsuite.yml index f94fc524f..30cd2006d 100644 --- a/sample-cnfs/sample_privileged_cnf/cnf-testsuite.yml +++ b/sample-cnfs/sample_privileged_cnf/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: chart -release_name: privileged-coredns +config_version: v2 +deployments: + helm_dirs: + - name: privileged-coredns + helm_directory: chart diff --git a/sample-cnfs/sample_rolling/cnf-testsuite.yml b/sample-cnfs/sample_rolling/cnf-testsuite.yml index aaa522298..4c1df508d 100644 --- a/sample-cnfs/sample_rolling/cnf-testsuite.yml +++ b/sample-cnfs/sample_rolling/cnf-testsuite.yml @@ -1,12 +1,13 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -container_names: - - name: coredns - rolling_update_test_tag: "1.8.0" +config_version: v2 +common: + container_names: + - name: coredns + rollback_from_tag: 1.8.0 + rolling_update_test_tag: 1.8.0 rolling_downgrade_test_tag: 1.6.7 rolling_version_change_test_tag: 1.8.0 - rollback_from_tag: 1.8.0 +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_rolling_invalid_version/cnf-testsuite.yml b/sample-cnfs/sample_rolling_invalid_version/cnf-testsuite.yml index ed6524bdf..9116ed2ad 100644 --- a/sample-cnfs/sample_rolling_invalid_version/cnf-testsuite.yml +++ b/sample-cnfs/sample_rolling_invalid_version/cnf-testsuite.yml @@ -1,9 +1,10 @@ --- -helm_directory: chart -release_name: coredns -helm_repository: - name: stable - repo_url: https://cncf.gitlab.io/stable -container_names: - - name: coredns - rolling_update_test_tag: "this_is_not_a_valid_version" +config_version: v2 +common: + container_names: + - name: coredns + rolling_update_test_tag: this_is_not_a_valid_version +deployments: + helm_dirs: + - name: coredns + helm_directory: chart diff --git a/sample-cnfs/sample_secret_env/cnf-testsuite.yml b/sample-cnfs/sample_secret_env/cnf-testsuite.yml index fd532eaac..55b7ad6b4 100644 --- a/sample-cnfs/sample_secret_env/cnf-testsuite.yml +++ b/sample-cnfs/sample_secret_env/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: postgresql -release_name: postgresql +config_version: v2 +deployments: + helm_dirs: + - name: postgresql + helm_directory: postgresql diff --git a/sample-cnfs/sample_secret_env_no_ref/cnf-testsuite.yml b/sample-cnfs/sample_secret_env_no_ref/cnf-testsuite.yml index fd532eaac..55b7ad6b4 100644 --- a/sample-cnfs/sample_secret_env_no_ref/cnf-testsuite.yml +++ b/sample-cnfs/sample_secret_env_no_ref/cnf-testsuite.yml @@ -1,3 +1,6 @@ --- -helm_directory: postgresql -release_name: postgresql +config_version: v2 +deployments: + helm_dirs: + - name: postgresql + helm_directory: postgresql diff --git a/sample-cnfs/sample_secret_volume/cnf-testsuite.yml b/sample-cnfs/sample_secret_volume/cnf-testsuite.yml index e39401050..55b7ad6b4 100644 --- a/sample-cnfs/sample_secret_volume/cnf-testsuite.yml +++ b/sample-cnfs/sample_secret_volume/cnf-testsuite.yml @@ -1,5 +1,6 @@ --- -helm_directory: postgresql -git_clone_url: -install_script: chart -release_name: postgresql +config_version: v2 +deployments: + helm_dirs: + - name: postgresql + helm_directory: postgresql diff --git a/sample-cnfs/sample_srsran_ueauth_open5gs/cnf-testsuite.yml b/sample-cnfs/sample_srsran_ueauth_open5gs/cnf-testsuite.yml index 84eeeb41b..a560b374b 100644 --- a/sample-cnfs/sample_srsran_ueauth_open5gs/cnf-testsuite.yml +++ b/sample-cnfs/sample_srsran_ueauth_open5gs/cnf-testsuite.yml @@ -1,25 +1,29 @@ --- -helm_directory: open5gs -release_name: open5gs -helm_install_namespace: oran -#optional 5gcore tag -core: app.kubernetes.io/name=amf -amf_service_name: open5gs-amf-ngap -mmc: '999' -mnc: '70' -sst: 1 -sd: '0x111111' -tac: '0001' -protectionScheme: 1 -publicKey: 0ac95ceeb93308df01be82ff9994d8330e38804ece1700ee4b972d8028796275 -publicKeyId: 1 -routingIndicator: '0000' -enabled: true -count: 1 -initialMSISDN: '0000000001' -key: 465B5CE8B199B49FAA5F0A2EE238A6BC -op: E8ED289DEBA952E4283B54E88E6183CA -opType: OPC -type: 'IPv4' -apn: 'internet' -emergency: false +config_version: v2 +common: + five_g_parameters: + amf_label: app.kubernetes.io/name=amf + amf_service_name: open5gs-amf-ngap + mmc: "999" + mnc: "70" + sst: "1" + sd: "0x111111" + tac: "0001" + protectionScheme: "1" + publicKey: 0ac95ceeb93308df01be82ff9994d8330e38804ece1700ee4b972d8028796275 + publicKeyId: "1" + routingIndicator: "0000" + enabled: "true" + count: "1" + initialMSISDN: "0000000001" + key: 465B5CE8B199B49FAA5F0A2EE238A6BC + op: E8ED289DEBA952E4283B54E88E6183CA + opType: OPC + type: IPv4 + apn: internet + emergency: "false" +deployments: + helm_dirs: + - name: open5gs + helm_directory: open5gs + namespace: oran diff --git a/sample-cnfs/sample_sysctls/cnf-testsuite.yml b/sample-cnfs/sample_sysctls/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample_sysctls/cnf-testsuite.yml +++ b/sample-cnfs/sample_sysctls/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample_unmounted_secret_volume/cnf-testsuite.yml b/sample-cnfs/sample_unmounted_secret_volume/cnf-testsuite.yml index e39401050..55b7ad6b4 100644 --- a/sample-cnfs/sample_unmounted_secret_volume/cnf-testsuite.yml +++ b/sample-cnfs/sample_unmounted_secret_volume/cnf-testsuite.yml @@ -1,5 +1,6 @@ --- -helm_directory: postgresql -git_clone_url: -install_script: chart -release_name: postgresql +config_version: v2 +deployments: + helm_dirs: + - name: postgresql + helm_directory: postgresql diff --git a/sample-cnfs/sample_valid_selinux_options/cnf-testsuite.yml b/sample-cnfs/sample_valid_selinux_options/cnf-testsuite.yml index 8e302db81..9c1847713 100644 --- a/sample-cnfs/sample_valid_selinux_options/cnf-testsuite.yml +++ b/sample-cnfs/sample_valid_selinux_options/cnf-testsuite.yml @@ -1,6 +1,6 @@ --- -manifest_directory: manifests -release_name: nginx -helm_repository: - name: - repo_url: +config_version: v2 +deployments: + manifests: + - name: nginx + manifest_directory: manifests diff --git a/sample-cnfs/sample_whitelisted_privileged_cnf/cnf-testsuite.yml b/sample-cnfs/sample_whitelisted_privileged_cnf/cnf-testsuite.yml index b8cf1b853..a9f357c9d 100644 --- a/sample-cnfs/sample_whitelisted_privileged_cnf/cnf-testsuite.yml +++ b/sample-cnfs/sample_whitelisted_privileged_cnf/cnf-testsuite.yml @@ -1,4 +1,9 @@ --- -helm_directory: chart -release_name: privileged-coredns -allowlist_helm_chart_container_names: [coredns] +config_version: v2 +common: + white_list_container_names: + - coredns +deployments: + helm_dirs: + - name: privileged-coredns + helm_directory: chart diff --git a/spec/setup_spec.cr b/spec/setup_spec.cr index 4bd4de634..ad9e7a935 100644 --- a/spec/setup_spec.cr +++ b/spec/setup_spec.cr @@ -19,51 +19,6 @@ describe "Setup" do (/Setup complete/ =~ result[:output]).should_not be_nil end - it "'generate_config' should generate a cnf-testsuite.yml for a helm chart", tags: ["setup-generate"] do - result = ShellCmd.run_testsuite("setup") - result = ShellCmd.run_testsuite("generate_config config-src=stable/coredns output-file=./cnf-testsuite-test.yml") - result[:status].success?.should be_true - - yaml = File.open("./cnf-testsuite-test.yml") do |file| - YAML.parse(file) - end - Log.debug { "test yaml: #{yaml}" } - result = ShellCmd.run("cat ./cnf-testsuite-test.yml", force_output: true) - (yaml["helm_chart"] == "stable/coredns").should be_true - ensure - result = ShellCmd.run("rm ./cnf-testsuite-test.yml", force_output: true) - end - - it "'generate_config' should generate a cnf-testsuite.yml for a helm directory", tags: ["setup-generate"] do - result = ShellCmd.run_testsuite("setup") - result = ShellCmd.run_testsuite("generate_config config-src=sample-cnfs/k8s-sidecar-container-pattern/chart output-file=./cnf-testsuite-test.yml") - result[:status].success?.should be_true - - yaml = File.open("./cnf-testsuite-test.yml") do |file| - YAML.parse(file) - end - Log.debug { "test yaml: #{yaml}" } - result = ShellCmd.run("cat ./cnf-testsuite-test.yml", force_output: true) - (yaml["helm_directory"] == "sample-cnfs/k8s-sidecar-container-pattern/chart").should be_true - ensure - result = ShellCmd.run("rm ./cnf-testsuite-test.yml", force_output: true) - end - - it "'generate_config' should generate a cnf-testsuite.yml for a manifest directory", tags: ["setup-generate"] do - result = ShellCmd.run_testsuite("setup") - result = ShellCmd.run_testsuite("generate_config config-src=sample-cnfs/k8s-non-helm/manifests output-file=./cnf-testsuite-test.yml") - result[:status].success?.should be_true - - yaml = File.open("./cnf-testsuite-test.yml") do |file| - YAML.parse(file) - end - Log.debug { "test yaml: #{yaml}" } - result = ShellCmd.run("cat ./cnf-testsuite-test.yml", force_output: true) - (yaml["manifest_directory"] == "sample-cnfs/k8s-non-helm/manifests").should be_true - ensure - result = ShellCmd.run("rm ./cnf-testsuite-test.yml", force_output: true) - end - it "'cnf_setup/cnf_cleanup' should install/cleanup with cnf-path arg as alias for cnf-config", tags: ["setup"] do begin result = ShellCmd.cnf_setup("cnf-path=example-cnfs/coredns/cnf-testsuite.yml") @@ -109,4 +64,16 @@ describe "Setup" do (/Successfully cleaned up/ =~ result[:output]).should_not be_nil end end + + it "'cnf_setup/cnf_cleanup' should properly install/uninstall old versions of cnf configs", tags: ["setup"] do + begin + result = ShellCmd.cnf_setup("cnf-path=embedded_files/cnf-testsuite-v1-example.yml") + result[:status].success?.should be_true + (/Successfully setup coredns/ =~ result[:output]).should_not be_nil + ensure + result = ShellCmd.run_testsuite("cnf_cleanup cnf-path=embedded_files/cnf-testsuite-v1-example.yml") + result[:status].success?.should be_true + (/Successfully cleaned up/ =~ result[:output]).should_not be_nil + end + end end diff --git a/spec/utils/cnf_install/install_common_spec.cr b/spec/utils/cnf_install/install_common_spec.cr deleted file mode 100644 index 14ad8aa1e..000000000 --- a/spec/utils/cnf_install/install_common_spec.cr +++ /dev/null @@ -1,7 +0,0 @@ -require "../../spec_helper" - -it "'CNFInstall.exclusive_install_method_tags' should return false if install method tags are not exclusive", tags: ["cnf-config"] do - config = CNFManager.parsed_config_file("./spec/fixtures/cnf-testsuite-not-exclusive.yml") - resp = CNFInstall.exclusive_install_method_tags?(config) - (resp).should be_false -end \ No newline at end of file diff --git a/spec/utils/cnf_manager_spec.cr b/spec/utils/cnf_manager_spec.cr index 759ea53c5..1416503aa 100644 --- a/spec/utils/cnf_manager_spec.cr +++ b/spec/utils/cnf_manager_spec.cr @@ -24,11 +24,6 @@ describe "SampleUtils" do result[:status].success?.should be_true end - it "'images_from_config_src' should return a list of containers for a cnf", tags: ["cnf-setup"] do - (CNFManager::GenerateConfig.images_from_config_src("stable/coredns").find {|x| x[:image_name] =="coredns/coredns" && - x[:container_name] =="coredns"}).should be_truthy - end - it "'cnf_setup' should pass with a minimal cnf-testsuite.yml", tags: ["cnf-setup"] do ShellCmd.cnf_setup("cnf-path=./sample-cnfs/sample-minimal-cnf/ skip_wait_for_install") ensure @@ -161,8 +156,8 @@ describe "SampleUtils" do args = Sam::Args.new(["cnf-config=./sample-cnfs/sample-generic-cnf/cnf-testsuite.yml", "verbose"]) cli_hash = CNFManager.sample_setup_cli_args(args) CNFManager.sample_setup(cli_hash) - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(cli_hash[:config_file])) - release_name = config.cnf_config[:release_name] + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(cli_hash[:config_file])) + release_name = config.deployments.get_deployment_param(:name) (Dir.exists? "cnfs/#{release_name}").should be_true (File.exists?("cnfs/#{release_name}/cnf-testsuite.yml")).should be_true @@ -177,8 +172,8 @@ describe "SampleUtils" do cli_hash = CNFManager.sample_setup_cli_args(args) CNFManager.sample_setup(cli_hash) # check if directory exists - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - release_name = config.cnf_config[:release_name] + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) + release_name = config.deployments.get_deployment_param(:name) (Dir.exists? "cnfs/#{release_name}").should be_true (File.exists?("cnfs/#{release_name}/cnf-testsuite.yml")).should be_true @@ -193,8 +188,8 @@ describe "SampleUtils" do cli_hash = CNFManager.sample_setup_cli_args(args) CNFManager.sample_setup(cli_hash) # check if directory exists - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - release_name = config.cnf_config[:release_name] + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) + release_name = config.deployments.get_deployment_param(:name) (Dir.exists? "cnfs/#{release_name}").should be_true (File.exists?("cnfs/#{release_name}/cnf-testsuite.yml")).should be_true CNFManager.sample_cleanup(config_file: "sample-cnfs/sample-generic-cnf", verbose: true) @@ -207,8 +202,8 @@ describe "SampleUtils" do cli_hash = CNFManager.sample_setup_cli_args(args) CNFManager.sample_setup(cli_hash) # check if directory exists - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - release_name = config.cnf_config[:release_name] + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) + release_name = config.deployments.get_deployment_param(:name) (Dir.exists? "sample-cnfs/sample-generic-cnf").should be_true (File.exists?("cnfs/#{release_name}/cnf-testsuite.yml")).should be_true CNFManager.sample_cleanup(config_file: "sample-cnfs/sample-generic-cnf", verbose: true) @@ -231,8 +226,8 @@ describe "SampleUtils" do args = Sam::Args.new(["cnf-config=./#{config_file}/cnf-testsuite.yml", "verbose", "skip_wait_for_install"]) cli_hash = CNFManager.sample_setup_cli_args(args) CNFManager.sample_setup(cli_hash) - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - release_name = config.cnf_config[:release_name] + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) + release_name = config.deployments.get_deployment_param(:name) (Dir.exists? "cnfs/#{release_name}").should be_true # should not clone (Dir.exists? "cnfs/#{release_name}/privileged-coredns").should be_false @@ -249,8 +244,8 @@ describe "SampleUtils" do Log.info { "Running Setup" } CNFManager.sample_setup(cli_hash) Log.info { "Parse Config" } - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - release_name = config.cnf_config[:release_name] + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) + release_name = config.deployments.get_deployment_param(:name) (Dir.exists? "cnfs/#{release_name}").should be_true (Dir.exists? "cnfs/#{release_name}/manifests").should be_true (File.exists? "cnfs/#{release_name}/cnf-testsuite.yml").should be_true @@ -261,11 +256,6 @@ describe "SampleUtils" do (Dir.exists? "cnfs/#{release_name}").should be_false end - it "'cnf_destination_dir' should return the full path of the potential destination cnf directory based on the deployment name", tags: "WIP" do - args = Sam::Args.new - CNFManager.cnf_destination_dir("spec/fixtures/cnf-testsuite.yml").should contain("/cnfs/coredns") - end - it "'CNFManager.cnf_config_list' should return a list of all of the config files from the cnf directory", tags: ["cnf-setup"] do config_file = "sample-cnfs/sample-generic-cnf" args = Sam::Args.new(["cnf-config=./#{config_file}/cnf-testsuite.yml", "verbose", "skip_wait_for_install"]) @@ -274,8 +264,8 @@ describe "SampleUtils" do args = Sam::Args.new(["cnf-config=./sample-cnfs/sample_privileged_cnf/cnf-testsuite.yml", "verbose"]) cli_hash = CNFManager.sample_setup_cli_args(args) CNFManager.sample_setup(cli_hash) - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - release_name = config.cnf_config[:release_name] + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) + release_name = CNFInstall::Config.parse_cnf_config_from_file CNFManager.cnf_config_list()[0].should contain("#{release_name}/#{CONFIG_FILE}") end @@ -291,80 +281,45 @@ describe "SampleUtils" do CNFManager.helm_repo_add("invalid", "invalid").should eq(false) end - it "'CNFManager.validate_cnf_testsuite_yml' (function) should pass, when a cnf has a valid config file yml", tags: ["validate_config"] do - args = Sam::Args.new(["cnf-config=sample-cnfs/sample-coredns-cnf/cnf-testsuite.yml"]) - - yml = CNFManager.parsed_config_file(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) - Log.info { yml.inspect } - ("#{yml.get("release_name").as_s?}").should eq("coredns") - - valid, command_output = CNFManager.validate_cnf_testsuite_yml(yml) - - (valid).should eq(true) - (command_output).should eq (nil) - end - - it "'CNFManager.validate_cnf_testsuite_yml' (command) should pass, when a cnf has a valid config file yml", tags: ["validate_config"] do - result = ShellCmd.run_testsuite("validate_config cnf-config=sample-cnfs/sample-coredns-cnf/cnf-testsuite.yml") - result[:status].success?.should be_true - (/CNF configuration validated/ =~ result[:output]).should_not be_nil - end - - - it "'CNFManager.validate_cnf_testsuite_yml' (function) should warn, but be valid when a cnf config file yml has fields that are not a part of the validation type", tags: ["validate_config"] do - args = Sam::Args.new(["cnf-config=./spec/fixtures/cnf-testsuite-unmapped-keys-and-subkeys.yml"]) - - yml = CNFManager.parsed_config_file(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) - Log.info { yml.inspect } - ("#{yml.get("release_name").as_s?}").should eq("coredns") - - status, warning_output = CNFManager.validate_cnf_testsuite_yml(yml) - - Log.warn { "WARNING: #{warning_output}" } - - (status).should eq(true) - (warning_output).should_not be_nil - end - - - it "'CNFManager.validate_cnf_testsuite_yml' (command) should warn, but be valid when a cnf config file yml has fields that are not a part of the validation type", tags: ["validate_config"] do - result = ShellCmd.run_testsuite("validate_config cnf-config=spec/fixtures/cnf-testsuite-unmapped-keys-and-subkeys.yml") + it "'validate_config' should pass, when a cnf has a valid config file yml", tags: ["validate_config"] do + result = ShellCmd.run_testsuite("validate_config cnf-config=embedded_files/cnf-testsuite-v2-example.yml") result[:status].success?.should be_true - Log.debug { "validate_config resp: #{result[:output]}" } - (/CNF configuration validated/ =~ result[:output]).should_not be_nil + (/Successfully validated CNF config/ =~ result[:output]).should_not be_nil end - - it "'CNFManager.validate_cnf_testsuite_yml' (command) should pass, for all sample-cnfs", tags: ["validate_config"] do + it "'validate_config' should pass, for all sample-cnfs", tags: ["validate_config"] do get_dirs = Dir.entries("sample-cnfs") dir_list = get_dirs - [".", ".."] dir_list.each do |dir| testsuite_yml = "sample-cnfs/#{dir}/cnf-testsuite.yml" result = ShellCmd.run_testsuite("validate_config cnf-config=#{testsuite_yml}") - (/CNF configuration validated/ =~ result[:output]).should_not be_nil + unless result[:status].success? + Log.info {"Could not validate config: #{testsuite_yml}"} + end + (/Successfully validated CNF config/ =~ result[:output]).should_not be_nil end end - it "'CNFManager.validate_cnf_testsuite_yml' (command) should pass, for all example-cnfs", tags: ["validate_config"] do + it "'validate_config' should pass, for all example-cnfs", tags: ["validate_config"] do get_dirs = Dir.entries("example-cnfs") dir_list = get_dirs - [".", ".."] dir_list.each do |dir| testsuite_yml = "example-cnfs/#{dir}/cnf-testsuite.yml" result = ShellCmd.run_testsuite("validate_config cnf-config=#{testsuite_yml}") - if (/Critical Error with CNF Configuration. Please review USAGE.md for steps to set up a valid CNF configuration file/ =~ result[:output]) - Log.info { "\n #{testsuite_yml}: #{result[:output]}" } + unless result[:status].success? + Log.info {"Could not validate config: #{testsuite_yml}"} end - (/CNF configuration validated/ =~ result[:output]).should_not be_nil + (/Successfully validated CNF config/ =~ result[:output]).should_not be_nil end end - it "'CNFManager::Config#parse_config_yml' should return a populated CNFManager::Config.cnf_config", tags: ["cnf-config"] do + it "'CNFInstall::Config.parse_cnf_config_from_file' should return a populated CNFInstall::Config::Config", tags: ["cnf-config"] do begin - yaml = CNFManager::Config.parse_config_yml("spec/fixtures/cnf-testsuite.yml") - (yaml.cnf_config[:release_name]).should eq("coredns") + config = CNFInstall::Config.parse_cnf_config_from_file("spec/fixtures/cnf-testsuite.yml") + (config.deployments.get_deployment_param(:name)).should eq("coredns") ensure end end @@ -373,7 +328,7 @@ describe "SampleUtils" do args = Sam::Args.new(["cnf-config=./sample-cnfs/sample-generic-cnf/cnf-testsuite.yml"]) cli_hash = CNFManager.sample_setup_cli_args(args, false) CNFManager.sample_setup(cli_hash) if cli_hash["config_file"] - config = CNFManager::Config.parse_config_yml("./sample-cnfs/sample-generic-cnf/cnf-testsuite.yml") + config = CNFInstall::Config.parse_cnf_config_from_file("./sample-cnfs/sample-generic-cnf/cnf-testsuite.yml") task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| test_passed = true begin diff --git a/spec/utils/utils_spec.cr b/spec/utils/utils_spec.cr index 94ef6583c..a7e09c90f 100644 --- a/spec/utils/utils_spec.cr +++ b/spec/utils/utils_spec.cr @@ -84,7 +84,7 @@ describe "Utils" do Log.info { "single_task_runner spec args #{args.inspect}" } - white_list_container_names = config.cnf_config[:white_list_container_names] + white_list_container_names = config.common.white_list_container_names Log.info { "white_list_container_names #{white_list_container_names.inspect}" } violation_list = [] of String resource_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| @@ -123,8 +123,8 @@ describe "Utils" do task_response = CNFManager::Task.single_task_runner(args) do cdir = FileUtils.pwd() response = String::Builder.new - config = CNFManager.parsed_config_file(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) - helm_directory = "#{config.get("helm_directory").as_s?}" + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) + helm_directory = config.deployments.get_deployment_param(:helm_directory) if File.directory?(CNFManager.ensure_cnf_testsuite_dir(args.named["cnf-config"].as(String)) + helm_directory) Dir.cd(CNFManager.ensure_cnf_testsuite_dir(args.named["cnf-config"].as(String)) + helm_directory) Process.run("grep -r -P '^(?!.+0\.0\.0\.0)(?![[:space:]]*0\.0\.0\.0)(?!#)(?![[:space:]]*#)(?!\/\/)(?![[:space:]]*\/\/)(?!\/\\*)(?![[:space:]]*\/\\*)(.+([0-9]{1,3}[\.]){3}[0-9]{1,3})'", shell: true) do |proc| @@ -157,7 +157,7 @@ describe "Utils" do task_response = CNFManager::Task.all_cnfs_task_runner(my_args) do |args, config| Log.info { "all_cnfs_task_runner spec args #{args.inspect}" } Log.for("verbose").info { "privileged_containers" } if check_verbose(args) - white_list_container_names = config.cnf_config[:white_list_container_names] + white_list_container_names = config.common.white_list_container_names Log.for("verbose").info { "white_list_container_names #{white_list_container_names.inspect}" } if check_verbose(args) violation_list = [] of String resource_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| diff --git a/src/tasks/cleanup.cr b/src/tasks/cleanup.cr index d03e87c3c..b639b72eb 100644 --- a/src/tasks/cleanup.cr +++ b/src/tasks/cleanup.cr @@ -23,8 +23,8 @@ task "samples_cleanup" do |_, args| cnf_config_file = task_args["cnf-config"].as(String) cnf_config_file = CNFManager.ensure_cnf_testsuite_yml_path(cnf_config_file) - config = CNFManager.parsed_config_file(cnf_config_file) - install_method = CNFInstall.cnf_installation_method(config) + config = CNFInstall::Config.parse_cnf_config_from_file(cnf_config_file) + install_method = config.dynamic.install_method if install_method[0] == CNFInstall::InstallMethod::ManifestDirectory installed_from_manifest = true else diff --git a/src/tasks/cnf_setup.cr b/src/tasks/cnf_setup.cr index f372e4fc8..a62ceb363 100644 --- a/src/tasks/cnf_setup.cr +++ b/src/tasks/cnf_setup.cr @@ -38,8 +38,8 @@ task "cnf_cleanup" do |_, args| else force = false end - config = CNFManager.parsed_config_file(CNFManager.ensure_cnf_testsuite_yml_path(cnf)) - install_method = CNFInstall.cnf_installation_method(config) + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(cnf)) + install_method = config.dynamic.install_method if install_method[0] == CNFInstall::InstallMethod::ManifestDirectory installed_from_manifest = true else @@ -60,24 +60,6 @@ task "CNFManager.helm_repo_add" do |_, args| end task "generate_config" do |_, args| - Log.for("verbose").info { "CNFManager.generate_config" } if check_verbose(args) - Log.for("verbose").debug { "args = #{args.inspect}" } if check_verbose(args) - if args.named["config-src"]? - config_src = args.named["config-src"].as(String) - output_file = args.named["output-file"].as(String) if args.named["output-file"]? - output_file = args.named["of"].as(String) if args.named["of"]? - if output_file && !output_file.empty? - Log.info { "generating config with an output file" } - CNFManager::GenerateConfig.generate_config(config_src, output_file) - else - Log.info { "generating config without an output file" } - CNFManager::GenerateConfig.generate_config(config_src) - end - end - -end - -task "generate_v2_config" do |_, args| interactively_create_config() end @@ -106,7 +88,7 @@ task "sample_generic_cnf_cleanup" do |_, args| end def interactively_create_config - config = { + new_config = { config_version: CNFInstall::Config::ConfigVersion::Latest.to_s, deployments: { helm_charts: [] of Hash(String, String), @@ -132,19 +114,19 @@ def interactively_create_config "helm_chart_name" => prompt("Enter Helm chart name: ") } helm_chart["helm_chart_name"] = helm_chart["helm_repo_name"] + "/" + helm_chart["helm_chart_name"] - config[:deployments][:helm_charts] << helm_chart + new_config[:deployments][:helm_charts] << helm_chart when "2" helm_dir = { "name" => prompt("Enter deployment name: "), "helm_directory" => prompt("Enter path to directory with Chart.yaml: ") } - config[:deployments][:helm_dirs] << helm_dir + new_config[:deployments][:helm_dirs] << helm_dir when "3" manifest = { "name" => prompt("Enter deployment name: "), "manifest_directory" => prompt("Enter path to directory with manifest files: ") } - config[:deployments][:manifests] << manifest + new_config[:deployments][:manifests] << manifest when "4" break else @@ -152,7 +134,7 @@ def interactively_create_config end end - yaml_config = config.to_yaml + yaml_config = new_config.to_yaml puts "Generated Configuration:" puts yaml_config diff --git a/src/tasks/constants.cr b/src/tasks/constants.cr index bb90f2f4b..77c317049 100644 --- a/src/tasks/constants.cr +++ b/src/tasks/constants.cr @@ -21,6 +21,7 @@ IGNORED_SECRET_TYPES = ["kubernetes.io/service-account-token", "kubernetes.io/do EMPTY_JSON = JSON.parse(%({})) EMPTY_JSON_ARRAY = JSON.parse(%([])) SPECIALIZED_INIT_SYSTEMS = ["tini", "dumb-init", "s6-svscan"] +ROLLING_VERSION_CHANGE_TEST_NAMES = ["rolling_update", "rolling_downgrade", "rolling_version_change"] TESTSUITE_NAMESPACE = "cnf-testsuite" DEFAULT_CNF_NAMESPACE = "cnf-default" diff --git a/src/tasks/setup.cr b/src/tasks/setup.cr index d819a7e19..9a14fb222 100644 --- a/src/tasks/setup.cr +++ b/src/tasks/setup.cr @@ -25,11 +25,13 @@ task "configuration_file_setup" do |_, args| CNFManager::Points.create_points_yml end -task "test_config" do |_, args| - if args.named["cfg"]? - puts CNFInstall::Config.parse_cnf_config_from_file(args.named["cfg"].to_s).inspect +task "validate_config" do |_, args| + if args.named["cnf-config"]? + config = CNFInstall::Config.parse_cnf_config_from_file(args.named["cnf-config"].to_s) + puts "Successfully validated CNF config" + Log.info {"Config: #{config.inspect}"} else - stdout_failure "cfg parameter needed" + stdout_failure "cnf-config parameter needed" exit 1 end end diff --git a/src/tasks/ueransim_setup.cr b/src/tasks/ueransim_setup.cr index f5c295e41..3fbfcef99 100644 --- a/src/tasks/ueransim_setup.cr +++ b/src/tasks/ueransim_setup.cr @@ -8,7 +8,7 @@ task "install_ueransim" do |_, args| Log.info {"UERANSIM Setup"} if args["cnf-config"]? cnf_config_file = args["cnf-config"].as(String) - config = CNFManager::Config.parse_config_yml(cnf_config_file) + config = CNFInstall::Config.parse_cnf_config_from_file(cnf_config_file) UERANSIM.install(config) else puts "you must provide a cnf-testsuite.yml".colorize(:red) diff --git a/src/tasks/utils/cnf_installation/config.cr b/src/tasks/utils/cnf_installation/config.cr index 8a192131c..04a2fb651 100644 --- a/src/tasks/utils/cnf_installation/config.cr +++ b/src/tasks/utils/cnf_installation/config.cr @@ -22,6 +22,12 @@ module CNFInstall end def self.parse_cnf_config_from_yaml(yaml_content, config_dir) + if !config_version_is_latest?(yaml_content) + Log.warn {"CNF config version is not latest, transforming before parse. Consider updating the CNF config with 'update_config' task."} + updater = CNFInstall::Config::ConfigUpdater.new(yaml_content) + updater.transform + yaml_content = updater.serialize_to_string + end config = Config.from_yaml(yaml_content) config.dynamic.initialize_dynamic_properties(config, config_dir) @@ -49,5 +55,24 @@ module CNFInstall def self.config_version_is_latest?(tmp_content : String) : Bool detect_version(tmp_content) == ConfigVersion::Latest end + + def self.get_manifest_file_path(config) + destination_cnf_dir = config.dynamic.destination_cnf_dir + manifest_file_path = destination_cnf_dir + "/" + "temp_template.yml" + end + + def self.get_helm_chart_path(config) + helm_directory = config.deployments.get_deployment_param(:helm_directory) + destination_cnf_dir = config.dynamic.destination_cnf_dir + if helm_directory.empty? + working_chart_directory = "exported_chart" + Log.info { "USING EXPORTED CHART PATH" } + else + working_chart_directory = helm_directory + Log.info { "NOT USING EXPORTED CHART PATH" } + end + helm_chart_path = destination_cnf_dir + "/" + CNFManager.sandbox_helm_directory(working_chart_directory) + helm_chart_path = Path[helm_chart_path].expand.to_s + end end end diff --git a/src/tasks/utils/cnf_installation/config_versions/config_v2.cr b/src/tasks/utils/cnf_installation/config_versions/config_v2.cr index 45f7b88c9..fa10fa40e 100644 --- a/src/tasks/utils/cnf_installation/config_versions/config_v2.cr +++ b/src/tasks/utils/cnf_installation/config_versions/config_v2.cr @@ -197,6 +197,22 @@ module CNFInstall rolling_downgrade_test_tag = "", rolling_version_change_test_tag = "", rollback_from_tag = "" + + def get_container_tag(tag_name) + # (kosstennbl) TODO: rework version change test and its configuration to get rid of this method. + case tag_name + when "rolling_update" + rolling_update_test_tag + when "rolling_downgrade" + rolling_downgrade_test_tag + when "rolling_version_change" + rolling_version_change_test_tag + when "rollback_from" + rollback_from_tag + else + raise ArgumentError.new("Incorrect tag name for container configuration: #{tag_name}") + end + end end end end \ No newline at end of file diff --git a/src/tasks/utils/cnf_installation/install_common.cr b/src/tasks/utils/cnf_installation/install_common.cr index 41a51248a..783e7b361 100644 --- a/src/tasks/utils/cnf_installation/install_common.cr +++ b/src/tasks/utils/cnf_installation/install_common.cr @@ -28,112 +28,4 @@ module CNFInstall exit 1 end end - - #Determine, for cnf, whether a helm chart, helm directory, or manifest directory is being used for installation - def self.cnf_installation_method(config : Totem::Config) : Tuple(CNFInstall::InstallMethod, String) - Log.info { "cnf_installation_method" } - Log.info { "cnf_installation_method config: #{config}" } - Log.info { "cnf_installation_method config: #{config.config_paths[0]}/#{config.config_name}.#{config.config_type}" } - helm_chart = optional_key_as_string(config, "helm_chart") - helm_directory = ensure_directory(optional_key_as_string(config, "helm_directory")) - manifest_directory = optional_key_as_string(config, "manifest_directory") - release_name = optional_key_as_string(config, "release_name") - full_helm_directory = "" - full_manifest_directory = "" - Log.info { "release_name: #{release_name}" } - Log.info { "helm_directory: #{helm_directory}" } - Log.info { "manifest_directory: #{manifest_directory}" } - #todo did this ever work? should be full path to destination. This is not - # even the relative path - if Dir.exists?(helm_directory) - Log.info { "Change helm_directory relative path into full path" } - full_helm_directory = Path[CNFManager.sandbox_helm_directory(helm_directory)].expand.to_s - elsif Dir.exists?(manifest_directory) - Log.info { "Change manifest_directory relative path into full path" } - full_manifest_directory = Path[manifest_directory].expand.to_s - else - Log.info { "Building helm_directory and manifest_directory full paths" } - full_helm_directory = Path[CNF_DIR + "/" + release_name + "/" + CNFManager.sandbox_helm_directory(helm_directory)].expand.to_s - full_manifest_directory = Path[CNF_DIR + "/" + release_name + "/" + CNFManager.sandbox_helm_directory(manifest_directory)].expand.to_s - end - - Log.info { "full_helm_directory: #{full_helm_directory} exists? #{Dir.exists?(full_helm_directory)}" } - Log.info { "full_manifest_directory: #{full_manifest_directory} exists? #{Dir.exists?(full_manifest_directory)}" } - - unless exclusive_install_method_tags?(config) - puts "Error: Must populate at lease one installation type in #{config.config_paths[0]}/#{config.config_name}.#{config.config_type}: choose either helm_chart, helm_directory, or manifest_directory in cnf-testsuite.yml!".colorize(:red) - exit 1 - end - - if !helm_chart.empty? - {CNFInstall::InstallMethod::HelmChart, helm_chart} - elsif !helm_directory.empty? - Log.info { "helm_directory not empty, using: #{full_helm_directory}" } - {CNFInstall::InstallMethod::HelmDirectory, full_helm_directory} - elsif !manifest_directory.empty? - Log.info { "manifest_directory not empty, using: #{full_manifest_directory}" } - {CNFInstall::InstallMethod::ManifestDirectory, full_manifest_directory} - else - puts "Error: Must populate at lease one installation type in #{config.config_paths[0]}/#{config.config_name}.#{config.config_type}: choose either helm_chart, helm_directory, or manifest_directory.".colorize(:red) - exit 1 - end - end - - def self.exclusive_install_method_tags?(config) - installation_type_count = ["helm_chart", "helm_directory", "manifest_directory"].reduce(0) do |acc, install_type| - begin - test_tag = config[install_type] - Log.debug { "install type count install_type: #{install_type}" } - if install_type.empty? - acc - else - acc = acc + 1 - end - rescue ex - Log.debug { "install_type: #{install_type} not found in #{config.config_paths[0]}/#{config.config_name}.#{config.config_type}" } - acc - end - end - Log.debug { "installation_type_count: #{installation_type_count}" } - if installation_type_count > 1 - false - else - true - end - end - - def self.install_parameters(config) - Log.info { "install_parameters" } - install_method = config.cnf_config[:install_method] - helm_chart = config.cnf_config[:helm_chart] - helm_directory = config.cnf_config[:helm_directory] - manifest_directory = config.cnf_config[:manifest_directory] - case install_method[0] - when CNFInstall::InstallMethod::ManifestDirectory - directory_parameters = directory_parameter_split(manifest_directory)["parameters"] - when CNFInstall::InstallMethod::HelmChart - directory_parameters = directory_parameter_split(helm_chart)["parameters"] - when CNFInstall::InstallMethod::HelmDirectory - directory_parameters = directory_parameter_split(helm_directory)["parameters"] - else - directory_parameters = "" - end - Log.info { "directory_parameters :#{directory_parameters}" } - directory_parameters - end - - def self.directory_parameter_split(directory_with_parameters) - Log.info { "directory_parameter_split : #{directory_with_parameters}" } - directory = directory_with_parameters.split(" ")[0] - parameters = directory_with_parameters.split(" ")[1..-1].join(" ") - Log.info { "directory : #{directory} parameters: #{parameters}"} - {"directory" => directory, "parameters" => parameters} - end - - def self.ensure_directory(directory_with_parameters) - Log.info { "directory_parameter_split : #{directory_with_parameters}" } - split = directory_parameter_split(directory_with_parameters) - split["directory"] - end - end \ No newline at end of file diff --git a/src/tasks/utils/cnf_manager.cr b/src/tasks/utils/cnf_manager.cr index f8d14087e..b83e14911 100644 --- a/src/tasks/utils/cnf_manager.cr +++ b/src/tasks/utils/cnf_manager.cr @@ -1,16 +1,13 @@ # coding: utf-8 require "totem" require "colorize" -require "./types/cnf_testsuite_yml_type.cr" require "helm" require "git" require "uuid" require "./points.cr" require "./task.cr" -require "./config.cr" require "./jaeger.cr" require "tar" -require "./generate_config.cr" require "./oran_monitor.cr" require "./cnf_installation/install_common.cr" require "./cnf_installation/manifest.cr" @@ -27,79 +24,25 @@ module CNFManager ECR.def_to_s("src/templates/elapsed_time_configmap.yml.ecr") end - # TODO: figure out recursively check for unmapped json and warn on that - # https://github.com/Nicolab/crystal-validator#check - def self.validate_cnf_testsuite_yml(config) - ccyt_validator = nil - valid = true - - begin - ccyt_validator = CnfTestSuiteYmlType.from_json(config.settings.to_json) - rescue ex - valid = false - Log.error { "✖ ERROR: cnf_testsuite.yml field validation error.".colorize(:red) } - Log.error { " please check info in the the field name near the text 'CnfTestSuiteYmlType#' in the error below".colorize(:red) } - Log.error { ex.message } - ex.backtrace.each do |x| - Log.error { x } - end - end - - unmapped_keys_warning_msg = "WARNING: Unmapped cnf_testsuite.yml keys. Please add them to the validator".colorize(:yellow) - unmapped_subkeys_warning_msg = "WARNING: helm_repository is unset or has unmapped subkeys. Please update your cnf_testsuite.yml".colorize(:yellow) - - if ccyt_validator && !ccyt_validator.try &.json_unmapped.empty? - warning_output = [unmapped_keys_warning_msg] of String | Colorize::Object(String) - warning_output.push(ccyt_validator.try &.json_unmapped.to_s) - if warning_output.size > 1 - Log.warn { warning_output.join("\n") } - end - end - - #TODO Differentiate between unmapped subkeys or unset top level key. - if ccyt_validator && !ccyt_validator.try &.helm_repository.try &.json_unmapped.empty? - root = {} of String => (Hash(String, JSON::Any) | Nil) - root["helm_repository"] = ccyt_validator.try &.helm_repository.try &.json_unmapped - - warning_output = [unmapped_subkeys_warning_msg] of String | Colorize::Object(String) - warning_output.push(root.to_s) - if warning_output.size > 1 - Log.warn { warning_output.join("\n") } - end - end - - { valid, warning_output } - end - def self.cnf_resource_ymls(args, config) Log.info { "cnf_resource_ymls" } - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] - helm_directory = sandbox_helm_directory(config.cnf_config[:helm_directory]) - manifest_directory = config.cnf_config[:manifest_directory] - release_name = config.cnf_config[:release_name] - helm_chart_path = Config.get_helm_chart_path(config) - manifest_file_path = Config.get_manifest_file_path(config) - helm_values = config.cnf_config[:helm_values] - test_passed = true - - deployment_namespace = CNFManager.get_deployment_namespace(config) - install_method = config.cnf_config[:install_method] - Log.debug { "install_method: #{install_method}" } template_ymls = [] of YAML::Any - case install_method[0] + case config.dynamic.install_method[0] when CNFInstall::InstallMethod::HelmChart, CNFInstall::InstallMethod::HelmDirectory + helm_chart_path = CNFInstall::Config.get_helm_chart_path(config) + generated_manifest_file_path = CNFInstall::Config.get_manifest_file_path(config) Log.info { "EXPORTED CHART PATH: #{helm_chart_path}" } - Helm.generate_manifest_from_templates(release_name, - helm_chart_path, - manifest_file_path, - deployment_namespace, - helm_values) - template_ymls = CNFInstall::Manifest.parse_manifest_as_ymls(manifest_file_path) + Helm.generate_manifest_from_templates(release_name: config.deployments.get_deployment_param(:name), + helm_chart: helm_chart_path, + output_file: generated_manifest_file_path, + namespace: CNFManager.get_deployment_namespace(config), + helm_values: config.deployments.get_deployment_param(:helm_values)) + template_ymls = CNFInstall::Manifest.parse_manifest_as_ymls(generated_manifest_file_path) when CNFInstall::InstallMethod::ManifestDirectory - # if release_name.empty? # no helm chart - template_ymls = CNFInstall::Manifest.manifest_ymls_from_file_list(CNFInstall::Manifest.manifest_file_list( destination_cnf_dir + "/" + manifest_directory)) - # else + template_ymls = CNFInstall::Manifest.manifest_ymls_from_file_list( + CNFInstall::Manifest.manifest_file_list(config.dynamic.destination_cnf_dir + "/" + config.deployments.get_deployment_param(:manifest_directory)) + ) end template_ymls = template_ymls.reject! {|x| @@ -133,12 +76,13 @@ module CNFManager # ``` def self.get_deployment_namespace(config) - install_method = config.cnf_config[:install_method] + install_method = config.dynamic.install_method case install_method[0] - when CNFInstall::InstallMethod::HelmChart, CNFInstall::InstallMethod::HelmDirectory - if !config.cnf_config[:helm_install_namespace].empty? - Log.info { "deployment namespace was set to: #{config.cnf_config[:helm_install_namespace]}" } - config.cnf_config[:helm_install_namespace] + when CNFInstall::InstallMethod::HelmChart, Helm::InstallMethod::HelmDirectory + config_namespace = config.deployments.get_deployment_param(:namespace) + if !config_namespace.empty? + Log.info { "deployment namespace was set to: #{config_namespace}" } + config_namespace else Log.info { "deployment namespace was set to: #{DEFAULT_CNF_NAMESPACE}" } DEFAULT_CNF_NAMESPACE @@ -164,15 +108,6 @@ module CNFManager resource_resp end - def self.namespace_from_parameters(parameters) - Log.info { "namespace_from_parameters: #{parameters}" } - parameter_list = parameters.strip().split(" ") - namespace_index = parameter_list.index{|x| x =="--namespace"} - namespace = "--namespace #{parameter_list[(namespace_index + 1)]}" if namespace_index - Log.info { "namespace_from_parameters namespace: #{namespace}" } - namespace - end - #test_passes_completely = workload_resource_test do | cnf_config, resource, container, initialized | def self.workload_resource_test(args, config, check_containers = true, @@ -181,14 +116,10 @@ module CNFManager JSON::Any, JSON::Any, Bool | Nil) -> Bool | Nil) # resp = yield resource, container, volumes, initialized test_passed = true - namespace = namespace_from_parameters(CNFInstall.install_parameters(config)) - resource_ymls = cnf_workload_resources(args, config) do |resource| resource end - deployment_namespace = CNFManager.get_deployment_namespace(config) - resource_names = Helm.workload_resource_kind_names(resource_ymls, default_namespace: deployment_namespace) Log.info { "resource names: #{resource_names}" } if resource_names && resource_names.size > 0 @@ -266,30 +197,6 @@ module CNFManager cnf_config_list(silent: true).size > 0 end - def self.parsed_config_file(path) - Log.info { "parsed_config_file: #{path}" } - if path && path.empty? - raise "No cnf_testsuite.yml found in #{path}!" - end - Totem.from_file "#{path}" - end - - def self.sample_testsuite_yml(sample_dir) - Log.info { "sample_testsuite_yml sample_dir: #{sample_dir}" } - find_cmd = "find #{sample_dir}/* -name \"cnf-testsuite.yml\"" - Process.run( - find_cmd, - shell: true, - output: find_stdout = IO::Memory.new, - error: find_stderr = IO::Memory.new - ) - cnf_testsuite = find_stdout.to_s.split("\n")[0] - if cnf_testsuite.empty? - raise "No cnf_testsuite.yml found in #{sample_dir}!" - end - Totem.from_file "./#{cnf_testsuite}" - end - def self.path_has_yml?(config_path) if config_path =~ /\.yml/ true @@ -298,17 +205,6 @@ module CNFManager end end - def self.config_from_path_or_dir(cnf_path_or_dir) - if path_has_yml?(cnf_path_or_dir) - config_file = File.dirname(cnf_path_or_dir) - config = sample_testsuite_yml(config_file) - else - config_file = cnf_path_or_dir - config = sample_testsuite_yml(config_file) - end - return config - end - # if passed a directory, adds cnf-testsuite.yml to the string def self.ensure_cnf_testsuite_yml_path(path : String) Log.info { "ensure_cnf_testsuite_yml_path" } @@ -329,15 +225,6 @@ module CNFManager dir + "/" end - def self.release_name?(config) - release_name = optional_key_as_string(config, "release_name").split(" ")[0] - if release_name.empty? - false - else - true - end - end - def self.sandbox_helm_directory(cnf_testsuite_helm_directory) cnf_testsuite_helm_directory.split("/")[-1] end @@ -368,67 +255,6 @@ module CNFManager hth["NAME"] end - - def self.generate_and_set_release_name(config_yml_path, src_mode=false) - Log.info { "generate_and_set_release_name" } - Log.info { "generate_and_set_release_name config_yml_path: #{config_yml_path}" } - - yml_file = CNFManager.ensure_cnf_testsuite_yml_path(config_yml_path) - yml_path = CNFManager.ensure_cnf_testsuite_dir(config_yml_path) - - config = CNFManager.parsed_config_file(yml_file) - - predefined_release_name = optional_key_as_string(config, "release_name") - src_helm_directory = optional_key_as_string(config, "helm_directory") - Log.info { "src_helm_directory: #{src_helm_directory}" } - Log.debug { "predefined_release_name: #{predefined_release_name}" } - if predefined_release_name.empty? - install_method = CNFInstall.cnf_installation_method(config) - Log.debug { "install_method: #{install_method}" } - case install_method[0] - when CNFInstall::InstallMethod::HelmChart - Log.info { "generate_and_set_release_name install method: #{install_method[0]} data: #{install_method[1]}" } - Log.info { "generate_and_set_release_name helm_chart_or_directory: #{install_method[1]}" } - release_name = helm_chart_template_release_name(install_method[1]) - when CNFInstall::InstallMethod::HelmDirectory - Log.info { "helm_directory install method: #{yml_path}/#{install_method[1]}" } - # todo get the release name by looking through everything under /tmp/repositories - Log.info { "generate_and_set_release_name helm_chart_or_directory: #{install_method[1]}" } - if src_mode - release_name = helm_chart_template_release_name("#{src_helm_directory}") - else - release_name = helm_chart_template_release_name("#{install_method[1]}") - end - when CNFInstall::InstallMethod::ManifestDirectory - Log.debug { "manifest_directory install method" } - release_name = UUID.random.to_s - else - raise "Install method should be either helm_chart, helm_directory, or manifest_directory" - end - #set generated helm chart release name in yml file - Log.debug { "generate_and_set_release_name: #{release_name}" } - update_yml(yml_file, "release_name", release_name) - end - end - - - # TODO move to sandbox module - def self.cnf_destination_dir(config_file) - Log.info { "cnf_destination_dir config_file: #{config_file}" } - if path_has_yml?(config_file) - yml = config_file - else - yml = config_file + "/cnf-testsuite.yml" - end - config = parsed_config_file(yml) - Log.debug { "cnf_destination_dir parsed_config_file config: #{config}" } - current_dir = FileUtils.pwd - release_name = optional_key_as_string(config, "release_name").split(" ")[0] - Log.info { "release_name: #{release_name}" } - Log.info { "cnf destination dir: #{current_dir}/#{CNF_DIR}/#{release_name}" } - "#{current_dir}/#{CNF_DIR}/#{release_name}" - end - def self.config_source_dir(config_file) if File.directory?(config_file) config_file @@ -441,17 +267,12 @@ module CNFManager Log.info { "helm_repo_add repo_name: #{helm_repo_name} repo_url: #{helm_repo_url} args: #{args.inspect}" } ret = false if helm_repo_name == nil || helm_repo_url == nil - # config = get_parsed_cnf_testsuite_yml(args) - # config = parsed_config_file(ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) Log.info { "helm path: #{Helm::BinarySingleton.helm}" } helm = Helm::BinarySingleton.helm - # helm_repo_name = config.get("helm_repository.name").as_s? - helm_repository = config.cnf_config[:helm_repository] - helm_repo_name = "#{helm_repository && helm_repository["name"]}" - helm_repo_url = "#{helm_repository && helm_repository["repo_url"]}" + helm_repo_name = config.deployments.get_deployment_param(:helm_repo_name) + helm_repo_url = config.deployments.get_deployment_param(:helm_repo_url) Log.info { "helm_repo_name: #{helm_repo_name}" } - # helm_repo_url = config.get("helm_repository.repo_url").as_s? Log.info { "helm_repo_url: #{helm_repo_url}" } end if helm_repo_name && helm_repo_url @@ -496,14 +317,11 @@ module CNFManager # Use manifest directory if helm directory empty def self.sandbox_setup(config, cli_args) Log.info { "sandbox_setup" } - Log.info { "sandbox_setup config: #{config.cnf_config}" } + Log.info { "sandbox_setup config: #{config.inspect}" } verbose = cli_args[:verbose] - config_file = config.cnf_config[:source_cnf_dir] - release_name = config.cnf_config[:release_name] - install_method = config.cnf_config[:install_method] - helm_directory = config.cnf_config[:helm_directory] - manifest_directory = config.cnf_config[:manifest_directory] - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + config_file = config.dynamic.source_cnf_dir + install_method = config.dynamic.install_method + destination_cnf_dir = config.dynamic.destination_cnf_dir # Create a CNF sandbox dir FileUtils.mkdir_p(destination_cnf_dir) @@ -521,6 +339,7 @@ module CNFManager case install_method[0] when CNFInstall::InstallMethod::ManifestDirectory Log.info { "preparing manifest_directory sandbox" } + manifest_directory = config.deployments.get_deployment_param(:manifest_directory) source_directory = config_source_dir(config_file) + "/" + manifest_directory src_path = Path[source_directory].expand.to_s Log.info { "cp -a #{src_path} #{destination_cnf_dir}" } @@ -532,6 +351,7 @@ module CNFManager end when CNFInstall::InstallMethod::HelmDirectory Log.info { "preparing helm_directory sandbox" } + helm_directory = config.deployments.get_deployment_param(:helm_directory) source_directory = config_source_dir(config_file) + "/" + helm_directory.split(" ")[0] # todo support parameters separately src_path = Path[source_directory].expand.to_s Log.info { "cp -a #{src_path} #{destination_cnf_dir}" } @@ -542,7 +362,7 @@ module CNFManager Log.info { "helm sandbox dir already exists at #{destination_cnf_dir}/#{File.basename(src_path)}" } rescue File::NotFoundError Log.info { "helm directory not found at #{src_path}" } - raise HelmDirectoryMissingError.new(src_path) + stdout_warning "helm directory at #{helm_directory} is missing" end when CNFInstall::InstallMethod::HelmChart Log.info { "preparing helm chart sandbox" } @@ -561,40 +381,34 @@ module CNFManager def self.export_published_chart(config, cli_args) Log.info { "exported_chart cli_args: #{cli_args}" } verbose = cli_args[:verbose] - config_file = config.cnf_config[:source_cnf_dir] - helm_directory = config.cnf_config[:helm_directory] - helm_chart = config.cnf_config[:helm_chart] - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] - - #TODO don't think we need to make this here - FileUtils.mkdir_p("#{destination_cnf_dir}/#{helm_directory}") - + config_file = config.dynamic.source_cnf_dir + helm_chart_name = config.deployments.get_deployment_param(:helm_chart_name) + destination_cnf_dir = config.dynamic.destination_cnf_dir config_path = CNFManager.ensure_cnf_testsuite_yml_path(config_file) # Pulling chart # Delete pre-existing tgz files - files_to_delete = find_tgz_files(helm_chart) + files_to_delete = find_tgz_files(helm_chart_name) files_to_delete.each do |file| FileUtils.rm(file) Log.info { "Deleted: #{file}" } end # Pull new version - helm_info = Helm.pull(helm_chart) + helm_info = Helm.pull(helm_chart_name) unless helm_info[:status].success? puts "Helm pull error".colorize(:red) raise "Helm pull error" end - config = CNFManager::Config.parse_config_yml(config_path) # Discover newly pulled tgz file - tgz_name = get_and_verify_tgz_name(helm_chart) + tgz_name = get_and_verify_tgz_name(helm_chart_name) Log.info { "tgz_name: #{tgz_name}" } TarClient.untar(tgz_name, "#{destination_cnf_dir}/exported_chart") - Log.for("verbose").info { "mv #{destination_cnf_dir}/exported_chart/#{Helm.chart_name(helm_chart)}/* #{destination_cnf_dir}/exported_chart" } if verbose + Log.for("verbose").info { "mv #{destination_cnf_dir}/exported_chart/#{Helm.chart_name(helm_chart_name)}/* #{destination_cnf_dir}/exported_chart" } if verbose Log.for("verbose").debug { stdout = IO::Memory.new Process.run("ls -alR #{destination_cnf_dir}", shell: true, output: stdout, error: stdout) @@ -602,7 +416,7 @@ module CNFManager } FileUtils.mv( - Dir.glob("#{destination_cnf_dir}/exported_chart/#{Helm.chart_name(helm_chart)}/*"), + Dir.glob("#{destination_cnf_dir}/exported_chart/#{Helm.chart_name(helm_chart_name)}/*"), "#{destination_cnf_dir}/exported_chart" ) @@ -620,44 +434,26 @@ module CNFManager wait_count = cli_args[:wait_count] skip_wait_for_install = cli_args[:skip_wait_for_install] verbose = cli_args[:verbose] - config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - Log.debug { "config in sample_setup: #{config.cnf_config}" } - release_name = config.cnf_config[:release_name] - install_method = config.cnf_config[:install_method] + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) + Log.debug { "config in sample_setup: #{config.inspect}" } Log.for("verbose").info { "sample_setup" } if verbose Log.info { "config_file #{config_file}" } - # config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - release_name = config.cnf_config[:release_name] - install_method = config.cnf_config[:install_method] + release_name = config.deployments.get_deployment_param(:name) + install_method = config.dynamic.install_method Log.info { "install_method #{install_method}" } - helm_directory = config.cnf_config[:helm_directory] - helm_values = config.cnf_config[:helm_values] - manifest_directory = config.cnf_config[:manifest_directory] - helm_repository = config.cnf_config[:helm_repository] - helm_repo_name = "#{helm_repository && helm_repository["name"]}" - helm_repo_url = "#{helm_repository && helm_repository["repo_url"]}" + helm_values = config.deployments.get_deployment_param(:helm_values) deployment_namespace = CNFManager.get_deployment_namespace(config) helm_namespace_option = "-n #{deployment_namespace}" ensure_namespace_exists!(deployment_namespace) - - - Log.info { "helm_repo_name: #{helm_repo_name}" } - Log.info { "helm_repo_url: #{helm_repo_url}" } - Log.debug { "helm_directory: #{helm_directory}" } - - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir Log.for("verbose").info { "destination_cnf_dir: #{destination_cnf_dir}" } if verbose Log.debug { "mkdir_p destination_cnf_dir: #{destination_cnf_dir}" } FileUtils.mkdir_p(destination_cnf_dir) - begin - sandbox_setup(config, cli_args) - rescue e : HelmDirectoryMissingError - stdout_warning "helm directory at #{e.helm_directory} is missing" - end + sandbox_setup(config, cli_args) helm = Helm::BinarySingleton.helm Log.info { "helm path: #{Helm::BinarySingleton.helm}" } @@ -690,7 +486,7 @@ module CNFManager end # todo start tshark monitoring the e2 traffic - capture = ORANMonitor.start_e2_capture?(config.cnf_config) + capture = ORANMonitor.start_e2_capture?(config) # todo separate out install methods into a module/function that accepts a block liveness_time = 0 @@ -700,15 +496,18 @@ module CNFManager case install_method[0] when CNFInstall::InstallMethod::ManifestDirectory Log.for("verbose").info { "deploying by manifest file" } if verbose + manifest_directory = config.deployments.get_deployment_param(:manifest_directory) KubectlClient::Apply.file("#{destination_cnf_dir}/#{manifest_directory}") when CNFInstall::InstallMethod::HelmChart - helm_chart = config.cnf_config[:helm_chart] + helm_chart_name = config.deployments.get_deployment_param(:helm_chart_name) + helm_repo_name = config.deployments.get_deployment_param(:helm_repo_name) + helm_repo_url = config.deployments.get_deployment_param(:helm_repo_url) if !helm_repo_name.empty? || !helm_repo_url.empty? Helm.helm_repo_add(helm_repo_name, helm_repo_url) end Log.for("verbose").info { "deploying with chart repository" } if verbose begin - helm_install = Helm.install(release_name, helm_chart, helm_namespace_option, helm_values) + helm_install = Helm.install(release_name, helm_chart_name, helm_namespace_option, helm_values) rescue e : Helm::InstallationFailed stdout_failure "Helm installation failed" stdout_failure "\t#{e.message}" @@ -829,7 +628,7 @@ module CNFManager tracing_used = false end - if ORANMonitor.isCNFaRIC?(config.cnf_config) + if ORANMonitor.isCNFaRIC?(config) sleep 30 e2_found = ORANMonitor.e2_session_established?(capture) else @@ -882,17 +681,9 @@ module CNFManager end def self.cnf_to_new_cluster(config, kubeconfig) - release_name = config.cnf_config[:release_name] - install_method = config.cnf_config[:install_method] - release_name = config.cnf_config[:release_name] - install_method = config.cnf_config[:install_method] - helm_directory = config.cnf_config[:helm_directory] - manifest_directory = config.cnf_config[:manifest_directory] - helm_repository = config.cnf_config[:helm_repository] - helm_repo_name = "#{helm_repository && helm_repository["name"]}" - helm_repo_url = "#{helm_repository && helm_repository["repo_url"]}" - helm_chart = config.cnf_config[:helm_chart] - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + release_name = config.deployments.get_deployment_param(:name) + install_method = config.dynamic.install_method + destination_cnf_dir = config.dynamic.destination_cnf_dir deployment_namespace = CNFManager.get_deployment_namespace(config) helm_namespace_option = "-n #{deployment_namespace}" ensure_namespace_exists!(deployment_namespace, kubeconfig: kubeconfig) @@ -900,14 +691,19 @@ module CNFManager Log.for("cnf_to_new_cluster").info { "Install method: #{install_method[0]}" } case install_method[0] when CNFInstall::InstallMethod::ManifestDirectory + manifest_directory = config.deployments.get_deployment_param(:manifest_directory) KubectlClient::Apply.file("#{destination_cnf_dir}/#{manifest_directory}", kubeconfig: kubeconfig) when CNFInstall::InstallMethod::HelmChart + helm_repo_name = config.deployments.get_deployment_param(:helm_repo_name) + helm_repo_url = config.deployments.get_deployment_param(:helm_repo_url) + helm_chart_name = config.deployments.get_deployment_param(:helm_chart_name) begin - helm_install = Helm.install("#{release_name} #{helm_chart} --kubeconfig #{kubeconfig} #{helm_namespace_option}") + helm_install = Helm.install("#{release_name} #{helm_chart_name} --kubeconfig #{kubeconfig} #{helm_namespace_option}") rescue e : Helm::CannotReuseReleaseNameError stdout_warning "Release name #{release_name} has already been setup." end when CNFInstall::InstallMethod::HelmDirectory + helm_directory = config.deployments.get_deployment_param(:helm_directory) begin helm_install = Helm.install("#{release_name} #{destination_cnf_dir}/#{helm_directory} --kubeconfig #{kubeconfig} #{helm_namespace_option}") rescue e : Helm::CannotReuseReleaseNameError @@ -940,10 +736,9 @@ module CNFManager def self.sample_cleanup(config_file, force=false, installed_from_manifest=false, verbose=true) Log.info { "sample_cleanup" } Log.info { "sample_cleanup installed_from_manifest: #{installed_from_manifest}" } - config = parsed_config_file(ensure_cnf_testsuite_yml_path(config_file)) - parsed_config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) + config = CNFInstall::Config.parse_cnf_config_from_file(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) Log.for("verbose").info { "cleanup config: #{config.inspect}" } if verbose - destination_cnf_dir = parsed_config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir Log.info { "destination_cnf_dir: #{destination_cnf_dir}" } @@ -956,7 +751,7 @@ module CNFManager end # Strips all the helm options from the release name option in config - release_name = "#{config.get("release_name").as_s?}" + release_name = config.deployments.get_deployment_param(:name) release_name = release_name.split(" ")[0] Log.for("sample_cleanup:helm_path").info { Helm::BinarySingleton.helm } @@ -969,11 +764,11 @@ module CNFManager Log.for("sample_cleanup").info { "Destination dir #{destination_cnf_dir} exists" } end - install_method = parsed_config.cnf_config[:install_method] + install_method = config.dynamic.install_method Log.for("sample_cleanup:install_method").info { install_method } case install_method[0] when CNFInstall::InstallMethod::HelmChart, CNFInstall::InstallMethod::HelmDirectory - deployment_namespace = CNFManager.get_deployment_namespace(parsed_config) + deployment_namespace = CNFManager.get_deployment_namespace(config) helm_namespace_option = "-n #{deployment_namespace}" result = Helm.uninstall(release_name + " #{helm_namespace_option}") Log.for("sample_cleanup:helm_uninstall").info { result[:output].to_s } if verbose @@ -983,7 +778,7 @@ module CNFManager FileUtils.rm_rf(destination_cnf_dir) return result[:status].success? when CNFInstall::InstallMethod::ManifestDirectory - manifest_directory = destination_cnf_dir + "/" + "#{config["manifest_directory"]? && config["manifest_directory"].as_s?}" + manifest_directory = config.deployments.get_deployment_param(:manifest_directory) Log.for("cnf_cleanup:manifest_directory").info { manifest_directory } result = KubectlClient::Delete.file("#{manifest_directory}", wait: true) FileUtils.rm_rf(destination_cnf_dir) @@ -1015,16 +810,16 @@ module CNFManager resource_keys.includes?(resource_key) end - def self.find_tgz_files(helm_chart) - Dir.glob(get_helm_tgz_glob(helm_chart)) + def self.find_tgz_files(helm_chart_name) + Dir.glob(get_helm_tgz_glob(helm_chart_name)) end - def self.get_and_verify_tgz_name(helm_chart) - tgz_files = find_tgz_files(helm_chart) + def self.get_and_verify_tgz_name(helm_chart_name) + tgz_files = find_tgz_files(helm_chart_name) if tgz_files.empty? - Log.error { "No .tgz files found for #{get_helm_tgz_glob(helm_chart)}" } - raise TarFileNotFoundError.new(Helm.chart_name(helm_chart)) + Log.error { "No .tgz files found for #{get_helm_tgz_glob(helm_chart_name)}" } + raise TarFileNotFoundError.new(Helm.chart_name(helm_chart_name)) elsif tgz_files.size > 1 Log.warn { "Multiple .tgz files found: #{tgz_files.join(", ")}" } end @@ -1032,16 +827,8 @@ module CNFManager tgz_files.first end - def self.get_helm_tgz_glob(helm_chart) - "#{Helm.chart_name(helm_chart)}-*.tgz" - end - - class HelmDirectoryMissingError < Exception - property helm_directory : String = "" - - def initialize(helm_directory : String) - self.helm_directory = helm_directory - end + def self.get_helm_tgz_glob(helm_chart_name) + "#{Helm.chart_name(helm_chart_name)}-*.tgz" end class TarFileNotFoundError < Exception diff --git a/src/tasks/utils/config.cr b/src/tasks/utils/config.cr deleted file mode 100644 index 5faa5a2a2..000000000 --- a/src/tasks/utils/config.cr +++ /dev/null @@ -1,229 +0,0 @@ -require "totem" -require "colorize" -require "./types/cnf_testsuite_yml_type.cr" -require "helm" -require "uuid" -require "./points.cr" -require "./task.cr" - -module CNFManager - - class Config - def initialize(cnf_config) - @cnf_config = cnf_config - end - #when addeding to this you must add to task.cr's CNFManager::Config.new( - property cnf_config : NamedTuple(destination_cnf_dir: String, - source_cnf_dir: String, - install_method: Tuple(CNFInstall::InstallMethod, String), - manifest_directory: String, - helm_directory: String, - release_name: String, - helm_repository: NamedTuple(name: String, repo_url: String) | Nil, - helm_chart: String, - helm_values: String, - helm_install_namespace: String, - container_names: Array(Hash(String, String )) | Nil, - white_list_container_names: Array(String), - docker_insecure_registries: Array(String) | Nil, - #todo change this to an array of labels that capture all of 5g core nodes - amf_label: String, - smf_label: String, - upf_label: String, - ric_label: String, - fiveG_core: NamedTuple(amf_service_name: String, - mmc: String, - mnc: String, - sst: String, - sd: String, - tac: String, - protectionScheme: String, - publicKey: String, - publicKeyId: String, - routingIndicator: String, - enabled: String, - count: String, - initialMSISDN: String, - key: String, - op: String, - opType: String, - type: String, - apn: String, - emergency: String - ), - image_registry_fqdns: Hash(String, String ) | Nil) - - def self.parse_config_yml(config_yml_path : String) : CNFManager::Config - LOGGING.debug "parse_config_yml config_yml_path: #{config_yml_path}" - yml_file = CNFManager.ensure_cnf_testsuite_yml_path(config_yml_path) - #TODO modify the destination testsuite yml instead of the source testsuite yml - # (especially in the case of the release manager). Then reread the destination config - # TODO for cleanup, read source, then find destination and use release name from destination config - # TODO alternatively use a CRD to save the release name - - CNFManager.generate_and_set_release_name(config_yml_path) - config = CNFManager.parsed_config_file(yml_file) - install_method = CNFInstall.cnf_installation_method(config) - - destination_cnf_dir = CNFManager.cnf_destination_dir(yml_file) - - source_cnf_dir = CNFManager.ensure_cnf_testsuite_dir(config_yml_path) - manifest_directory = optional_key_as_string(config, "manifest_directory") - if config["helm_repository"]? - helm_repository = config["helm_repository"].as_h - helm_repo_name = optional_key_as_string(helm_repository, "name") - helm_repo_url = optional_key_as_string(helm_repository, "repo_url") - else - helm_repo_name = "" - helm_repo_url = "" - end - helm_chart = optional_key_as_string(config, "helm_chart") - helm_values = optional_key_as_string(config, "helm_values") - release_name = optional_key_as_string(config, "release_name") - helm_directory = optional_key_as_string(config, "helm_directory") - helm_install_namespace = optional_key_as_string(config, "helm_install_namespace") - if config["enabled"]? - core_enabled = config["enabled"].as_bool.to_s - else - core_enabled = "" - end - if config["emergency"]? - core_emergency = config["emergency"].as_bool.to_s - else - core_emergency = "" - end - if config["sd"]? - core_sd = config["sd"].as_s - else - core_sd = "" - end - fiveG_core = {amf_service_name: optional_key_as_string(config, "amf_service_name"), - mmc: optional_key_as_string(config, "mmc"), - mnc: optional_key_as_string(config, "mnc"), - sst: optional_key_as_string(config, "sst"), - sd: core_sd, - tac: optional_key_as_string(config, "tac"), - protectionScheme: optional_key_as_string(config, "protectionScheme"), - publicKey: optional_key_as_string(config, "publicKey"), - publicKeyId: optional_key_as_string(config, "publicKeyId"), - routingIndicator: optional_key_as_string(config, "routingIndicator"), - enabled: core_enabled, - count: optional_key_as_string(config, "count"), - initialMSISDN: optional_key_as_string(config, "initialMSISDN"), - key: optional_key_as_string(config, "key"), - op: optional_key_as_string(config, "op"), - opType: optional_key_as_string(config, "opType"), - type: optional_key_as_string(config, "type"), - apn: optional_key_as_string(config, "apn"), - emergency: core_emergency, - } - core = optional_key_as_string(config, "amf_label") - smf = optional_key_as_string(config, "smf_label") - upf = optional_key_as_string(config, "upf_label") - ric = optional_key_as_string(config, "ric_label") - - white_list_container_names = optional_key_as_string(config, "allowlist_helm_chart_container_names") - if config["allowlist_helm_chart_container_names"]? - white_list_container_names = config["allowlist_helm_chart_container_names"].as_a.map do |c| - "#{c.as_s?}" - end - else - white_list_container_names = [] of String - end - if config["container_names"]? - container_names_totem = config["container_names"] - container_names = container_names_totem.as_a.map do |container| - {"name" => optional_key_as_string(container, "name"), - "rolling_update_test_tag" => optional_key_as_string(container, "rolling_update_test_tag"), - "rolling_downgrade_test_tag" => optional_key_as_string(container, "rolling_downgrade_test_tag"), - "rolling_version_change_test_tag" => optional_key_as_string(container, "rolling_version_change_test_tag"), - "rollback_from_tag" => optional_key_as_string(container, "rollback_from_tag"), - } - end - else - container_names = [{"name" => "", - "rolling_update_test_tag" => "", - "rolling_downgrade_test_tag" => "", - "rolling_version_change_test_tag" => "", - "rollback_from_tag" => "", - }] - end - - docker_insecure_registries = [] of String - if config["docker_insecure_registries"]? && !config["docker_insecure_registries"].nil? - docker_insecure_registries = config["docker_insecure_registries"].as_a.map do |c| - "#{c.as_s?}" - end - end - - image_registry_fqdns = Hash(String, String).new - if config["image_registry_fqdns"]? && !config["image_registry_fqdns"].nil? - config["image_registry_fqdns"].as_h.each do |key, value| - image_registry_fqdns[key] = value.as_s - end - end - - # if you change this, change instantiation in task.cr/single_task_runner as well - new({ destination_cnf_dir: destination_cnf_dir, - source_cnf_dir: source_cnf_dir, - install_method: install_method, - manifest_directory: manifest_directory, - helm_directory: helm_directory, - release_name: release_name, - helm_repository: {name: helm_repo_name, repo_url: helm_repo_url}, - helm_chart: helm_chart, - helm_values: helm_values, - helm_install_namespace: helm_install_namespace, - container_names: container_names, - white_list_container_names: white_list_container_names, - docker_insecure_registries: docker_insecure_registries, - amf_label: core, - smf_label: smf, - upf_label: upf, - ric_label: ric, - fiveG_core: fiveG_core, - image_registry_fqdns: image_registry_fqdns,}) - - end - - def self.get_helm_chart_path(config) - helm_directory = config.cnf_config[:helm_directory] - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] - if helm_directory.empty? - working_chart_directory = "exported_chart" - Log.info { "USING EXPORTED CHART PATH" } - else - working_chart_directory = helm_directory - Log.info { "NOT USING EXPORTED CHART PATH" } - end - helm_chart_path = destination_cnf_dir + "/" + CNFManager.sandbox_helm_directory(working_chart_directory) - helm_chart_path = Path[helm_chart_path].expand.to_s - end - - def self.get_manifest_file_path(config) - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] - manifest_file_path = destination_cnf_dir + "/" + "temp_template.yml" - end - - def self.install_method_by_config_file(config_file) : CNFInstall::InstallMethod - LOGGING.info "install_data_by_config_file" - config = CNFManager.parsed_config_file(config_file) - sandbox_config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - install_method = CNFInstall.cnf_installation_method(config) - install_method[0] - end - def self.config_src_by_config_file(config_file) : String - LOGGING.info "install_data_by_config_file" - config = CNFManager.parsed_config_file(config_file) - sandbox_config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - install_method = CNFInstall.cnf_installation_method(config) - install_method[1] - end - def self.release_name_by_config_file(config_file) : String - LOGGING.info "release_name_by_config_file" - config = CNFManager.parsed_config_file(config_file) - sandbox_config = CNFManager::Config.parse_config_yml(CNFManager.ensure_cnf_testsuite_yml_path(config_file)) - release_name = sandbox_config.cnf_config[:release_name] - end - end -end diff --git a/src/tasks/utils/generate_config.cr b/src/tasks/utils/generate_config.cr deleted file mode 100644 index dc9ff5261..000000000 --- a/src/tasks/utils/generate_config.cr +++ /dev/null @@ -1,128 +0,0 @@ -require "totem" -require "colorize" -require "./types/cnf_testsuite_yml_type.cr" -require "helm" -require "uuid" -require "./points.cr" -require "./task.cr" - -module CNFManager - module GenerateConfig - def self.export_manifest(config_src, output_file="./cnf-testsuite.yml") - LOGGING.info "export_manifest" - LOGGING.info "export_manifest config_src: #{config_src}" - generate_initial_testsuite_yml(config_src, output_file) - CNFManager.generate_and_set_release_name(output_file, src_mode: true) - config = CNFManager.parsed_config_file(output_file) - release_name = optional_key_as_string(config, "release_name") - install_method = CNFInstall.install_method_by_config_src(config_src) - LOGGING.info "install_method: #{install_method}" - if install_method == CNFInstall::InstallMethod::ManifestDirectory - template_ymls = CNFInstall::Manifest.manifest_ymls_from_file_list(CNFInstall::Manifest.manifest_file_list( config_src)) - else - # todo if success false, raise error - Helm.generate_manifest_from_templates(release_name, - config_src) - template_ymls = CNFInstall::Manifest.parse_manifest_as_ymls() - end - resource_ymls = Helm.all_workload_resources(template_ymls) - resource_ymls - end - - #get list of image:tags from helm chart/helm directory/manifest file - #note: config_src must be an absolute path if a directory, todo: make this more resilient - def self.images_from_config_src(config_src) - LOGGING.info "images_from_config_src" - #return container image name/tag - ret_containers = [] of NamedTuple(container_name: String, image_name: String, tag: String) - resource_ymls = CNFManager::GenerateConfig.export_manifest(config_src) - resource_resp = resource_ymls.map do | resource | - LOGGING.info "gen config resource: #{resource}" - unless resource["kind"].as_s.downcase == "service" ## services have no containers - containers = CNFInstall::Manifest.manifest_containers(resource) - - LOGGING.info "containers: #{containers}" - container_name = containers.as_a[0].as_h["name"].as_s if containers - if containers - container_names = containers.as_a.map do |container| - LOGGING.debug "container: #{container}" - container_name = container.as_h["name"].as_s - image_name = container.as_h["image"].as_s.split(":")[0] - if container.as_h["image"].as_s.split(":").size > 1 - tag = container.as_h["image"].as_s.split(":")[1] - else - tag = "latest" - end - ret_containers << {container_name: container_name, - image_name: image_name, - tag: tag} - LOGGING.debug "ret_containers: #{ret_containers}" - end - end - end - end - ret_containers - end - - def self.generate_config(config_src, output_file="./cnf-testsuite.yml") - resource_ymls = CNFManager::GenerateConfig.export_manifest(config_src, output_file) - resource_resp = resource_ymls.map do | resource | - LOGGING.info "gen config resource: #{resource}" - unless resource["kind"].as_s.downcase == "service" ## services have no containers - containers = CNFInstall::Manifest.manifest_containers(resource) - - LOGGING.info "containers: #{containers}" - container_name = containers.as_a[0].as_h["name"].as_s if containers - if containers - container_names = containers.as_a.map { |container| - LOGGING.debug "container: #{container}" - if container.as_h["image"].as_s.split(":").size > 1 - rolling_update_test_tag = container.as_h["image"].as_s.split(":")[1] - else - rolling_update_test_tag = "" - end -# don't mess with the indentation here - container_names_template = <<-TEMPLATE - - - name: #{container.as_h["name"].as_s} - rolling_update_test_tag: #{rolling_update_test_tag} - rolling_downgrade_test_tag: #{rolling_update_test_tag} - rolling_version_change_test_tag: #{rolling_update_test_tag} - rollback_from_tag: #{rolling_update_test_tag} - TEMPLATE - }.join("") - # Don't add container_names to yml. This isn't needed until the rolling update tests are added to the cert. - # update_yml(output_file, "container_names", container_names) - end - end - # resp - end - end - - def self.generate_initial_testsuite_yml(config_src, config_yml_path="./cnf-testsuite.yml") - if !File.exists?(config_yml_path) - case CNFInstall.install_method_by_config_src(config_src) - when CNFInstall::InstallMethod::HelmChart - testsuite_yml_template_resp = TestSuiteYmlTemplate.new("helm_chart: #{config_src}").to_s - when CNFInstall::InstallMethod::HelmDirectory - testsuite_yml_template_resp = TestSuiteYmlTemplate.new("helm_directory: #{config_src}").to_s - when CNFInstall::InstallMethod::ManifestDirectory - testsuite_yml_template_resp = TestSuiteYmlTemplate.new("manifest_directory: #{config_src}").to_s - else - puts "Error: #{config_src} is neither a helm_chart, helm_directory, or manifest_directory.".colorize(:red) - exit 1 - end - File.write(config_yml_path, testsuite_yml_template_resp) - else - LOGGING.error "#{config_yml_path} already exists" - end - end - end -end - -class TestSuiteYmlTemplate - def initialize(@install_key : String) - end - - ECR.def_to_s("src/templates/testsuite_template.yml.ecr") -end diff --git a/src/tasks/utils/oran_monitor.cr b/src/tasks/utils/oran_monitor.cr index 2b7182f61..e13b391af 100644 --- a/src/tasks/utils/oran_monitor.cr +++ b/src/tasks/utils/oran_monitor.cr @@ -2,30 +2,26 @@ require "cluster_tools" require "./k8s_tshark.cr" module ORANMonitor - def self.isCNFaRIC?(cnf_config) + def self.isCNFaRIC?(config) Log.info { "isCNFaRIC?" } - ric = cnf_config[:ric_label]? - Log.info { "ric: #{ric}" } - ric_key : String = "" - ric_value : String = "" - ric_key = cnf_config[:ric_label].split("=").first if ric - ric_value = cnf_config[:ric_label].split("=").last if ric - if ric && !ric.empty? - Log.info { "cnf is a ric: #{ric}" } + ric_label = config.common.five_g_parameters.ric_label + Log.info { "ric: #{ric_label}" } + if !ric_label.nil? && !ric_label.empty? + ric_key = ric_label.split("=").first + ric_value = ric_label.split("=").last + Log.info { "cnf is a ric" } ret = {:ric_key => ric_key, :ric_value => ric_value} else - Log.info { "cnf not a ric: #{ric}" } + Log.info { "cnf not a ric" } ret = nil end ret end - def self.start_e2_capture?(cnf_config) + def self.start_e2_capture?(config) Log.info { "start_e2_capture" } - ric_key : String = "" - ric_value : String = "" capture : K8sTshark::TsharkPacketCapture | Nil - ric = isCNFaRIC?(cnf_config) + ric = isCNFaRIC?(config) if ric ric_key = ric[:ric_key] ric_value = ric[:ric_value] diff --git a/src/tasks/utils/points.cr b/src/tasks/utils/points.cr index 0ce210f55..236ee4b47 100644 --- a/src/tasks/utils/points.cr +++ b/src/tasks/utils/points.cr @@ -1,6 +1,5 @@ require "totem" require "colorize" -require "./types/cnf_testsuite_yml_type.cr" require "helm" require "uuid" diff --git a/src/tasks/utils/srsran.cr b/src/tasks/utils/srsran.cr index d90792fa0..e28735cfd 100644 --- a/src/tasks/utils/srsran.cr +++ b/src/tasks/utils/srsran.cr @@ -14,28 +14,25 @@ module SRSRAN def self.install(config) Log.info {"Installing srsran"} - core = config.cnf_config[:amf_label]? + core = config.common.five_g_parameters.amf_label Log.info { "core: #{core}" } #todo use sane defaults (i.e. search for amf, upf, etc in pod names) if no 5gcore labels are present - amf_service_name = config.cnf_config[:fiveG_core][:amf_service_name]? - mmc = config.cnf_config[:fiveG_core][:mmc]? - mnc = config.cnf_config[:fiveG_core][:mnc]? - sst = config.cnf_config[:fiveG_core][:sst]? - sd = config.cnf_config[:fiveG_core][:sd]? - tac = config.cnf_config[:fiveG_core][:tac]? - enabled = config.cnf_config[:fiveG_core][:enabled]? - count = config.cnf_config[:fiveG_core][:count]? - initialMSISDN = config.cnf_config[:fiveG_core][:initialMSISDN]? - key = config.cnf_config[:fiveG_core][:key]? - op = config.cnf_config[:fiveG_core][:op]? - opType = config.cnf_config[:fiveG_core][:opType]? - type = config.cnf_config[:fiveG_core][:type]? - apn = config.cnf_config[:fiveG_core][:apn]? - emergency = config.cnf_config[:fiveG_core][:emergency]? - core_key : String = "" - core_value : String = "" - core_key = config.cnf_config[:amf_label].split("=").first if core - core_value = config.cnf_config[:amf_label].split("=").last if core + amf_service_name = config.common.five_g_parameters.amf_service_name + mmc = config.common.five_g_parameters.mmc + mnc = config.common.five_g_parameters.mnc + sst = config.common.five_g_parameters.sst + sd = config.common.five_g_parameters.sd + tac = config.common.five_g_parameters.tac + enabled = config.common.five_g_parameters.enabled + count = config.common.five_g_parameters.count + initialMSISDN = config.common.five_g_parameters.initialMSISDN + key = config.common.five_g_parameters.key + op = config.common.five_g_parameters.op + opType = config.common.five_g_parameters.opType + type = config.common.five_g_parameters.type + apn = config.common.five_g_parameters.apn + emergency = config.common.five_g_parameters.emergency + if core all_pods = KubectlClient::Get.pods_by_nodes(KubectlClient::Get.schedulable_nodes_list) ueran_pods = KubectlClient::Get.pods_by_label(all_pods, "app.kubernetes.io/name", "ueransim-gnb") @@ -48,21 +45,21 @@ module SRSRAN Helm.helm_repo_add("openverso","https://gradiant.github.io/openverso-charts/") Helm.fetch("openverso/ueransim-gnb --version 0.2.5 --untar") - protectionScheme = config.cnf_config[:fiveG_core][:protectionScheme] - unless protectionScheme.empty? - protectionScheme = "protectionScheme: #{config.cnf_config[:fiveG_core][:protectionScheme]}" + protectionScheme = config.common.five_g_parameters.protectionScheme + unless protectionScheme.nil? || protectionScheme.empty? + protectionScheme = "protectionScheme: #{protectionScheme}" end - publicKey = config.cnf_config[:fiveG_core][:publicKey] - unless publicKey.empty? - publicKey = "publicKey: '#{config.cnf_config[:fiveG_core][:publicKey]}'" + publicKey = config.common.five_g_parameters.publicKey + unless publicKey.nil? || publicKey.empty? + publicKey = "publicKey: '#{publicKey}'" end - publicKeyId = config.cnf_config[:fiveG_core][:publicKeyId] - unless publicKeyId.empty? - publicKeyId = "publicKeyId: #{config.cnf_config[:fiveG_core][:publicKeyId]}" + publicKeyId = config.common.five_g_parameters.publicKeyId + unless publicKeyId.nil? || publicKeyId.empty? + publicKeyId = "publicKeyId: #{publicKeyId}" end - routingIndicator = config.cnf_config[:fiveG_core][:routingIndicator] - unless routingIndicator.empty? - routingIndicator = "routingIndicator: '#{config.cnf_config[:fiveG_core][:routingIndicator]}'" + routingIndicator = config.common.five_g_parameters.routingIndicator + unless routingIndicator.nil? || routingIndicator.empty? + routingIndicator = "routingIndicator: '#{routingIndicator}'" end ue_values = UERANSIM::Template.new(amf_service_name, diff --git a/src/tasks/utils/task.cr b/src/tasks/utils/task.cr index 2f07e9a9a..74c839824 100644 --- a/src/tasks/utils/task.cr +++ b/src/tasks/utils/task.cr @@ -1,6 +1,5 @@ require "totem" require "colorize" -require "./types/cnf_testsuite_yml_type.cr" require "helm" require "uuid" require "./points.cr" @@ -23,7 +22,7 @@ module CNFManager end end - def self.task_runner(args, task : Sam::Task|Nil=nil, check_cnf_installed=true, &block : Sam::Args, CNFManager::Config -> String | Colorize::Object(String) | CNFManager::TestcaseResult | Nil) + def self.task_runner(args, task : Sam::Task|Nil=nil, check_cnf_installed=true, &block : Sam::Args, CNFInstall::Config::Config -> String | Colorize::Object(String) | CNFManager::TestcaseResult | Nil) LOGGING.info("task_runner args: #{args.inspect}") CNFManager::Points::Results.ensure_results_file! @@ -40,7 +39,7 @@ module CNFManager end # TODO give example for calling - def self.all_cnfs_task_runner(args, task : Sam::Task|Nil=nil, &block : Sam::Args, CNFManager::Config -> String | Colorize::Object(String) | CNFManager::TestcaseResult | Nil) + def self.all_cnfs_task_runner(args, task : Sam::Task|Nil=nil, &block : Sam::Args, CNFInstall::Config::Config -> String | Colorize::Object(String) | CNFManager::TestcaseResult | Nil) cnf_configs = CNFManager.cnf_config_list(silent: true) Log.info { "CNF configs found: #{cnf_configs.size}" } @@ -57,51 +56,21 @@ module CNFManager end # TODO give example for calling - def self.single_task_runner(args, task : Sam::Task|Nil=nil, &block : Sam::Args, CNFManager::Config -> String | Colorize::Object(String) | CNFManager::TestcaseResult | Nil) + def self.single_task_runner(args, task : Sam::Task|Nil=nil, &block : Sam::Args, CNFInstall::Config::Config -> String | Colorize::Object(String) | CNFManager::TestcaseResult | Nil) LOGGING.debug("single_task_runner args: #{args.inspect}") begin if args.named["cnf-config"]? # platform tests don't have a cnf-config - config = CNFManager::Config.parse_config_yml(args.named["cnf-config"].as(String)) + config = CNFInstall::Config.parse_cnf_config_from_file(args.named["cnf-config"].as(String)) else - config = CNFManager::Config.new({ destination_cnf_dir: "", - source_cnf_dir: "", - install_method: {CNFInstall::InstallMethod::HelmChart, ""}, - manifest_directory: "", - helm_directory: "", - release_name: "", - helm_repository: {name: "", repo_url: ""}, - helm_chart: "", - helm_values: "", - helm_install_namespace: "", - container_names: [{"name" => "", "rolling_update_test_tag" => ""}], - white_list_container_names: [""], - docker_insecure_registries: [] of String, - amf_label: "", - smf_label: "", - upf_label: "", - ric_label: "", - fiveG_core: {amf_service_name: "", - mmc: "", - mnc: "", - sst: "", - sd: "", - tac: "", - protectionScheme: "", - publicKey: "", - publicKeyId: "", - routingIndicator: "", - enabled: "", - count: "", - initialMSISDN: "", - key: "", - op: "", - opType: "", - type: "", - apn: "", - emergency: "", - }, - image_registry_fqdns: Hash(String, String).new} ) + yaml_string = <<-YAML + config_version: v2 + deployments: + helm_dirs: + - name: "platform-test-dummy-deployment" + helm_directory: "" + YAML + config = CNFInstall::Config.parse_cnf_config_from_yaml(yaml_string, config_dir: FileUtils.pwd) end test_start_time = Time.utc if task diff --git a/src/tasks/utils/types/cnf_testsuite_yml_type.cr b/src/tasks/utils/types/cnf_testsuite_yml_type.cr deleted file mode 100644 index 0d01c9afa..000000000 --- a/src/tasks/utils/types/cnf_testsuite_yml_type.cr +++ /dev/null @@ -1,47 +0,0 @@ -require "json" - -# NOTE: want add/change a bunch of new fields and don't want to figure out how to do it manually? -# -# in a script or using icr -# -# require "./src/tasks/utils/cnf_manager.cr" -# config = cnf_testsuite_yml -# config.settings.to_json -# -# now take that json here https://app.quicktype.io/?share=Tfokny8vUaAeJ7XDOTSo -# and generate new types - -# https://crystal-lang.org/api/0.34.0/JSON/Serializable.html -class CnfTestSuiteYmlType - include JSON::Serializable - include JSON::Serializable::Unmapped - - macro methods - {{ @type.methods.map &.name.stringify }} - end - - property helm_directory : String? - - property release_name : String? - - property helm_repository : HelmRepositoryType? - - property helm_chart : String? - - property helm_install_namespace : String? - - property rollback_from_tag : String? - - property allowlist_helm_chart_container_names : Array(String)? - - # property container_names : Array(Hash(String,String)) -end - -class HelmRepositoryType - include JSON::Serializable - include JSON::Serializable::Unmapped - - property name : String? - - property repo_url : String? -end diff --git a/src/tasks/utils/ueransim.cr b/src/tasks/utils/ueransim.cr index 37f6c39fe..011effb0a 100644 --- a/src/tasks/utils/ueransim.cr +++ b/src/tasks/utils/ueransim.cr @@ -9,28 +9,25 @@ module UERANSIM def self.install(config) Log.info {"Installing ueransim with 5g config"} - core = config.cnf_config[:amf_label]? + core = config.common.five_g_parameters.amf_label Log.info { "core: #{core}" } #todo use sane defaults (i.e. search for amf, upf, etc in pod names) if no 5gcore labels are present - amf_service_name = config.cnf_config[:fiveG_core][:amf_service_name]? - mmc = config.cnf_config[:fiveG_core][:mmc]? - mnc = config.cnf_config[:fiveG_core][:mnc]? - sst = config.cnf_config[:fiveG_core][:sst]? - sd = config.cnf_config[:fiveG_core][:sd]? - tac = config.cnf_config[:fiveG_core][:tac]? - enabled = config.cnf_config[:fiveG_core][:enabled]? - count = config.cnf_config[:fiveG_core][:count]? - initialMSISDN = config.cnf_config[:fiveG_core][:initialMSISDN]? - key = config.cnf_config[:fiveG_core][:key]? - op = config.cnf_config[:fiveG_core][:op]? - opType = config.cnf_config[:fiveG_core][:opType]? - type = config.cnf_config[:fiveG_core][:type]? - apn = config.cnf_config[:fiveG_core][:apn]? - emergency = config.cnf_config[:fiveG_core][:emergency]? - core_key : String = "" - core_value : String = "" - core_key = config.cnf_config[:amf_label].split("=").first if core - core_value = config.cnf_config[:amf_label].split("=").last if core + amf_service_name = config.common.five_g_parameters.amf_service_name + mmc = config.common.five_g_parameters.mmc + mnc = config.common.five_g_parameters.mnc + sst = config.common.five_g_parameters.sst + sd = config.common.five_g_parameters.sd + tac = config.common.five_g_parameters.tac + enabled = config.common.five_g_parameters.enabled + count = config.common.five_g_parameters.count + initialMSISDN = config.common.five_g_parameters.initialMSISDN + key = config.common.five_g_parameters.key + op = config.common.five_g_parameters.op + opType = config.common.five_g_parameters.opType + type = config.common.five_g_parameters.type + apn = config.common.five_g_parameters.apn + emergency = config.common.five_g_parameters.emergency + if core all_pods = KubectlClient::Get.pods_by_nodes(KubectlClient::Get.schedulable_nodes_list) ueran_pods = KubectlClient::Get.pods_by_label(all_pods, "app.kubernetes.io/name", "ueransim-gnb") @@ -44,21 +41,21 @@ module UERANSIM # Helm.fetch("openverso/ueransim-gnb --version 0.2.5 --untar") Helm.fetch("oci://registry-1.docker.io/gradiant/ueransim-gnb --version 0.2.5 --untar") - protectionScheme = config.cnf_config[:fiveG_core][:protectionScheme] - unless protectionScheme.empty? - protectionScheme = "protectionScheme: #{config.cnf_config[:fiveG_core][:protectionScheme]}" + protectionScheme = config.common.five_g_parameters.protectionScheme + unless protectionScheme.nil? || protectionScheme.empty? + protectionScheme = "protectionScheme: #{protectionScheme}" end - publicKey = config.cnf_config[:fiveG_core][:publicKey] - unless publicKey.empty? - publicKey = "publicKey: '#{config.cnf_config[:fiveG_core][:publicKey]}'" + publicKey = config.common.five_g_parameters.publicKey + unless publicKey.nil? || publicKey.empty? + publicKey = "publicKey: '#{publicKey}'" end - publicKeyId = config.cnf_config[:fiveG_core][:publicKeyId] - unless publicKeyId.empty? - publicKeyId = "publicKeyId: #{config.cnf_config[:fiveG_core][:publicKeyId]}" + publicKeyId = config.common.five_g_parameters.publicKeyId + unless publicKeyId.nil? || publicKeyId.empty? + publicKeyId = "publicKeyId: #{publicKeyId}" end - routingIndicator = config.cnf_config[:fiveG_core][:routingIndicator] - unless routingIndicator.empty? - routingIndicator = "routingIndicator: '#{config.cnf_config[:fiveG_core][:routingIndicator]}'" + routingIndicator = config.common.five_g_parameters.routingIndicator + unless routingIndicator.nil? || routingIndicator.empty? + routingIndicator = "routingIndicator: '#{routingIndicator}'" end ue_values = UERANSIM::Template.new(amf_service_name, diff --git a/src/tasks/utils/utils.cr b/src/tasks/utils/utils.cr index 657fb5187..ea0321cf7 100644 --- a/src/tasks/utils/utils.cr +++ b/src/tasks/utils/utils.cr @@ -11,6 +11,7 @@ require "./dockerd.cr" require "./kyverno.cr" require "./http_helper.cr" require "./timeouts.cr" +require "./cnf_installation/config.cr" require "ecr" module ShellCmd diff --git a/src/tasks/workload/5g_validator.cr b/src/tasks/workload/5g_validator.cr index 5a9c95a1c..627fe411c 100644 --- a/src/tasks/workload/5g_validator.cr +++ b/src/tasks/workload/5g_validator.cr @@ -40,16 +40,15 @@ task "smf_upf_heartbeat" do |t, args| end suci_found : Bool | Nil - smf = config.cnf_config[:smf_label]? - upf = config.cnf_config[:upf_label]? + smf = config.common.five_g_parameters.smf_label + upf = config.common.five_g_parameters.upf_label Log.info { "smf: #{smf}" } Log.info { "upf: #{upf}" } - smf_key : String = "" - smf_value : String = "" - smf_key = config.cnf_config[:smf_label].split("=").first if smf - smf_value = config.cnf_config[:smf_label].split("=").last if upf + - if smf && upf + if smf && upf + smf_key = smf.split("=").first + smf_value = smf.split("=").last #todo document 3gpp standard for heartbeat command = "-ni any -Y 'pfcp.msg_type == 1 or pfcp.msg_type == 2' -T json" @@ -126,15 +125,13 @@ desc "Test if a 5G core supports SUCI Concealment" task "suci_enabled" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| suci_found : Bool | Nil - core = config.cnf_config[:amf_label]? + core = config.common.five_g_parameters.amf_label Log.info { "core: #{core}" } - core_key : String = "" - core_value : String = "" - core_key = config.cnf_config[:amf_label].split("=").first if core - core_value = config.cnf_config[:amf_label].split("=").last if core command = "-ni any -Y nas_5gs.mm.type_id -T json" - if core + if core + core_key = core.split("=").first + core_value = core.split("=").last K8sTshark::TsharkPacketCapture.begin_capture_by_label(core_key, core_value, command) do |capture| #todo put in prereq UERANSIM.install(config) diff --git a/src/tasks/workload/compatibility.cr b/src/tasks/workload/compatibility.cr index e4a46b2cb..13421494a 100644 --- a/src/tasks/workload/compatibility.cr +++ b/src/tasks/workload/compatibility.cr @@ -6,10 +6,10 @@ require "totem" require "docker_client" require "../utils/utils.cr" -rolling_version_change_test_names = ["rolling_update", "rolling_downgrade", "rolling_version_change"] + desc "The CNF test suite checks to see if CNFs support horizontal scaling (across multiple machines) and vertical scaling (between sizes of machines) by using the native K8s kubectl" -task "compatibility", ["helm_chart_valid", "helm_chart_published", "helm_deploy", "cni_compatible", "increase_decrease_capacity", "rollback"].concat(rolling_version_change_test_names) do |_, args| +task "compatibility", ["helm_chart_valid", "helm_chart_published", "helm_deploy", "cni_compatible", "increase_decrease_capacity", "rollback"].concat(ROLLING_VERSION_CHANGE_TEST_NAMES) do |_, args| stdout_score("compatibility", "Compatibility, Installability, and Upgradeability") case "#{ARGV.join(" ")}" when /compatibility/ @@ -17,14 +17,14 @@ task "compatibility", ["helm_chart_valid", "helm_chart_published", "helm_deploy" end end -rolling_version_change_test_names.each do |tn| +ROLLING_VERSION_CHANGE_TEST_NAMES.each do |tn| pretty_test_name = tn.split(/:|_/).join(" ") pretty_test_name_capitalized = tn.split(/:|_/).map(&.capitalize).join(" ") desc "Test if the CNF containers are loosely coupled by performing a #{pretty_test_name}" task "#{tn}" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - container_names = config.cnf_config[:container_names] + container_names = config.common.container_names Log.for(t.name).debug { "container_names: #{container_names}" } update_applied = true unless container_names @@ -44,9 +44,9 @@ rolling_version_change_test_names.each do |tn| Log.for(t.name).debug { "container: #{container}" } Log.for(t.name).debug { "container_names: #{container_names}" } #todo use skopeo to get the next and previous versions of the cnf image dynamically - config_container = container_names.find{|x| x["name"]==container.as_h["name"]} if container_names + config_container = container_names.find{|x| x.name==container.as_h["name"]} if container_names LOGGING.debug "config_container: #{config_container}" - unless config_container && config_container["#{tn}_test_tag"]? && !config_container["#{tn}_test_tag"].empty? + unless config_container && !config_container.get_container_tag(tn).empty? puts "Please add the container name #{container.as_h["name"]} and a corresponding #{tn}_test_tag into your cnf-testsuite.yml under container names".colorize(:red) valid_cnf_testsuite_yml = false end @@ -60,7 +60,7 @@ rolling_version_change_test_names.each do |tn| container.as_h["name"].as_s, # split out image name from version tag container.as_h["image"].as_s.rpartition(":")[0], - config_container["#{tn}_test_tag"], + config_container.get_container_tag(tn), namespace: namespace ) else @@ -94,7 +94,7 @@ end desc "Test if the CNF can perform a rollback" task "rollback" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - container_names = config.cnf_config[:container_names] + container_names = config.common.container_names Log.for(t.name).debug { "container_names: #{container_names}" } update_applied = true @@ -123,13 +123,13 @@ task "rollback" do |t, args| version_change_applied = true # compare cnf_testsuite.yml container list with the current container name - config_container = container_names.find{|x| x["name"] == container_name } if container_names - unless config_container && config_container["rollback_from_tag"]? && !config_container["rollback_from_tag"].empty? + config_container = container_names.find{|x| x.name == container_name } if container_names + unless config_container && !config_container.get_container_tag("rollback_from").empty? stdout_failure("Please add the container name #{container.as_h["name"]} and a corresponding rollback_from_tag into your cnf-testsuite.yml under container names") version_change_applied = false end if version_change_applied && config_container - rollback_from_tag = config_container["rollback_from_tag"] + rollback_from_tag = config_container.get_container_tag("rollback_from") if rollback_from_tag == image_tag stdout_failure("Rollback not possible. Please specify a different version than the helm chart default image.tag for 'rollback_from_tag' ") @@ -390,9 +390,7 @@ task "helm_deploy" do |t, args| CNFManager::Task.task_runner(args, task: t, check_cnf_installed: false) do |args, config| if check_cnf_config(args) || CNFManager.destination_cnfs_exist? - helm_chart = config.cnf_config[:helm_chart] - helm_directory = config.cnf_config[:helm_directory] - release_name = config.cnf_config[:release_name] + release_name = config.deployments.get_deployment_param(:name) configmap = KubectlClient::Get.configmap("cnf-testsuite-#{release_name}-startup-information") #TODO check if json is empty helm_used = configmap["data"].as_h["helm_used"].as_s @@ -415,17 +413,14 @@ task "helm_chart_published", ["helm_local_install"] do |t, args| Log.for("verbose").debug { "helm_chart_published args.named: #{args.named}" } end - # config = cnf_testsuite_yml - # config = CNFManager.parsed_config_file(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) - # helm_chart = "#{config.get("helm_chart").as_s?}" - helm_chart = config.cnf_config[:helm_chart] + helm_chart_name = config.deployments.get_deployment_param(:helm_chart_name) current_dir = FileUtils.pwd helm = Helm::BinarySingleton.helm Log.for("verbose").debug { helm } if check_verbose(args) if CNFManager.helm_repo_add(args: args) - unless helm_chart.empty? - helm_search_cmd = "#{helm} search repo #{helm_chart}" + unless helm_chart_name.empty? + helm_search_cmd = "#{helm} search repo #{helm_chart_name}" Log.for(t.name).info { "helm search command: #{helm_search_cmd}" } Process.run( helm_search_cmd, @@ -458,7 +453,7 @@ task "helm_chart_valid", ["helm_local_install"] do |t, args| response = String::Builder.new - helm_directory = config.cnf_config[:helm_directory] + helm_directory = config.deployments.get_deployment_param(:helm_directory) if helm_directory.empty? working_chart_directory = "exported_chart" else @@ -475,7 +470,7 @@ task "helm_chart_valid", ["helm_local_install"] do |t, args| Log.for(t.name).debug { "current dir: #{current_dir}" } helm = Helm::BinarySingleton.helm - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir helm_lint_cmd = "#{helm} lint #{destination_cnf_dir}/#{working_chart_directory}" helm_lint_status = Process.run( @@ -495,17 +490,6 @@ task "helm_chart_valid", ["helm_local_install"] do |t, args| end end -task "validate_config" do |_, args| - yml = CNFManager.parsed_config_file(CNFManager.ensure_cnf_testsuite_yml_path(args.named["cnf-config"].as(String))) - valid, warning_output = CNFManager.validate_cnf_testsuite_yml(yml) - emoji_config="📋" - if valid - stdout_success "CNF configuration validated #{emoji_config}" - else - stdout_failure "Critical Error with CNF Configuration. Please review USAGE.md for steps to set up a valid CNF configuration file #{emoji_config}" - end -end - def setup_calico_cluster(cluster_name : String) : KindManager::Cluster Log.info { "Running cni_compatible(Cluster Creation)" } Helm.helm_repo_add("projectcalico","https://docs.projectcalico.org/charts") diff --git a/src/tasks/workload/configuration.cr b/src/tasks/workload/configuration.cr index d8e4b9040..354b52361 100644 --- a/src/tasks/workload/configuration.cr +++ b/src/tasks/workload/configuration.cr @@ -106,8 +106,7 @@ task "ip_addresses" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| cdir = FileUtils.pwd() response = String::Builder.new - helm_directory = config.cnf_config[:helm_directory] - helm_chart_path = CNFManager::Config.get_helm_chart_path(config) + helm_chart_path = CNFInstall::Config.get_helm_chart_path(config) Log.info { "Path: #{helm_chart_path}" } if File.directory?(helm_chart_path) # Switch to the helm chart directory @@ -190,8 +189,6 @@ desc "Does the CNF use NodePort" task "nodeport_not_used" do |t, args| # TODO rename task_runner to multi_cnf_task_runner CNFManager::Task.task_runner(args, task: t) do |args, config| - release_name = config.cnf_config[:release_name] - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] task_response = CNFManager.workload_resource_test(args, config, check_containers: false, check_service: true) do |resource, container, initialized| Log.for(t.name).info { "nodeport_not_used resource: #{resource}" } if resource["kind"].downcase == "service" @@ -220,9 +217,6 @@ end desc "Does the CNF use HostPort" task "hostport_not_used" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - release_name = config.cnf_config[:release_name] - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] - task_response = CNFManager.workload_resource_test(args, config, check_containers: false, check_service: true) do |resource, container, initialized| Log.for(t.name).info { "hostport_not_used resource: #{resource}" } test_passed=true @@ -264,18 +258,17 @@ end desc "Does the CNF have hardcoded IPs in the K8s resource configuration" task "hardcoded_ip_addresses_in_k8s_runtime_configuration" do |t, args| task_response = CNFManager::Task.task_runner(args, task: t) do |args, config| - helm_chart = config.cnf_config[:helm_chart] - helm_directory = config.cnf_config[:helm_directory] - release_name = config.cnf_config[:release_name] - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + helm_chart_name = config.deployments.get_deployment_param(:helm_chart_name) + helm_directory = config.deployments.get_deployment_param(:helm_directory) + destination_cnf_dir = config.dynamic.destination_cnf_dir helm_chart_yml_path = "#{destination_cnf_dir}/helm_chart.yml" current_dir = FileUtils.pwd helm = Helm::BinarySingleton.helm VERBOSE_LOGGING.info "Helm Path: #{helm}" if check_verbose(args) KubectlClient::Create.command("namespace hardcoded-ip-test") - unless helm_chart.empty? - helm_install = Helm.install("--namespace hardcoded-ip-test hardcoded-ip-test #{helm_chart} --dry-run --debug > #{helm_chart_yml_path}") + unless helm_chart_name.empty? + helm_install = Helm.install("--namespace hardcoded-ip-test hardcoded-ip-test #{helm_chart_name} --dry-run --debug > #{helm_chart_yml_path}") else helm_install = Helm.install("--namespace hardcoded-ip-test hardcoded-ip-test #{destination_cnf_dir}/#{helm_directory} --dry-run --debug > #{helm_chart_yml_path}") VERBOSE_LOGGING.info "helm_directory: #{helm_directory}" if check_verbose(args) @@ -514,7 +507,7 @@ task "immutable_configmap" do |t, args| resp = "" task_response = CNFManager::Task.task_runner(args, task: t) do |args, config| - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir # https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/ diff --git a/src/tasks/workload/microservice.cr b/src/tasks/workload/microservice.cr index a4301572f..5d7086b5f 100644 --- a/src/tasks/workload/microservice.cr +++ b/src/tasks/workload/microservice.cr @@ -35,8 +35,6 @@ task "shared_database", ["install_cluster_tools"] do |t, args| resource_ymls = CNFManager.cnf_workload_resources(args, config) { |resource| resource } resource_names = Helm.workload_resource_kind_names(resource_ymls) helm_chart_cnf_services : Array(JSON::Any) - # namespace = CNFManager.namespace_from_parameters(CNFInstall.install_parameters(config)) - # Log.info { "namespace: #{namespace}"} helm_chart_cnf_services = resource_names.map do |resource_name| Log.info { "helm_chart_cnf_services resource_name: #{resource_name}"} if resource_name[:kind].downcase == "service" @@ -104,10 +102,7 @@ end desc "Does the CNF have a reasonable startup time (< 30 seconds)?" task "reasonable_startup_time" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - helm_chart = config.cnf_config[:helm_chart] - helm_directory = config.cnf_config[:helm_directory] - release_name = config.cnf_config[:release_name] - install_method = config.cnf_config[:install_method] + release_name = config.deployments.get_deployment_param(:name) current_dir = FileUtils.pwd helm = Helm::BinarySingleton.helm @@ -187,10 +182,7 @@ end desc "Does the CNF have a reasonable container image size (< 5GB)?" task "reasonable_image_size" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args,config| - docker_insecure_registries = [] of String - if config.cnf_config[:docker_insecure_registries]? && !config.cnf_config[:docker_insecure_registries].nil? - docker_insecure_registries = config.cnf_config[:docker_insecure_registries].not_nil! - end + docker_insecure_registries = config.common.docker_insecure_registries || [] of String unless Dockerd.install(docker_insecure_registries) next CNFManager::TestcaseResult.new(CNFManager::ResultStatus::Skipped, "Skipping reasonable_image_size: Dockerd tool failed to install") end @@ -198,7 +190,7 @@ task "reasonable_image_size" do |t, args| Log.for(t.name).debug { "cnf_config: #{config}" } task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| - source_cnf_dir = config.cnf_config[:source_cnf_dir] + source_cnf_dir = config.dynamic.source_cnf_dir if resource["kind"].downcase == "deployment" || resource["kind"].downcase == "statefulset" || @@ -215,8 +207,9 @@ task "reasonable_image_size" do |t, args| # If FQDN mapping is available for the registry, # replace the host in the fqdn_image - if config.cnf_config[:image_registry_fqdns]? && !config.cnf_config[:image_registry_fqdns].nil? - image_registry_fqdns = config.cnf_config[:image_registry_fqdns].not_nil! + image_registry_fqdns = config.common.image_registry_fqdns + if !image_registry_fqdns.nil? && !image_registry_fqdns.empty? + image_registry_fqdns = image_registry_fqdns.not_nil! if image_registry_fqdns[image_host]? image_url_parts[0] = image_registry_fqdns[image_host] fqdn_image = image_url_parts.join("/") diff --git a/src/tasks/workload/observability.cr b/src/tasks/workload/observability.cr index eac6d4f97..3e53db9bb 100644 --- a/src/tasks/workload/observability.cr +++ b/src/tasks/workload/observability.cr @@ -42,8 +42,8 @@ end desc "Does the CNF emit prometheus traffic" task "prometheus_traffic" do |t, args| task_response = CNFManager::Task.task_runner(args, task: t) do |args, config| - release_name = config.cnf_config[:release_name] - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + release_name = config.deployments.get_deployment_param(:name) + destination_cnf_dir = config.dynamic.destination_cnf_dir do_this_on_each_retry = ->(ex : Exception, attempt : Int32, elapsed_time : Time::Span, next_interval : Time::Span) do Log.info { "#{ex.class}: '#{ex.message}' - #{attempt} attempt in #{elapsed_time} seconds and #{next_interval} seconds until the next try."} @@ -159,7 +159,7 @@ end desc "Does the CNF emit prometheus open metric compatible traffic" task "open_metrics", ["prometheus_traffic"] do |t, args| task_response = CNFManager::Task.task_runner(args, task: t) do |args, config| - release_name = config.cnf_config[:release_name] + release_name = config.deployments.get_deployment_param(:name) configmap = KubectlClient::Get.configmap("cnf-testsuite-#{release_name}-open-metrics") if configmap != EMPTY_JSON open_metrics_validated = configmap["data"].as_h["open_metrics_validated"].as_s @@ -221,9 +221,7 @@ task "tracing" do |t, args| match = JaegerManager.match() Log.info { "jaeger match: #{match}" } if match[:found] - helm_chart = config.cnf_config[:helm_chart] - helm_directory = config.cnf_config[:helm_directory] - release_name = config.cnf_config[:release_name] + release_name = config.deployments.get_deployment_param(:name) configmap = KubectlClient::Get.configmap("cnf-testsuite-#{release_name}-startup-information") #TODO check if json is empty tracing_used = configmap["data"].as_h["tracing_used"].as_s diff --git a/src/tasks/workload/ran.cr b/src/tasks/workload/ran.cr index 946a99b0e..1a4bc8d88 100644 --- a/src/tasks/workload/ran.cr +++ b/src/tasks/workload/ran.cr @@ -16,8 +16,8 @@ end desc "Test if RAN uses the ORAN e2 interface" task "oran_e2_connection" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - release_name = config.cnf_config[:release_name] - if ORANMonitor.isCNFaRIC?(config.cnf_config) + release_name = config.deployments.get_deployment_param(:name) + if ORANMonitor.isCNFaRIC?(config) configmap = KubectlClient::Get.configmap("cnf-testsuite-#{release_name}-startup-information") e2_found = configmap["data"].as_h["e2_found"].as_s diff --git a/src/tasks/workload/reliability.cr b/src/tasks/workload/reliability.cr index 8d1bb7572..abc1096ff 100644 --- a/src/tasks/workload/reliability.cr +++ b/src/tasks/workload/reliability.cr @@ -87,7 +87,7 @@ task "pod_network_latency", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| #todo if args has list of labels to perform test on, go into pod specific mode #TODO tests should fail if cnf not installed - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| Log.info { "Current Resource Name: #{resource["name"]} Type: #{resource["kind"]}" } app_namespace = resource[:namespace] || CNFManager.get_deployment_namespace(config) @@ -185,7 +185,7 @@ desc "Does the CNF crash when network corruption occurs" task "pod_network_corruption", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| #TODO tests should fail if cnf not installed - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| Log.info {"Current Resource Name: #{resource["name"]} Type: #{resource["kind"]}"} app_namespace = resource[:namespace] || CNFManager.get_deployment_namespace(config) @@ -239,7 +239,7 @@ desc "Does the CNF crash when network duplication occurs" task "pod_network_duplication", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| #TODO tests should fail if cnf not installed - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| app_namespace = resource[:namespace] || CNFManager.get_deployment_namespace(config) Log.info{ "Current Resource Name: #{resource["name"]} Type: #{resource["kind"]} Namespace: #{resource["namespace"]}"} @@ -294,7 +294,7 @@ end desc "Does the CNF crash when disk fill occurs" task "disk_fill", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| app_namespace = resource[:namespace] || CNFManager.get_deployment_namespace(config) spec_labels = KubectlClient::Get.resource_spec_labels(resource["kind"], resource["name"], resource["namespace"]) @@ -351,7 +351,7 @@ end desc "Does the CNF crash when pod-delete occurs" task "pod_delete", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir #todo clear all annotations task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| app_namespace = resource[:namespace] || CNFManager.get_deployment_namespace(config) @@ -452,7 +452,7 @@ end desc "Does the CNF crash when pod-memory-hog occurs" task "pod_memory_hog", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| app_namespace = resource[:namespace] || CNFManager.get_deployment_namespace(config) spec_labels = KubectlClient::Get.resource_spec_labels(resource["kind"], resource["name"], resource["namespace"]) @@ -510,7 +510,7 @@ end desc "Does the CNF crash when pod-io-stress occurs" task "pod_io_stress", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| app_namespace = resource[:namespace] || CNFManager.get_deployment_namespace(config) spec_labels = KubectlClient::Get.resource_spec_labels(resource["kind"], resource["name"], resource["namespace"]) @@ -572,7 +572,7 @@ end desc "Does the CNF crash when pod-dns-error occurs" task "pod_dns_error", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir runtimes = KubectlClient::Get.container_runtimes Log.info { "pod_dns_error runtimes: #{runtimes}" } if runtimes.find{|r| r.downcase.includes?("docker")} diff --git a/src/tasks/workload/security.cr b/src/tasks/workload/security.cr index 1233332ba..0b26048b6 100644 --- a/src/tasks/workload/security.cr +++ b/src/tasks/workload/security.cr @@ -138,7 +138,7 @@ end desc "Check if any containers are running in privileged mode" task "privileged_containers" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - white_list_container_names = config.cnf_config[:white_list_container_names] + white_list_container_names = config.common.white_list_container_names VERBOSE_LOGGING.info "white_list_container_names #{white_list_container_names.inspect}" if check_verbose(args) violation_list = [] of NamedTuple(kind: String, name: String, container: String, namespace: String) task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| diff --git a/src/tasks/workload/state.cr b/src/tasks/workload/state.cr index 592cfb6ce..98bc8298c 100644 --- a/src/tasks/workload/state.cr +++ b/src/tasks/workload/state.cr @@ -219,7 +219,7 @@ desc "Does the CNF crash when node-drain occurs" task "node_drain", ["install_litmus"] do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| skipped = false - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] + destination_cnf_dir = config.dynamic.destination_cnf_dir task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized| app_namespace = resource[:namespace] || CNFManager.get_deployment_namespace(config) Log.info { "Current Resource Name: #{resource["kind"]}/#{resource["name"]} Namespace: #{resource["namespace"]}" } @@ -369,7 +369,7 @@ task "elastic_volumes" do |t, args| # todo use workload resource # elastic = WorkloadResource.elastic?(volumes) - namespace = CNFManager.namespace_from_parameters(CNFInstall.install_parameters(config)) || CNFManager.get_deployment_namespace(config) + namespace = CNFManager.get_deployment_namespace(config) full_resource = KubectlClient::Get.resource(resource["kind"], resource["name"], namespace) elastic_result = WorkloadResource.elastic?(full_resource, volumes.as_a, namespace) @@ -404,40 +404,36 @@ task "database_persistence" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| # VERBOSE_LOGGING.info "database_persistence" if check_verbose(args) # todo K8s Database persistence test: if a mysql (or any popular database) image is installed: - all_mysql_elastic_statefulset = true + statefulset_found = false + non_elastic_database_statefulset_found = false match = Mysql.match Log.info {"database_persistence mysql: #{match}"} + deployment_namespace = CNFManager.get_deployment_namespace(config) if match && match[:found] - deployment_namespace = CNFManager.get_deployment_namespace(config) - statefulset_exists = Helm.kind_exists?(args, config, "statefulset", deployment_namespace) - - unless statefulset_exists - all_mysql_elastic_statefulset = false - else - task_response = CNFManager.workload_resource_test(args, config, check_containers: false) do |resource, containers, volumes, initialized| - - # Skip resources that do not have containers with mysql image - images = containers.as_a.map {|container| container["image"]} - next unless images.any? do |image| - Mysql::MYSQL_IMAGES.any? do |mysql_image| - image.as_s.includes?(mysql_image) - end - end - - namespace = resource["namespace"] || deployment_namespace - Log.info {"database_persistence namespace: #{namespace}"} - Log.info {"database_persistence resource: #{resource}"} - Log.info {"database_persistence volumes: #{volumes}"} - full_resource = KubectlClient::Get.resource(resource["kind"], resource["name"], namespace) - elastic_volume = WorkloadResource.elastic?(full_resource, volumes.as_a, namespace) - Log.info {"database_persistence elastic_volume: #{elastic_volume}"} - - unless resource["kind"].downcase == "statefulset" && elastic_volume - all_mysql_elastic_statefulset = false + task_response = CNFManager.workload_resource_test(args, config, check_containers: false) do |resource, containers, volumes, initialized| + # Skip resources that do not have containers with mysql image + images = containers.as_a.map {|container| container["image"]} + next unless images.any? do |image| + Mysql::MYSQL_IMAGES.any? do |mysql_image| + image.as_s.includes?(mysql_image) end end + # Skip non-statefulset resources + next if resource["kind"].downcase != "statefulset" + + statefulset_found = true + namespace = resource["namespace"] || deployment_namespace + Log.info {"database_persistence namespace: #{namespace}"} + Log.info {"database_persistence resource: #{resource}"} + Log.info {"database_persistence volumes: #{volumes}"} + full_resource = KubectlClient::Get.resource(resource["kind"], resource["name"], namespace) + elastic_volume = WorkloadResource.elastic?(full_resource, volumes.as_a, namespace) + Log.info {"database_persistence elastic_volume: #{elastic_volume}"} + unless elastic_volume + non_elastic_database_statefulset_found = true + end end - if all_mysql_elastic_statefulset + if statefulset_found && !non_elastic_database_statefulset_found CNFManager::TestcaseResult.new(CNFManager::ResultStatus::Pass5, "CNF uses database with cloud-native persistence") else CNFManager::TestcaseResult.new(CNFManager::ResultStatus::Failed, "CNF uses database without cloud-native persistence (ভ_ভ) ރ 💾") @@ -460,7 +456,6 @@ end desc "Does the CNF use a non-cloud native data store: local volumes on the node?" task "no_local_volume_configuration" do |t, args| CNFManager::Task.task_runner(args, task: t) do |args, config| - destination_cnf_dir = config.cnf_config[:destination_cnf_dir] task_response = CNFManager.cnf_workload_resources(args, config) do | resource| hostPath_found = nil begin