-
Notifications
You must be signed in to change notification settings - Fork 1.8k
e2e-tests: fix advanced molecule ansible tests #4273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
camilamacedo86
merged 1 commit into
operator-framework:master
from
camilamacedo86:fix-molecule
Dec 15, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
|
|
||
| # Binaries for programs and plugins | ||
| *.exe | ||
| *.exe~ | ||
| *.dll | ||
| *.so | ||
| *.dylib | ||
| bin | ||
|
|
||
| # editor and IDE paraphernalia | ||
| .idea | ||
| *.swp | ||
| *.swo | ||
| *~ |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,20 +1,23 @@ | ||
| FROM quay.io/operator-framework/ansible-operator:dev | ||
| FROM quay.io/operator-framework/ansible-operator:v1.2.0 | ||
|
asmacdo marked this conversation as resolved.
|
||
|
|
||
| COPY requirements.yml ${HOME}/requirements.yml | ||
| RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \ | ||
| && chmod -R ug+rwx ${HOME}/.ansible | ||
| COPY ansible.cfg /etc/ansible/ansible.cfg | ||
| COPY watches.yaml ${HOME}/watches.yaml | ||
|
|
||
| COPY watches.yaml ${HOME}/watches.yaml | ||
| COPY roles/ ${HOME}/roles/ | ||
| COPY playbooks/ ${HOME}/playbooks/ | ||
|
|
||
| # Customizations done to check advanced scenarios | ||
| COPY inventory/ ${HOME}/inventory/ | ||
| COPY plugins/ ${HOME}/plugins/ | ||
| COPY ansible.cfg /etc/ansible/ansible.cfg | ||
| COPY fixture_collection/ /tmp/fixture_collection/ | ||
| USER root | ||
| RUN chmod -R ug+rwx /tmp/fixture_collection | ||
| USER 1001 | ||
| RUN ansible-galaxy collection build /tmp/fixture_collection/ --output-path /tmp/fixture_collection/ \ | ||
| && ansible-galaxy collection install /tmp/fixture_collection/operator_sdk-test_fixtures-0.0.0.tar.gz | ||
| && ansible-galaxy collection install /tmp/fixture_collection/operator_sdk-test_fixtures-0.0.0.tar.gz | ||
| RUN echo abc123 > /opt/ansible/pwd.yml \ | ||
| && ansible-vault encrypt_string --vault-password-file /opt/ansible/pwd.yml 'thisisatest' --name 'the_secret' > /opt/ansible/vars.yml | ||
| && ansible-vault encrypt_string --vault-password-file /opt/ansible/pwd.yml 'thisisatest' --name 'the_secret' > /opt/ansible/vars.yml | ||
|
|
||
This file contains hidden or 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,92 @@ | ||
| # Current Operator version | ||
| VERSION ?= 0.0.1 | ||
| # Default bundle image tag | ||
| BUNDLE_IMG ?= controller-bundle:$(VERSION) | ||
| # Options for 'bundle-build' | ||
| ifneq ($(origin CHANNELS), undefined) | ||
| BUNDLE_CHANNELS := --channels=$(CHANNELS) | ||
| endif | ||
| ifneq ($(origin DEFAULT_CHANNEL), undefined) | ||
| BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL) | ||
| endif | ||
| BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) | ||
|
|
||
| # Image URL to use all building/pushing image targets | ||
| IMG ?= controller:latest | ||
|
|
||
| all: docker-build | ||
|
|
||
| # Run against the configured Kubernetes cluster in ~/.kube/config | ||
| run: ansible-operator | ||
| $(ANSIBLE_OPERATOR) run | ||
|
|
||
| # Install CRDs into a cluster | ||
| install: kustomize | ||
| $(KUSTOMIZE) build config/crd | kubectl apply -f - | ||
|
|
||
| # Uninstall CRDs from a cluster | ||
| uninstall: kustomize | ||
| $(KUSTOMIZE) build config/crd | kubectl delete -f - | ||
|
|
||
| # Deploy controller in the configured Kubernetes cluster in ~/.kube/config | ||
| deploy: kustomize | ||
| cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} | ||
| $(KUSTOMIZE) build config/default | kubectl apply -f - | ||
|
|
||
| # Undeploy controller in the configured Kubernetes cluster in ~/.kube/config | ||
| undeploy: kustomize | ||
| $(KUSTOMIZE) build config/default | kubectl delete -f - | ||
|
|
||
| # Build the docker image | ||
| docker-build: | ||
| docker build . -t ${IMG} | ||
|
|
||
| # Push the docker image | ||
| docker-push: | ||
| docker push ${IMG} | ||
|
|
||
| PATH := $(PATH):$(PWD)/bin | ||
| SHELL := env PATH=$(PATH) /bin/sh | ||
| OS = $(shell uname -s | tr '[:upper:]' '[:lower:]') | ||
| ARCH = $(shell uname -m | sed 's/x86_64/amd64/') | ||
| OSOPER = $(shell uname -s | tr '[:upper:]' '[:lower:]' | sed 's/darwin/apple-darwin/' | sed 's/linux/linux-gnu/') | ||
| ARCHOPER = $(shell uname -m ) | ||
|
|
||
| kustomize: | ||
| ifeq (, $(shell which kustomize 2>/dev/null)) | ||
| @{ \ | ||
| set -e ;\ | ||
| mkdir -p bin ;\ | ||
| curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v3.5.4/kustomize_v3.5.4_$(OS)_$(ARCH).tar.gz | tar xzf - -C bin/ ;\ | ||
| } | ||
| KUSTOMIZE=$(realpath ./bin/kustomize) | ||
| else | ||
| KUSTOMIZE=$(shell which kustomize) | ||
| endif | ||
|
|
||
| ansible-operator: | ||
| ifeq (, $(shell which ansible-operator 2>/dev/null)) | ||
| @{ \ | ||
| set -e ;\ | ||
| mkdir -p bin ;\ | ||
| curl -LO https://github.com/operator-framework/operator-sdk/releases/download/v1.2.0/ansible-operator-v1.2.0-$(ARCHOPER)-$(OSOPER) ;\ | ||
| mv ansible-operator-v1.2.0-$(ARCHOPER)-$(OSOPER) ./bin/ansible-operator ;\ | ||
| chmod +x ./bin/ansible-operator ;\ | ||
| } | ||
| ANSIBLE_OPERATOR=$(realpath ./bin/ansible-operator) | ||
| else | ||
| ANSIBLE_OPERATOR=$(shell which ansible-operator) | ||
| endif | ||
|
|
||
| # Generate bundle manifests and metadata, then validate generated files. | ||
| .PHONY: bundle | ||
| bundle: kustomize | ||
| operator-sdk generate kustomize manifests -q | ||
| cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) | ||
| $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) | ||
| operator-sdk bundle validate ./bundle | ||
|
|
||
| # Build the bundle image. | ||
| .PHONY: bundle-build | ||
| bundle-build: | ||
| docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,24 @@ | ||
| domain: example.com | ||
| layout: ansible.sdk.operatorframework.io/v1 | ||
| multigroup: true | ||
| projectName: advanced-molecule-operator | ||
| resources: | ||
| - group: test | ||
| kind: InventoryTest | ||
| version: v1alpha1 | ||
| - group: test | ||
| kind: ArgsTest | ||
| version: v1alpha1 | ||
| - group: test | ||
| kind: CaseTest | ||
| version: v1alpha1 | ||
| - group: test | ||
| kind: CollectionTest | ||
| version: v1alpha1 | ||
| - group: test | ||
| kind: SelectorTest | ||
| version: v1alpha1 | ||
| - group: test | ||
| kind: SubresourcesTest | ||
| version: v1alpha1 | ||
| version: 3-alpha |
44 changes: 44 additions & 0 deletions
44
test/ansible/config/crd/bases/test.example.com_argstests.yaml
This file contains hidden or 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,44 @@ | ||
| --- | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| name: argstests.test.example.com | ||
| spec: | ||
| group: test.example.com | ||
| names: | ||
| kind: ArgsTest | ||
| listKind: ArgsTestList | ||
| plural: argstests | ||
| singular: argstest | ||
| scope: Namespaced | ||
| versions: | ||
| - name: v1alpha1 | ||
| schema: | ||
| openAPIV3Schema: | ||
| description: ArgsTest is the Schema for the argstests 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: Spec defines the desired state of ArgsTest | ||
| type: object | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| status: | ||
| description: Status defines the observed state of ArgsTest | ||
| type: object | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| type: object | ||
| served: true | ||
| storage: true | ||
| subresources: | ||
| status: {} |
44 changes: 44 additions & 0 deletions
44
test/ansible/config/crd/bases/test.example.com_casetests.yaml
This file contains hidden or 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,44 @@ | ||
| --- | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| name: casetests.test.example.com | ||
| spec: | ||
| group: test.example.com | ||
| names: | ||
| kind: CaseTest | ||
| listKind: CaseTestList | ||
| plural: casetests | ||
| singular: casetest | ||
| scope: Namespaced | ||
| versions: | ||
| - name: v1alpha1 | ||
| schema: | ||
| openAPIV3Schema: | ||
| description: CaseTest is the Schema for the casetests 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: Spec defines the desired state of CaseTest | ||
| type: object | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| status: | ||
| description: Status defines the observed state of CaseTest | ||
| type: object | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| type: object | ||
| served: true | ||
| storage: true | ||
| subresources: | ||
| status: {} |
44 changes: 44 additions & 0 deletions
44
test/ansible/config/crd/bases/test.example.com_collectiontests.yaml
This file contains hidden or 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,44 @@ | ||
| --- | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| name: collectiontests.test.example.com | ||
| spec: | ||
| group: test.example.com | ||
| names: | ||
| kind: CollectionTest | ||
| listKind: CollectionTestList | ||
| plural: collectiontests | ||
| singular: collectiontest | ||
| scope: Namespaced | ||
| versions: | ||
| - name: v1alpha1 | ||
| schema: | ||
| openAPIV3Schema: | ||
| description: CollectionTest is the Schema for the collectiontests 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: Spec defines the desired state of CollectionTest | ||
| type: object | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| status: | ||
| description: Status defines the observed state of CollectionTest | ||
| type: object | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| type: object | ||
| served: true | ||
| storage: true | ||
| subresources: | ||
| status: {} |
44 changes: 44 additions & 0 deletions
44
test/ansible/config/crd/bases/test.example.com_inventorytests.yaml
This file contains hidden or 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,44 @@ | ||
| --- | ||
| apiVersion: apiextensions.k8s.io/v1 | ||
| kind: CustomResourceDefinition | ||
| metadata: | ||
| name: inventorytests.test.example.com | ||
| spec: | ||
| group: test.example.com | ||
| names: | ||
| kind: InventoryTest | ||
| listKind: InventoryTestList | ||
| plural: inventorytests | ||
| singular: inventorytest | ||
| scope: Namespaced | ||
| versions: | ||
| - name: v1alpha1 | ||
| schema: | ||
| openAPIV3Schema: | ||
| description: InventoryTest is the Schema for the inventorytests 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: Spec defines the desired state of InventoryTest | ||
| type: object | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| status: | ||
| description: Status defines the observed state of InventoryTest | ||
| type: object | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| type: object | ||
| served: true | ||
| storage: true | ||
| subresources: | ||
| status: {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we only added this in the PR https://github.com/operator-framework/operator-sdk/pull/4253/files#diff-b40bad6fd0ff24f0b76e97122134b4fb2df604d6b73e4ddbd88bf5229f6c9912R34. It was not used/set before that and it's not required.