From 43f0c2c84a1d1c0e9dd49e41c748f56b5820760b Mon Sep 17 00:00:00 2001 From: Jack Lucas Date: Wed, 12 Aug 2020 11:30:41 -0400 Subject: Add plugin testing blueprints Issue-ID: DCAEGEN2-2352 Signed-off-by: Jack Lucas Change-Id: Icacef912fc24d2814d513bd2df2a6aaed117ebb5 --- k8s/plugin_testing_blueprints/blueprints/README.md | 21 +++++++++++ .../blueprints/nginx-svc-appconfig.yaml | 32 +++++++++++++++++ .../blueprints/nginx-svc-bad.yaml | 30 ++++++++++++++++ .../blueprints/nginx-svc-dmaap-dr-sub.yaml | 41 ++++++++++++++++++++++ .../blueprints/nginx-svc-dmaap-mr-pub.yaml | 36 +++++++++++++++++++ .../blueprints/nginx-svc-env.yaml | 25 +++++++++++++ .../blueprints/nginx-svc-lifecycle-inputs.yaml | 29 +++++++++++++++ .../blueprints/nginx-svc-loc.yaml | 30 ++++++++++++++++ .../blueprints/nginx-svc-log.yaml | 24 +++++++++++++ .../blueprints/nginx-svc-nodeport.yaml | 22 ++++++++++++ .../blueprints/nginx-svc-noports.yaml | 20 +++++++++++ .../blueprints/nginx-svc-override.yaml | 23 ++++++++++++ .../blueprints/nginx-svc-policy-loc.yaml | 41 ++++++++++++++++++++++ .../blueprints/nginx-svc-policy-no-notify.yaml | 36 +++++++++++++++++++ .../blueprints/nginx-svc-policy.yaml | 39 ++++++++++++++++++++ .../blueprints/nginx-svc-script-bad.yaml | 30 ++++++++++++++++ .../blueprints/nginx-svc-script.yaml | 22 ++++++++++++ .../blueprints/nginx-svc-tls-client.yaml | 25 +++++++++++++ .../blueprints/nginx-svc-tls-server.yaml | 27 ++++++++++++++ .../blueprints/nginx-svc-udp.yaml | 26 ++++++++++++++ .../blueprints/nginx-svc.yaml | 21 +++++++++++ k8s/plugin_testing_blueprints/operations/README.md | 14 ++++++++ .../operations/policy_update-bad.yaml | 11 ++++++ .../operations/policy_update.yaml | 11 ++++++ .../operations/scaleto1.yaml | 5 +++ .../operations/scaleto3.yaml | 5 +++ .../operations/update_image-1.15.yaml | 5 +++ 27 files changed, 651 insertions(+) create mode 100644 k8s/plugin_testing_blueprints/blueprints/README.md create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-appconfig.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-bad.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-dmaap-dr-sub.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-dmaap-mr-pub.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-env.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-lifecycle-inputs.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-loc.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-log.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-nodeport.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-noports.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-override.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy-loc.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy-no-notify.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-script-bad.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-script.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-tls-client.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-tls-server.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc-udp.yaml create mode 100644 k8s/plugin_testing_blueprints/blueprints/nginx-svc.yaml create mode 100644 k8s/plugin_testing_blueprints/operations/README.md create mode 100644 k8s/plugin_testing_blueprints/operations/policy_update-bad.yaml create mode 100644 k8s/plugin_testing_blueprints/operations/policy_update.yaml create mode 100644 k8s/plugin_testing_blueprints/operations/scaleto1.yaml create mode 100644 k8s/plugin_testing_blueprints/operations/scaleto3.yaml create mode 100644 k8s/plugin_testing_blueprints/operations/update_image-1.15.yaml diff --git a/k8s/plugin_testing_blueprints/blueprints/README.md b/k8s/plugin_testing_blueprints/blueprints/README.md new file mode 100644 index 0000000..560a51b --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/README.md @@ -0,0 +1,21 @@ +# Blueprints for testing the DCAE Kubernetes plugin +The blueprints in this directory are designed as test cases for the DCAE +Kubernetes Cloudify plugin (`k8splugin`). Each blueprint tests a single +feature, or small set of features, supported by the plugin. + +The testing strategy here is simple and not very automated. Deploying a DCAE +component using a Cloudify blueprint typically has a number of effects (creating a +Kubernetes deployment, creating a Kubernetes service, populating configuration information +into Consul, mounting certain volumes on a container, and so forth). For now at least, we use a +manual process to verify that deployment has had the expected effects: +- we use `kubectl` to checkthat the expected Kubernetes artifacts are created +- we look into Consul to see that the appropriateconfiguration information has been populated (including configuration information that comes +from DMaaP and policy where the blueprint calls for it) +- we `kubectl exec` into the container to verify that the expected environment variables have been set and the expected volumes are mounted and have the correct content + +All of the blueprints deploy the `nginx` image from the public Docker Hub. The blueprints +will generally deploy the `nginx` Web server so that it serves the default Web page on port 80 +of the container and on a NodePort if the blueprint specifies an external port address. +Some of the blueprints set up TLS. The expected result is that the appropriate directories +will be created and will hold the TLS artifacts. We don't actually configure `nginx` to use +TLS. \ No newline at end of file diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-appconfig.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-appconfig.yaml new file mode 100644 index 0000000..4373680 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-appconfig.yaml @@ -0,0 +1,32 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Set nested application configuration + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + application_config: + prop1: "val1" + prop2: 1434 + prop3: ["a", "b", "c"] + prop4: + prop4a: + prop4a1: "val4a1" + prop4a2: 4343 + prop4a3: ["x", "y", "z"] + prop4b: "val4b" + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-bad.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-bad.yaml new file mode 100644 index 0000000..2b51650 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-bad.yaml @@ -0,0 +1,30 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Fails because nginx port (80) isn't exposed and health check fails + max_wait set to 120 so timeout occurs quickly + expect k8s service/deployment to be created, pod started + but plugin will clean up k8s after timeout + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '20880:0' + interfaces: + cloudify.interfaces.lifecycle: + start: + inputs: + max_wait: 120 diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-dmaap-dr-sub.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-dmaap-dr-sub.yaml new file mode 100644 index 0000000..1bbbf34 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-dmaap-dr-sub.yaml @@ -0,0 +1,41 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Creates DR feed and sets up component as subscriber + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:dmaap?version=1.5.0 + - plugin:k8splugin?version=3.0.0 +node_templates: + feed00: + type: dcaegen2.nodes.Feed + properties: + feed_name: feed-000 + feed_version: 2.0.0 + + web_server: + type: dcae.nodes.ContainerizedServiceComponentUsingDmaap + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + ports: + - "80:0" + - "443:0" + healthcheck: + type: "http" + endpoint: "/" + streams_subscribes: + - name: feed00 + type: data_router + location: san-francisco + username: fred + password: fredzW0rd + route: app + scheme: http + + relationships: + - type: dcaegen2.relationships.subscribe_to_files + target: feed00 diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-dmaap-mr-pub.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-dmaap-mr-pub.yaml new file mode 100644 index 0000000..177598c --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-dmaap-mr-pub.yaml @@ -0,0 +1,36 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Create MR topic and set up component as subscriber + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + - plugin:dmaap?version=1.5.0 + +node_templates: + topic00: + type: dcaegen2.nodes.Topic + properties: + topic_name: topic-002 + + web_server: + type: dcae.nodes.ContainerizedServiceComponentUsingDmaap + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' + streams_publishes: + - name: topic00 + location: san-francisco + client_role: org.onap.dmaap.mr.topic-002.publisher + + relationships: + - type: dcaegen2.relationships.publish_events + target: topic00 diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-env.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-env.yaml new file mode 100644 index 0000000..b9e3fae --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-env.yaml @@ -0,0 +1,25 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Set environment variables + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' + envs: + MY_ENV1: value1 + MY_ENV0: value0 diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-lifecycle-inputs.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-lifecycle-inputs.yaml new file mode 100644 index 0000000..61c9de4 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-lifecycle-inputs.yaml @@ -0,0 +1,29 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Set ports and envs via input to lifecycle operation + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + interfaces: + cloudify.interfaces.lifecycle: + start: + inputs: + ports: + - '80:0' + envs: + MY_ENV1: value1 + MY_ENV0: value0 diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-loc.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-loc.yaml new file mode 100644 index 0000000..e1863c6 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-loc.yaml @@ -0,0 +1,30 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Specify a location (need to set up a multi-site configuration) + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + location_id: gallus + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + policy: + trigger_type: "docker" + script_path: "/notify.sh" + interfaces: + cloudify.interfaces.lifecycle: + start: + inputs: + ports: + - '80:0' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-log.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-log.yaml new file mode 100644 index 0000000..61dc274 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-log.yaml @@ -0,0 +1,24 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Specifies a log directory--expect logging sidecar to be deployed + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + log_info: + log_directory: "/opt/logs" + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-nodeport.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-nodeport.yaml new file mode 100644 index 0000000..c22a96b --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-nodeport.yaml @@ -0,0 +1,22 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Exposes port as a NodePort service + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:30580' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-noports.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-noports.yaml new file mode 100644 index 0000000..bf93df4 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-noports.yaml @@ -0,0 +1,20 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Don't specify any ports -- expect no k8s Service to be created + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "script" + script: "/bin/true" diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-override.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-override.yaml new file mode 100644 index 0000000..fdaf1b0 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-override.yaml @@ -0,0 +1,23 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Override service component name + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + service_component_name_override: 'dcae-web-server' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy-loc.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy-loc.yaml new file mode 100644 index 0000000..c09b610 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy-loc.yaml @@ -0,0 +1,41 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Policy and location specified. Need a multi-site configuration. + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + - plugin:dcaepolicyplugin?version=2.4.0 + +node_templates: + + a_policy: + type: dcae.nodes.policy + properties: + policy_id: org.onap.policy007 + policy_required: false + + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + location_id: jfldub + docker_config: + healthcheck: + type: "http" + endpoint: "/" + policy: + trigger_type: "docker" + script_path: "echo" + interfaces: + cloudify.interfaces.lifecycle: + start: + inputs: + ports: + - '80:0' + relationships: + - type: cloudify.relationships.depends_on + target: a_policy diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy-no-notify.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy-no-notify.yaml new file mode 100644 index 0000000..7ae6c36 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy-no-notify.yaml @@ -0,0 +1,36 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Component gets config from policy, but we don't require a_policy + to be configured in the policy system. Expect to see policy + plugin pulling empty policy from DCAE policy handler. + This version does not set up a script that would run when + a policy is updated. +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + - plugin:dcaepolicyplugin?version=2.4.0 + +node_templates: + + a_policy: + type: dcae.nodes.policy + properties: + policy_id: org.onap.policy007 + policy_required: false + + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' + relationships: + - type: cloudify.relationships.depends_on + target: a_policy diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy.yaml new file mode 100644 index 0000000..d8bde75 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-policy.yaml @@ -0,0 +1,39 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Component gets config from policy, but we don't require a_policy + to be configured in the policy system. Expect to see policy + plugin pulling empty policy from DCAE policy handler. + + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + - plugin:dcaepolicyplugin?version=2.4.0 + +node_templates: + + a_policy: + type: dcae.nodes.policy + properties: + policy_id: org.onap.policy007 + policy_required: false + + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + policy: + trigger_type: "docker" + script_path: "echo" + ports: + - '80:0' + relationships: + - type: cloudify.relationships.depends_on + target: a_policy diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-script-bad.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-script-bad.yaml new file mode 100644 index 0000000..d080fd7 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-script-bad.yaml @@ -0,0 +1,30 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Fails because healthcheck script always returns failure + max_wait set to 120 so timeout occurs quickly + expect k8s service/deployment to be created, pod started + but plugin will clean up k8s after timeout + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "script" + script: "/bin/false" + ports: + - '80:0' + interfaces: + cloudify.interfaces.lifecycle: + start: + inputs: + max_wait: 120 diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-script.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-script.yaml new file mode 100644 index 0000000..97306d3 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-script.yaml @@ -0,0 +1,22 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Use a script for the healthcheck + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "script" + script: "/bin/true" + ports: + - '80:0' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-tls-client.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-tls-client.yaml new file mode 100644 index 0000000..02e61ee --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-tls-client.yaml @@ -0,0 +1,25 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Put CA cert in non-default directory + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + tls_info: + use_tls: false + cert_directory: "/opt/altcert" + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-tls-server.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-tls-server.yaml new file mode 100644 index 0000000..aefc0af --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-tls-server.yaml @@ -0,0 +1,27 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Put full certificate materials in non-default location + (Note that we don't configure nginx to actually use the + certificate. This test just installs the certificate.) + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + tls_info: + use_tls: true + cert_directory: "/opt/altcert" + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc-udp.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-udp.yaml new file mode 100644 index 0000000..3eb3019 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc-udp.yaml @@ -0,0 +1,26 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + Create UDP ports, test /tcp, /udp syntax + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' + - '9191/tcp:0' + - '1919:0' + - '1919/udp:0' + - '2060/udp:31060' diff --git a/k8s/plugin_testing_blueprints/blueprints/nginx-svc.yaml b/k8s/plugin_testing_blueprints/blueprints/nginx-svc.yaml new file mode 100644 index 0000000..98078b7 --- /dev/null +++ b/k8s/plugin_testing_blueprints/blueprints/nginx-svc.yaml @@ -0,0 +1,21 @@ +tosca_definitions_version: cloudify_dsl_1_3 + +description: > + Simple blueprint to launch nginx as a "service component" + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.0.0 + +node_templates: + web_server: + type: dcae.nodes.ContainerizedServiceComponent + properties: + service_component_type: 'nginx-web' + image: nginx + docker_config: + healthcheck: + type: "http" + endpoint: "/" + ports: + - '80:0' diff --git a/k8s/plugin_testing_blueprints/operations/README.md b/k8s/plugin_testing_blueprints/operations/README.md new file mode 100644 index 0000000..895427d --- /dev/null +++ b/k8s/plugin_testing_blueprints/operations/README.md @@ -0,0 +1,14 @@ +# Parameter Files for Testing Operations +The k8s plugin supports some operations beyond just installation and uninstallation: +- `scale`: change the number of replicas of component +- `update_image`: change the Docker image used for the component +- `policy_update`: update a component's configuration in Consul and notify the component of the change + +The files in this directory contain parameters for testing the additional operations. +The specific values in the files are tied to values in the blueprints in the `../blueprints` directory. + +## Invoking an operation +Invoking the operations here involves running the Cloudify `execute_operation` workflow. + + `cfy executions start -p `_/path/to/operation_file_` -d `_name_of_cloudify_deployment_` execute_operation` + diff --git a/k8s/plugin_testing_blueprints/operations/policy_update-bad.yaml b/k8s/plugin_testing_blueprints/operations/policy_update-bad.yaml new file mode 100644 index 0000000..29b5bc3 --- /dev/null +++ b/k8s/plugin_testing_blueprints/operations/policy_update-bad.yaml @@ -0,0 +1,11 @@ +operation: dcae.interfaces.policy.policy_update +operation_kwargs: + updated_policies: + - policy_id: org.onap.policy008 + policy_body: + policyVersion: "1463" + policyName: "org.onap.policy007.1463.xml" + config: {"type": "NoParking", "start": "0100", "end": "0630"} +node_ids: + - "web_server" +allow_kwargs_override: true diff --git a/k8s/plugin_testing_blueprints/operations/policy_update.yaml b/k8s/plugin_testing_blueprints/operations/policy_update.yaml new file mode 100644 index 0000000..ef91df2 --- /dev/null +++ b/k8s/plugin_testing_blueprints/operations/policy_update.yaml @@ -0,0 +1,11 @@ +operation: dcae.interfaces.policy.policy_update +operation_kwargs: + updated_policies: + - policy_id: org.onap.policy007 + policy_body: + policyVersion: "1463" + policyName: "org.onap.policy007.1463.xml" + config: {"type": "NoParking", "start": "0100", "end": "0630"} +node_ids: + - "web_server" +allow_kwargs_override: true diff --git a/k8s/plugin_testing_blueprints/operations/scaleto1.yaml b/k8s/plugin_testing_blueprints/operations/scaleto1.yaml new file mode 100644 index 0000000..1cbe4a2 --- /dev/null +++ b/k8s/plugin_testing_blueprints/operations/scaleto1.yaml @@ -0,0 +1,5 @@ +operation: scale +operation_kwargs: + replicas: 1 +node_ids: + - "web_server" diff --git a/k8s/plugin_testing_blueprints/operations/scaleto3.yaml b/k8s/plugin_testing_blueprints/operations/scaleto3.yaml new file mode 100644 index 0000000..e188225 --- /dev/null +++ b/k8s/plugin_testing_blueprints/operations/scaleto3.yaml @@ -0,0 +1,5 @@ +operation: scale +operation_kwargs: + replicas: 3 +node_ids: + - "web_server" diff --git a/k8s/plugin_testing_blueprints/operations/update_image-1.15.yaml b/k8s/plugin_testing_blueprints/operations/update_image-1.15.yaml new file mode 100644 index 0000000..27a2c22 --- /dev/null +++ b/k8s/plugin_testing_blueprints/operations/update_image-1.15.yaml @@ -0,0 +1,5 @@ +operation: update_image +operation_kwargs: + image: nginx:1.15 +node_ids: + - "web_server" -- cgit 1.2.3-korg