xlab-si / xopera-opera

xOpera orchestrator compliant with TOSCA YAML v1.3 in the making
https://xlab-si.github.io/xopera-docs/
Apache License 2.0
35 stars 14 forks source link

Attach playbook to Compute node without defining a new type #237

Closed abitrolly closed 2 years ago

abitrolly commented 2 years ago

Is it possible to execute playbook when tosca.nodes.Compute node template is deployed, without defining a new type?

Using modified example from https://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.3/os/TOSCA-Simple-Profile-YAML-v1.3-os.html#_Toc26969423

tosca_definitions_version: tosca_simple_yaml_1_3

topology_template:
  node_templates:
    db_server:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          configure: scripts/my_own_configure.sh

opera validate errors out with this.

Validating service template...
mysql.yml:11:11: [InterfaceDefinitionForTemplate] Invalid keys: configure
anzoman commented 2 years ago

Hi and thanks for asking this. So, as I can see from TOSCA's documentation a lot of examples are not complete and quite some of them use older TOSCA versions (e.g., 1.0).

I think that your example above is missing operations keyword for TOSCA interface you defined.

slika

You can probably try this:

tosca_definitions_version: tosca_simple_yaml_1_3

topology_template:
  node_templates:
    db_server:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          operations:
            configure: scripts/my_own_configure.sh

And also note that xOpera currently supports only Ansible for running interface operations and we have a plan for adding other executors (e.g., bash, python) in the future.

abitrolly commented 2 years ago

@anzoman are you sure that the example about interface definition can be applied here? Above this example, standard refers to sub-classing behavior, which I believe I am doing.

image

If this example is invalid, why nobody from consortia is interested in updating the invalid spec?

abitrolly commented 2 years ago

Perhaps @lauwers can answer the last question.

lauwers commented 2 years ago

Hi Anatoli, the TOSCA TC is hard at work on TOSCA v2.0. We realize that some of the examples in the v1.3 specification have errors, but getting corrections approved through the OASIS standardization process is fairly cumbersome and we decided our efforts would be better spent by focusing on the quality of the v2.0 spec. As part of this process, we plan on managing all examples in the TOSCA git repo at https://github.com/oasis-open/tosca-community-contributions so they can be run through various parsers and validators. We have just started this effort. As you can imagine there is a fair bit of work involved and we welcome and encourage anyone to contribute and participate if possible, ideally by joining the TOSCA TC. Thanks, Chris

abitrolly commented 2 years ago

@lauwers thanks for the proposal. TOSCA TC list holds addresses from major IT company domains. It looks like both OASIS and TC members are all sponsored by one entity or another, and the thought of doing this job sacrificing my time for free feels very miserable. So unless there is some serious funding involved, I have to refuse.

abitrolly commented 2 years ago

@anzoman this doesn't work.

tosca_definitions_version: tosca_simple_yaml_1_3

topology_template:
  node_templates:
    db_server:
      type: tosca.nodes.Compute
      interfaces:
        Standard:
          operations:
            configure: scripts/my_own_configure.sh

First is fails with this.

opera.error.ParseError: [Path] Path scripts/my_own_configure.sh does not exist.
[[Command exited with 1]]

And then the file is created, with this.

opera.error.ParseError: [NodeTemplate] Undeclared operations: configure.
[[Command exited with 1]]
lauwers commented 2 years ago

Hi Anatoli,

Assuming the file ‘scripts/my_own_configure.sh’ exists, your example shows valid TOSCA.

Chris

From: Anatoli Babenia @.> Sent: Thursday, February 3, 2022 1:00 PM To: xlab-si/xopera-opera @.> Cc: Chris Lauwers @.>; Mention @.> Subject: Re: [xlab-si/xopera-opera] Attach playbook to Compute node without defining a new type (Issue #237)

@anzomanhttps://github.com/anzoman this doesn't work.

tosca_definitions_version: tosca_simple_yaml_1_3

topology_template:

node_templates:

db_server:

  type: tosca.nodes.Compute

  interfaces:

    Standard:

      operations:

        configure: scripts/my_own_configure.sh

First is fails with this.

opera.error.ParseError: [Path] Path scripts/my_own_configure.sh does not exist.

[[Command exited with 1]]

And then the file is created, with this.

opera.error.ParseError: [NodeTemplate] Undeclared operations: configure.

[[Command exited with 1]]

— Reply to this email directly, view it on GitHubhttps://github.com/xlab-si/xopera-opera/issues/237#issuecomment-1029396244, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AASPLILRIDLU3ZV7IHE5QULUZLUFHANCNFSM5MV4HUUQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.**@.>>

abitrolly commented 2 years ago

Thanks. So it is a bug in xOpera then.

anzoman commented 2 years ago

Hi @abitrolly, I believe that you're looking at section 2.3 Overriding behavior of predefined node types and AFAIK you get the error because your db_server derives from tosca.nodes.Compute node type, which does not have any predefined interfaces that you could override and use them to run some operation.

The TOSCA Compute node represents one or more real or virtual processors of software applications or services along with other essential local resources. Collectively, the resources the compute node represents can logically be viewed as a (real or virtual) “server”.

If you want to run your scripts/my_own_configure.sh script you should probably derive from some other TOSCA type (e.g., tosca.nodes.Root, tosca.nodes.SoftwareComponent or create your DB server node such as tosca.nodes.DBMS.MySQL).

abitrolly commented 2 years ago

tosca.nodes.Compute derives from tosca.nodes.Root https://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.3/csprd01/TOSCA-Simple-Profile-YAML-v1.3-csprd01.html#DEFN_TYPE_NODES_ROOT which includes tosca.interfaces.node.lifecycle.Standard.

lauwers commented 2 years ago

Anatoli is correct.

From: Anatoli Babenia @.> Sent: Wednesday, February 9, 2022 12:39 AM To: xlab-si/xopera-opera @.> Cc: Chris Lauwers @.>; Mention @.> Subject: Re: [xlab-si/xopera-opera] Attach playbook to Compute node without defining a new type (Issue #237)

tosca.nodes.Compute derives from tosca.nodes.Root https://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.3/csprd01/TOSCA-Simple-Profile-YAML-v1.3-csprd01.html#DEFN_TYPE_NODES_ROOT`https://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.3/csprd01/TOSCA-Simple-Profile-YAML-v1.3-csprd01.html#DEFN_TYPE_NODES_ROOT%60 which includes tosca.interfaces.node.lifecycle.Standard.

— Reply to this email directly, view it on GitHubhttps://github.com/xlab-si/xopera-opera/issues/237#issuecomment-1033494126, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AASPLIJ5NT4LEDMUAN6VX2TU2IRZPANCNFSM5MV4HUUQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.**@.>>

anzoman commented 2 years ago

Oh, after some testing I see now that opera has a minor bug for this. I have located it already and will supply the PR that will fix this ASAP.