--- /dev/null
+# 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
--- /dev/null
+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'
--- /dev/null
+tosca_definitions_version: cloudify_dsl_1_3\r
+\r
+description: >\r
+ Simple blueprint to launch nginx as a "service component"\r
+ Fails because nginx port (80) isn't exposed and health check fails\r
+ max_wait set to 120 so timeout occurs quickly\r
+ expect k8s service/deployment to be created, pod started\r
+ but plugin will clean up k8s after timeout\r
+\r
+imports:\r
+ - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\r
+ - plugin:k8splugin?version=3.0.0\r
+\r
+node_templates:\r
+ web_server:\r
+ type: dcae.nodes.ContainerizedServiceComponent\r
+ properties:\r
+ service_component_type: 'nginx-web'\r
+ image: nginx\r
+ docker_config:\r
+ healthcheck:\r
+ type: "http"\r
+ endpoint: "/"\r
+ ports:\r
+ - '20880:0'\r
+ interfaces:\r
+ cloudify.interfaces.lifecycle:\r
+ start:\r
+ inputs:\r
+ max_wait: 120\r
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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'
--- /dev/null
+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'
--- /dev/null
+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'
--- /dev/null
+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"
--- /dev/null
+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'
--- /dev/null
+tosca_definitions_version: cloudify_dsl_1_3\r
+\r
+description: >\r
+ Simple blueprint to launch nginx as a "service component"\r
+ Policy and location specified. Need a multi-site configuration.\r
+\r
+imports:\r
+ - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\r
+ - plugin:k8splugin?version=3.0.0\r
+ - plugin:dcaepolicyplugin?version=2.4.0\r
+\r
+node_templates:\r
+\r
+ a_policy:\r
+ type: dcae.nodes.policy\r
+ properties:\r
+ policy_id: org.onap.policy007\r
+ policy_required: false\r
+\r
+ web_server:\r
+ type: dcae.nodes.ContainerizedServiceComponent\r
+ properties:\r
+ service_component_type: 'nginx-web'\r
+ image: nginx\r
+ location_id: jfldub\r
+ docker_config:\r
+ healthcheck:\r
+ type: "http"\r
+ endpoint: "/"\r
+ policy:\r
+ trigger_type: "docker"\r
+ script_path: "echo"\r
+ interfaces:\r
+ cloudify.interfaces.lifecycle:\r
+ start:\r
+ inputs:\r
+ ports:\r
+ - '80:0'\r
+ relationships:\r
+ - type: cloudify.relationships.depends_on\r
+ target: a_policy\r
--- /dev/null
+tosca_definitions_version: cloudify_dsl_1_3\r
+\r
+description: >\r
+ Simple blueprint to launch nginx as a "service component"\r
+ Component gets config from policy, but we don't require a_policy\r
+ to be configured in the policy system. Expect to see policy\r
+ plugin pulling empty policy from DCAE policy handler.\r
+ This version does not set up a script that would run when\r
+ a policy is updated.\r
+imports:\r
+ - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\r
+ - plugin:k8splugin?version=3.0.0\r
+ - plugin:dcaepolicyplugin?version=2.4.0\r
+\r
+node_templates:\r
+\r
+ a_policy:\r
+ type: dcae.nodes.policy\r
+ properties:\r
+ policy_id: org.onap.policy007\r
+ policy_required: false\r
+\r
+ web_server:\r
+ type: dcae.nodes.ContainerizedServiceComponent\r
+ properties:\r
+ service_component_type: 'nginx-web'\r
+ image: nginx\r
+ docker_config:\r
+ healthcheck:\r
+ type: "http"\r
+ endpoint: "/"\r
+ ports:\r
+ - '80:0'\r
+ relationships:\r
+ - type: cloudify.relationships.depends_on\r
+ target: a_policy\r
--- /dev/null
+tosca_definitions_version: cloudify_dsl_1_3\r
+\r
+description: >\r
+ Simple blueprint to launch nginx as a "service component"\r
+ Component gets config from policy, but we don't require a_policy\r
+ to be configured in the policy system. Expect to see policy\r
+ plugin pulling empty policy from DCAE policy handler.\r
+\r
+\r
+imports:\r
+ - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\r
+ - plugin:k8splugin?version=3.0.0\r
+ - plugin:dcaepolicyplugin?version=2.4.0\r
+\r
+node_templates:\r
+\r
+ a_policy:\r
+ type: dcae.nodes.policy\r
+ properties:\r
+ policy_id: org.onap.policy007\r
+ policy_required: false\r
+\r
+ web_server:\r
+ type: dcae.nodes.ContainerizedServiceComponent\r
+ properties:\r
+ service_component_type: 'nginx-web'\r
+ image: nginx\r
+ docker_config:\r
+ healthcheck:\r
+ type: "http"\r
+ endpoint: "/"\r
+ policy:\r
+ trigger_type: "docker"\r
+ script_path: "echo"\r
+ ports:\r
+ - '80:0'\r
+ relationships:\r
+ - type: cloudify.relationships.depends_on\r
+ target: a_policy\r
--- /dev/null
+tosca_definitions_version: cloudify_dsl_1_3\r
+\r
+description: >\r
+ Simple blueprint to launch nginx as a "service component"\r
+ Fails because healthcheck script always returns failure\r
+ max_wait set to 120 so timeout occurs quickly\r
+ expect k8s service/deployment to be created, pod started\r
+ but plugin will clean up k8s after timeout\r
+\r
+imports:\r
+ - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\r
+ - plugin:k8splugin?version=3.0.0\r
+\r
+node_templates:\r
+ web_server:\r
+ type: dcae.nodes.ContainerizedServiceComponent\r
+ properties:\r
+ service_component_type: 'nginx-web'\r
+ image: nginx\r
+ docker_config:\r
+ healthcheck:\r
+ type: "script"\r
+ script: "/bin/false"\r
+ ports:\r
+ - '80:0'\r
+ interfaces:\r
+ cloudify.interfaces.lifecycle:\r
+ start:\r
+ inputs:\r
+ max_wait: 120\r
--- /dev/null
+tosca_definitions_version: cloudify_dsl_1_3\r
+\r
+description: >\r
+ Simple blueprint to launch nginx as a "service component"\r
+ Use a script for the healthcheck\r
+\r
+imports:\r
+ - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\r
+ - plugin:k8splugin?version=3.0.0\r
+\r
+node_templates:\r
+ web_server:\r
+ type: dcae.nodes.ContainerizedServiceComponent\r
+ properties:\r
+ service_component_type: 'nginx-web'\r
+ image: nginx\r
+ docker_config:\r
+ healthcheck:\r
+ type: "script"\r
+ script: "/bin/true"\r
+ ports:\r
+ - '80:0'\r
--- /dev/null
+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'
--- /dev/null
+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'
--- /dev/null
+tosca_definitions_version: cloudify_dsl_1_3\r
+\r
+description: >\r
+ Simple blueprint to launch nginx as a "service component"\r
+ Create UDP ports, test /tcp, /udp syntax\r
+\r
+imports:\r
+ - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\r
+ - plugin:k8splugin?version=3.0.0\r
+\r
+node_templates:\r
+ web_server:\r
+ type: dcae.nodes.ContainerizedServiceComponent\r
+ properties:\r
+ service_component_type: 'nginx-web'\r
+ image: nginx\r
+ docker_config:\r
+ healthcheck:\r
+ type: "http"\r
+ endpoint: "/"\r
+ ports:\r
+ - '80:0'\r
+ - '9191/tcp:0'\r
+ - '1919:0'\r
+ - '1919/udp:0'\r
+ - '2060/udp:31060'\r
--- /dev/null
+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'
--- /dev/null
+# 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`
+
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+operation: scale
+operation_kwargs:
+ replicas: 1
+node_ids:
+ - "web_server"
--- /dev/null
+operation: scale
+operation_kwargs:
+ replicas: 3
+node_ids:
+ - "web_server"
--- /dev/null
+operation: update_image
+operation_kwargs:
+ image: nginx:1.15
+node_ids:
+ - "web_server"