Skip to content
This repository was archived by the owner on Nov 18, 2020. It is now read-only.

Commit 27342c7

Browse files
Merge pull request #91 from camilamacedo86/up-ansible-012
Migrate Ansible Sample to use SDK 0.12
2 parents afdf919 + 829f999 commit 27342c7

15 files changed

Lines changed: 66 additions & 27 deletions

File tree

ansible/memcached-operator/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ install: ## Install all resources (CR/CRD's, RBCA and Operator)
88
@echo ....... Creating namespace .......
99
- kubectl create namespace ${NAMESPACE}
1010
@echo ....... Applying CRDS and Operator .......
11-
- kubectl apply -f deploy/crds/cache_v1alpha1_memcached_crd.yaml -n ${NAMESPACE}
11+
- kubectl apply -f deploy/crds/cache.example.com_memcacheds_crd.yaml -n ${NAMESPACE}
1212
@echo ....... Applying Rules and Service Account .......
1313
- kubectl apply -f deploy/role.yaml -n ${NAMESPACE}
1414
- kubectl apply -f deploy/role_binding.yaml -n ${NAMESPACE}
1515
- kubectl apply -f deploy/service_account.yaml -n ${NAMESPACE}
1616
@echo ....... Applying Operator .......
1717
- kubectl apply -f deploy/operator.yaml -n ${NAMESPACE}
1818
@echo ....... Creating the Database .......
19-
- kubectl apply -f deploy/crds/cache_v1alpha1_memcached_cr.yaml -n ${NAMESPACE}
19+
- kubectl apply -f deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml -n ${NAMESPACE}
2020

2121
uninstall: ## Uninstall all that all performed in the $ make install
2222
@echo ....... Uninstalling .......
2323
@echo ....... Deleting CRDs.......
24-
- kubectl delete -f deploy/crds/cache_v1alpha1_memcached_crd.yaml -n ${NAMESPACE}
24+
- kubectl delete -f deploy/crds/cache.example.com_memcacheds_crd.yaml -n ${NAMESPACE}
2525
@echo ....... Deleting Rules and Service Account .......
2626
- kubectl delete -f deploy/role.yaml -n ${NAMESPACE}
2727
- kubectl delete -f deploy/role_binding.yaml -n ${NAMESPACE}

ansible/memcached-operator/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ This Memcached operator is a simple example operator for the [Operator SDK][oper
77
## Prerequisites
88

99
- [docker][docker_tool] version 17.03+
10-
- [kubectl][kubectl_tool] v1.11.3+
10+
- [kubectl][kubectl_tool] v1.12+
1111
- [operator_sdk][operator_install]
12-
- Access to a Kubernetes v1.11.3+ cluster
12+
- Access to a Kubernetes v1.12+ cluster
1313

1414
## Getting Started
1515

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM quay.io/operator-framework/ansible-operator:v0.11.0
1+
FROM quay.io/operator-framework/ansible-operator:v0.12.0
22

33
COPY watches.yaml ${HOME}/watches.yaml
44

5-
COPY roles/ ${HOME}/roles/
5+
COPY roles/ ${HOME}/roles/

ansible/memcached-operator/build/test-framework/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ USER 0
66
# yum clean all && rm -rf /var/yum/cache/* first
77
RUN yum clean all && rm -rf /var/cache/yum/* \
88
&& yum -y update \
9-
&& yum install -y python36-devel gcc libffi-devel python36-pip
9+
&& yum install -y python36-devel gcc libffi-devel python3-pip
1010
RUN pip3 install --user molecule==2.22
1111
ARG NAMESPACEDMAN
1212
ADD $NAMESPACEDMAN /namespaced.yaml
1313
ADD build/test-framework/ansible-test.sh /ansible-test.sh
1414
RUN chmod +x /ansible-test.sh
1515
USER 1001
16-
ADD . /opt/ansible/project
16+
ADD . /opt/ansible/project

ansible/memcached-operator/deploy/crds/cache_v1alpha1_memcached_crd.yaml renamed to ansible/memcached-operator/deploy/crds/cache.example.com_memcacheds_crd.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ spec:
1313
subresources:
1414
status: {}
1515
versions:
16-
- name: v1alpha1
17-
served: true
18-
storage: true
16+
- name: v1alpha1
17+
served: true
18+
storage: true

ansible/memcached-operator/deploy/crds/cache_v1alpha1_memcached_cr.yaml renamed to ansible/memcached-operator/deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml

File renamed without changes.

ansible/memcached-operator/deploy/operator.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ spec:
1616
containers:
1717
- name: ansible
1818
command:
19-
- /usr/local/bin/ao-logs
20-
- /tmp/ansible-operator/runner
21-
- stdout
19+
- /usr/local/bin/ao-logs
20+
- /tmp/ansible-operator/runner
21+
- stdout
2222
# Replace this with the built image name
2323
image: "REPLACE_IMAGE"
2424
imagePullPolicy: "Always"
2525
volumeMounts:
26-
- mountPath: /tmp/ansible-operator/runner
27-
name: runner
28-
readOnly: true
26+
- mountPath: /tmp/ansible-operator/runner
27+
name: runner
28+
readOnly: true
2929
- name: operator
3030
# Replace this with the built image name
3131
image: "REPLACE_IMAGE"
3232
imagePullPolicy: "Always"
3333
volumeMounts:
34-
- mountPath: /tmp/ansible-operator/runner
35-
name: runner
34+
- mountPath: /tmp/ansible-operator/runner
35+
name: runner
3636
env:
3737
- name: WATCH_NAMESPACE
3838
valueFrom:

ansible/memcached-operator/deploy/role.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ rules:
5151
- apps
5252
resources:
5353
- replicasets
54+
- deployments
5455
verbs:
5556
- get
5657
- apiGroups:

ansible/memcached-operator/molecule/default/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ platforms:
1010
- name: kind-default
1111
groups:
1212
- k8s
13-
image: bsycorp/kind:latest-1.14
13+
image: bsycorp/kind:latest-1.15
1414
privileged: True
1515
override_command: no
1616
exposed_ports:

ansible/memcached-operator/molecule/test-cluster/playbook.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
ansible_python_interpreter: '{{ ansible_playbook_python }}'
88
deploy_dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/deploy"
99
image_name: cache.example.com/memcached-operator:testing
10-
custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/cache_v1alpha1_memcached_cr.yaml'])) | from_yaml }}"
10+
custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/cache.example.com_v1alpha1_memcached_cr.yaml'])) | from_yaml }}"
1111
tasks:
1212
- name: Create the cache.example.com/v1alpha1.Memcached
1313
k8s:
1414
namespace: '{{ namespace }}'
15-
definition: "{{ lookup('file', '/'.join([deploy_dir, 'crds/cache_v1alpha1_memcached_cr.yaml'])) }}"
15+
definition: "{{ lookup('file', '/'.join([deploy_dir, 'crds/cache.example.com_v1alpha1_memcached_cr.yaml'])) }}"
1616

1717
- name: Get the newly created Custom Resource
1818
debug:

0 commit comments

Comments
 (0)