-
Notifications
You must be signed in to change notification settings - Fork 80
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
Customized Molecule-Kubernetes is not working with molecule 6.0.3 #291
Comments
Here's the molecule.yml under the scenario directory which the molecule is failing to validate cat molecule.ymldependency: - name: ${BUILD_TAG}-prometheus-defaultmountPath: /path/to/your/shared/folderstorageClass: managed-nfs-storagesize: 10Mitemplates:
|
cat dependency.sh build and install current collection and its dependenciesif test -f "../../galaxy.yml"; then install scenario role dependenciesif test -f "$MOLECULE_SCENARIO_DIRECTORY/requirements.yml"; then install scenario collection dependenciesif test -f "$MOLECULE_SCENARIO_DIRECTORY/collections.yml"; then |
I'm not sure this place is the best one, as there's no kubernetes plugin. Anyway, several comments:
There may be other issues but these two ones are important. The second one being a blocker. |
We have upgraded our molecule version from 4.0.0 to 6.0.3 and the molecule commands are not working.
We were able to execute all the molecule commands using version 4.0.0 and were able to launch pods on kubernetes. But with 6.0.3 we're not sure what changes need to be made
here's the customized tree structure
`tree molecule_kubernetes molecule_kubernetes ├── cookiecutter │ ├── cookiecutter.json │ └── {{cookiecutter.molecule_directory}} │ └── {{cookiecutter.scenario_name}} │ ├── collections.yml │ ├── converge.yml │ ├── LICENSE │ ├── molecule.yml │ └── README.md ├── driver.py ├── init.py ├── playbooks │ ├── create.yml │ └── destroy.yml └── pycache ├── driver.cpython-39.pyc └── init.cpython-39.pyc 5 directories, 12 files
Customized molecule.yml which was working for version 4.0.0
cat molecule.yml
`
dependency:
{%- if cookiecutter.dependency_name == 'galaxy' %}
name: shell
command: |
# build and install current collection and its dependencies
if test -f "../../galaxy.yml"; then
ansible-galaxy collection build ../.. --output-path $MOLECULE_EPHEMERAL_DIRECTORY --force
ansible-galaxy collection install $$(ls -1 $MOLECULE_EPHEMERAL_DIRECTORY/*.tar.gz) --force
fi
# install scenario role dependencies
if test -f "$MOLECULE_SCENARIO_DIRECTORY/requirements.yml"; then
ansible-galaxy role install -r $MOLECULE_SCENARIO_DIRECTORY/requirements.yml
fi
# install scenario collection dependencies
if test -f "$MOLECULE_SCENARIO_DIRECTORY/collections.yml"; then
ansible-galaxy collection install -r $MOLECULE_SCENARIO_DIRECTORY/collections.yml
fi
{%- else %}
name: {{ cookiecutter.dependency_name }}
{%- endif %}
driver:
name: kubernetes
namespace: ${BUILD_KUBERNETES_NAMESPACE:-molecule}
resources:
requests:
cpu: 500m
memory: 1Gi
#shares:
- name: ${BUILD_TAG}-{{ cookiecutter.role_name|replace('', '-') }}-{{ cookiecutter.scenario_name|replace('', '-') }}
mountPath: /path/to/your/shared/folder
storageClass: managed-nfs-storage
size: 10Mi
templates:
centos7:
image: abc.com/abf-centos7-init:latest
mountHostEntitlements: true
nodeSelector:
kubernetes.com/distribution: redhat7
#kubernetes.com/storage: 'true'
centos8:
image: abc.com/abf-centos8-init:latest
mountHostEntitlements: true
nodeSelector:
kubernetes.com/distribution: redhat8
#kubernetes.com/storage: 'true'
rhel7:
image: abc.com/abf-rhel7-init:latest
nodeSelector:
kubernetes.com/distribution: redhat7
#kubernetes.com/storage: 'true'
rhel8:
image: abc.com/abf-rhel8-init:latest
nodeSelector:
kubernetes.com/distribution: redhat8
#kubernetes.com/storage: 'true'
platforms:
)|lower }}
inherit_from: rhel8
prerun: false
provisioner:
name: ansible
inventory:
group_vars:
all:
stage: molecule
verifier:
name: {{ cookiecutter.verifier_name }}
(ansible-2.14.18)
`
Customized driver.py
`
import os
from molecule import logger, util
from molecule.api import Driver
from molecule.util import sysexit_with_message
from ansible_compat.ports import cache
log = logger.get_logger(name)
class Kubernetes(Driver):
def init(self, config=None):
super(Kubernetes, self).init(config)
self._name = "kubernetes"
(ansible-2.14.18)
`
Customized Collections.yml
`
collections:
version: '>=1.1.1,<2.0.0'
version: '>=1.0.0,<2.0.0'
`
Error:
WARNING Driver kubernetes does not provide a schema.
CRITICAL Failed to validate /home/monitoring/roles/prometheus/molecule/default/molecule.yml
["'kubernetes' is not one of ['azure', 'ec2', 'delegated', 'docker', 'containers', 'openstack', 'podman', 'vagrant', 'digitalocean', 'gce', 'libvirt', 'lxd', 'molecule-', 'molecule_', 'custom-', 'custom_']"]
molecule drivers
╶────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╴
default
kubernetes
molecule --version
molecule 6.0.3 using python 3.9
ansible:2.14.18
default:6.0.3 from molecule
kubernetes:0.7.2.dev2 from molecule_kubernetes
The text was updated successfully, but these errors were encountered: