operator-framework / ansible-operator-plugins

Experimental extraction/refactoring of the Operator SDK's ansible operator plugin
Apache License 2.0
7 stars 17 forks source link

Fix initiliazation of new projects #60

Open jenrik opened 4 months ago

jenrik commented 4 months ago

Description of the change:

Fixes a bug where we try to search-and-remove some boilerplate that have changed upstream.

Motivation for the change:

Attempting to initialize new operator project is not possible as you get the below error message:

INFO[0000] Writing kustomize manifests for you to edit...
Error: failed to initialize project: unable to scaffold with "base.ansible.sdk.operatorframework.io/v1": error updating init manifests: error updating kustomization.yaml files: remove config/default/kustomization.yaml patch and vars blocks: unable to find the content to be replaced
Usage:
  operator-sdk init [flags]

Examples:

  # Scaffold a project with no API
  $ operator-sdk init --plugins=base.ansible.sdk.operatorframework.io/v1 --domain=my.domain \

  # Invokes "create api"
  $ operator-sdk init --plugins=base.ansible.sdk.operatorframework.io/v1 \
      --domain=my.domain \
      --group=apps --version=v1alpha1 --kind=AppService

  $ operator-sdk init --plugins=base.ansible.sdk.operatorframework.io/v1 \
      --domain=my.domain \
      --group=apps --version=v1alpha1 --kind=AppService \
      --generate-role

  $ operator-sdk init --plugins=base.ansible.sdk.operatorframework.io/v1 \
      --domain=my.domain \
      --group=apps --version=v1alpha1 --kind=AppService \
      --generate-playbook

  $ operator-sdk init --plugins=base.ansible.sdk.operatorframework.io/v1 \
      --domain=my.domain \
      --group=apps --version=v1alpha1 --kind=AppService \
      --generate-playbook \
      --generate-role

Flags:
      --project-version string   project version (default "3")
      --domain string            domain for groups (default "my.domain")
      --project-name string      name of this project
      --group string             resource Group
      --version string           resource Version
      --kind string              resource Kind
      --generate-role            Generate an Ansible role skeleton.
      --generate-playbook        Generate an Ansible playbook. If passed with --generate-role, the playbook will invoke the role.
  -h, --help                     help for init

Global Flags:
      --plugins strings   plugin keys to be used for this subcommand execution
      --verbose           Enable verbose logging

FATA[0000] failed to initialize project: unable to scaffold with "base.ansible.sdk.operatorframework.io/v1": error updating init manifests: error updating kustomization.yaml files: remove config/default/kustomization.yaml patch and vars blocks: unable to find the content to be replaced
everettraven commented 3 months ago

Thanks for submitting this contribution @jenrik !