-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Ansible posthook not creating AnsibleJob CR (#114)
Signed-off-by: Mike Ng <ming@redhat.com>
- Loading branch information
Showing
7 changed files
with
229 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: toweraccess | ||
namespace: default | ||
type: Opaque | ||
stringData: | ||
token: _token_here | ||
host: _awx_ip_here_ |
127 changes: 127 additions & 0 deletions
127
test/e2e/cases/06-ansiblejob-post/00-tower.ansible.com_ansiblejobs_crd.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.4.0 | ||
creationTimestamp: null | ||
name: ansiblejobs.tower.ansible.com | ||
spec: | ||
group: tower.ansible.com | ||
names: | ||
kind: AnsibleJob | ||
listKind: AnsibleJobList | ||
plural: ansiblejobs | ||
singular: ansiblejob | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: AnsibleJob is the Schema for the ansiblejobs API | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: AnsibleJobSpec defines the desired state of AnsibleJob | ||
properties: | ||
extra_vars: | ||
type: object | ||
inventory: | ||
type: string | ||
job_template_name: | ||
type: string | ||
tower_auth_secret: | ||
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "make" to regenerate code after modifying this file' | ||
type: string | ||
type: object | ||
status: | ||
description: AnsibleJobStatus defines the observed state of AnsibleJob | ||
properties: | ||
ansibleJobResult: | ||
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state of cluster Important: Run "make" to regenerate code after modifying this file' | ||
properties: | ||
changed: | ||
type: boolean | ||
elapsed: | ||
type: string | ||
failed: | ||
type: boolean | ||
finished: | ||
type: string | ||
started: | ||
type: string | ||
status: | ||
type: string | ||
url: | ||
type: string | ||
type: object | ||
conditions: | ||
items: | ||
description: Condition - the condition for the ansible operator. | ||
properties: | ||
ansibleResult: | ||
description: bridging from https://github.com/operator-framework/operator-sdk/blob/master/internal/ansible/controller/status/types.go AnsibleResult - encapsulation of the ansible result. | ||
properties: | ||
changed: | ||
type: integer | ||
completion: | ||
type: object | ||
failures: | ||
type: integer | ||
ok: | ||
type: integer | ||
skipped: | ||
type: integer | ||
required: | ||
- changed | ||
- completion | ||
- failures | ||
- ok | ||
- skipped | ||
type: object | ||
lastTransitionTime: | ||
format: date-time | ||
type: string | ||
message: | ||
type: string | ||
reason: | ||
type: string | ||
status: | ||
type: string | ||
type: | ||
description: ConditionType - type of condition | ||
type: string | ||
type: object | ||
type: array | ||
k8sJob: | ||
properties: | ||
created: | ||
type: boolean | ||
env: | ||
properties: | ||
secretNamespacedName: | ||
type: string | ||
templateName: | ||
type: string | ||
verifySSL: | ||
type: boolean | ||
type: object | ||
message: | ||
type: string | ||
namespacedName: | ||
type: string | ||
type: object | ||
message: | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: apps.open-cluster-management.io/v1 | ||
kind: PlacementRule | ||
metadata: | ||
name: non-local-cluster | ||
namespace: default | ||
spec: | ||
# apply to 1 cluster whoevers name not local-cluster | ||
clusterReplicas: 1 | ||
clusterSelector: | ||
matchExpressions: | ||
- key: name | ||
operator: NotIn | ||
values: | ||
- local-cluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
apiVersion: apps.open-cluster-management.io/v1 | ||
kind: Channel | ||
metadata: | ||
name: git | ||
namespace: default | ||
spec: | ||
type: git | ||
pathname: https://github.com/open-cluster-management-io/multicloud-operators-subscription.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: apps.open-cluster-management.io/v1 | ||
kind: Subscription | ||
metadata: | ||
name: ansible-hook | ||
namespace: default | ||
annotations: | ||
apps.open-cluster-management.io/github-path: examples/ansible-post/resources | ||
apps.open-cluster-management.io/github-branch: main | ||
spec: | ||
hooksecretref: | ||
namespace: default | ||
name: toweraccess | ||
channel: default/git | ||
placement: | ||
placementRef: | ||
kind: PlacementRule | ||
name: non-local-cluster |