Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #922 from bshephar/rename-spec-play
Browse files Browse the repository at this point in the history
Rename Play parameter to PlaybookContents
  • Loading branch information
openshift-merge-bot[bot] authored Jun 11, 2024
2 parents 319ec0e + 33d2275 commit 43e2bde
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ spec:
type: string
openStackAnsibleEERunnerImage:
type: string
play:
type: string
playbook:
type: string
playbookContents:
type: string
secrets:
items:
type: string
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/openstackdataplaneservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ type OpenStackDataPlaneServiceSpec struct {
// +kubebuilder:validation:Optional
TLSCerts map[string]OpenstackDataPlaneServiceCert `json:"tlsCerts,omitempty" yaml:"tlsCerts,omitempty"`

// Play is an inline playbook contents that ansible will run on execution.
Play string `json:"play,omitempty"`
// PlaybookContents is an inline playbook contents that ansible will run on execution.
PlaybookContents string `json:"playbookContents,omitempty"`

// Playbook is a path to the playbook that ansible will run on this execution
Playbook string `json:"playbook,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ spec:
type: string
openStackAnsibleEERunnerImage:
type: string
play:
type: string
playbook:
type: string
playbookContents:
type: string
secrets:
items:
type: string
Expand Down
4 changes: 2 additions & 2 deletions docs/assemblies/custom_resources.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ OpenStackDataPlaneServiceSpec defines the desired state of OpenStackDataPlaneSer
| map[string]<<openstackdataplaneservicecert,OpenstackDataPlaneServiceCert>>
| false
| play
| Play is an inline playbook contents that ansible will run on execution.
| playbookContents
| PlaybookContents is an inline playbook contents that ansible will run on execution.
| string
| false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endif::[]
ifeval::["{build}" == "downstream"]
openStackAnsibleEERunnerImage: registry.redhat.io/rhosp-dev-preview/ee-openstack-ansible-ee-rhel9:0.1.3-5 <1>
endif::[]
play: |
playbookContents: |
----
+
<1> Your container image that the `ansible-runner` execution environment uses to execute Ansible.
6 changes: 3 additions & 3 deletions docs/assemblies/proc_creating-a-custom-service.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ metadata:
name: custom-service
spec:
label: dataplane-deployment-custom-service
play: |
playbookContents: |
hosts: all
tasks:
- name: Hello World!
Expand All @@ -77,7 +77,7 @@ metadata:
name: custom-service
spec:
...
play: |
playbookContents: |
...
secrets:
- name: hello-world-secret-0
Expand All @@ -97,7 +97,7 @@ metadata:
name: custom-global-service
spec:
label: custom-global-service
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: global play
Expand Down
11 changes: 6 additions & 5 deletions pkg/util/ansible_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ func AnsibleExecution(
ansibleEE.Spec.CmdLine = strings.TrimSpace(cmdLineArguments.String())
}

if len(service.Spec.Play) > 0 {
ansibleEE.Spec.Play = service.Spec.Play
if len(service.Spec.PlaybookContents) > 0 {
ansibleEE.Spec.Play = service.Spec.PlaybookContents
}
if len(service.Spec.Playbook) > 0 {
ansibleEE.Spec.Playbook = service.Spec.Playbook
Expand Down Expand Up @@ -232,7 +232,6 @@ func AnsibleExecution(

return nil
})

if err != nil {
util.LogErrorForObject(helper, err, fmt.Sprintf("Unable to create AnsibleEE %s", ansibleEE.Name), ansibleEE)
return err
Expand All @@ -248,7 +247,8 @@ func AnsibleExecution(
// "openstackdataplanenodeset": <nodeSetName>,
// If none or more than one is found, return nil and error
func GetAnsibleExecution(ctx context.Context,
helper *helper.Helper, obj client.Object, labelSelector map[string]string) (*ansibleeev1.OpenStackAnsibleEE, error) {
helper *helper.Helper, obj client.Object, labelSelector map[string]string,
) (*ansibleeev1.OpenStackAnsibleEE, error) {
var err error
ansibleEEs := &ansibleeev1.OpenStackAnsibleEEList{}

Expand Down Expand Up @@ -290,7 +290,8 @@ func getAnsibleExecutionNamePrefix(serviceName string) string {
// GetAnsibleExecutionNameAndLabels Name and Labels of AnsibleEE
func GetAnsibleExecutionNameAndLabels(service *dataplanev1.OpenStackDataPlaneService,
deploymentName string,
nodeSetName string) (string, map[string]string) {
nodeSetName string,
) (string, map[string]string) {
executionName := fmt.Sprintf("%s-%s", getAnsibleExecutionNamePrefix(service.Name), deploymentName)
if !service.Spec.DeployOnAllNodeSets {
executionName = fmt.Sprintf("%s-%s", executionName, nodeSetName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ metadata:
name: custom-global-service
spec:
label: custom-global-service
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: global kuttl play
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
default:
contents:
- dnsnames
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand All @@ -23,7 +23,7 @@ metadata:
name: install-certs-ovr
spec:
addCertMounts: True
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
default:
contents:
- dnsnames
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand All @@ -23,7 +23,7 @@ metadata:
name: install-certs-ovr
spec:
addCertMounts: True
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: custom-svc
spec:
label: custom-svc
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand Down
4 changes: 2 additions & 2 deletions tests/kuttl/tests/dataplane-deploy-tls-test/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
second:
contents:
- ips
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand All @@ -26,7 +26,7 @@ metadata:
name: install-certs-ovrd
spec:
addCertMounts: True
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
second:
contents:
- ips
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand All @@ -26,7 +26,7 @@ metadata:
name: install-certs-ovrd
spec:
addCertMounts: True
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
issuer: osp-rootca-issuer-internal
networks:
- ctlplane
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand All @@ -37,7 +37,7 @@ spec:
- digital signature
- server auth
- client auth
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand All @@ -52,7 +52,7 @@ metadata:
name: install-certs-ovrd
spec:
addCertMounts: True
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand Down
2 changes: 1 addition & 1 deletion tests/kuttl/tests/dataplane-service-config/00-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ kind: OpenStackDataPlaneService
metadata:
name: kuttl-service
spec:
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand Down
2 changes: 1 addition & 1 deletion tests/kuttl/tests/dataplane-service-failure/00-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: OpenStackDataPlaneService
metadata:
name: failed-service
spec:
play: |
playbookContents: |
- hosts: localhost
gather_facts: no
name: kuttl play
Expand Down

0 comments on commit 43e2bde

Please sign in to comment.