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

Commit d2c1fe1

Browse files
camilamacedo86Eric Stroczynski
andauthored
feat: upgrade Ansible sample to use 0.18.1 SDK version (#128)
Co-authored-by: Eric Stroczynski <estroczy@redhat.com>
1 parent 1306fcc commit d2c1fe1

12 files changed

Lines changed: 173 additions & 8 deletions

File tree

ansible/memcached-operator/build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM quay.io/operator-framework/ansible-operator:v0.17.0
1+
FROM quay.io/operator-framework/ansible-operator:v0.18.1
22

33
COPY requirements.yml ${HOME}/requirements.yml
44
RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: apiextensions.k8s.io/v1beta1
1+
apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
name: memcacheds.cache.example.com
@@ -10,13 +10,13 @@ spec:
1010
plural: memcacheds
1111
singular: memcached
1212
scope: Namespaced
13-
subresources:
14-
status: {}
15-
validation:
16-
openAPIV3Schema:
17-
type: object
18-
x-kubernetes-preserve-unknown-fields: true
1913
versions:
2014
- name: v1alpha1
15+
schema:
16+
openAPIV3Schema:
17+
type: object
18+
x-kubernetes-preserve-unknown-fields: true
2119
served: true
2220
storage: true
21+
subresources:
22+
status: {}

ansible/memcached-operator/deploy/operator.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ spec:
3939
value: "4"
4040
- name: ANSIBLE_DEBUG_LOGS
4141
value: "True"
42+
livenessProbe:
43+
httpGet:
44+
path: /healthz
45+
port: 6789
46+
initialDelaySeconds: 5
47+
periodSeconds: 3
4248
volumes:
4349
- name: runner
4450
emptyDir: {}

ansible/memcached-operator/molecule/templates/operator.yaml.j2

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ spec:
3535
value: "memcached-operator"
3636
- name: ANSIBLE_GATHERING
3737
value: explicit
38+
livenessProbe:
39+
httpGet:
40+
path: /healthz
41+
port: 6789
42+
initialDelaySeconds: 5
43+
periodSeconds: 3
44+
3845
volumes:
3946
- name: runner
4047
emptyDir: {}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Role Name
2+
=========
3+
4+
A brief description of the role goes here.
5+
6+
Requirements
7+
------------
8+
9+
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance,
10+
if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
11+
12+
Role Variables
13+
--------------
14+
15+
A description of the settable variables for this role should go here, including any variables that are in
16+
defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables
17+
that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well
18+
19+
Dependencies
20+
------------
21+
22+
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set
23+
for other roles, or variables that are used from other roles.
24+
25+
Example Playbook
26+
----------------
27+
28+
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for
29+
users too:
30+
31+
- hosts: servers
32+
roles:
33+
- { role: username.rolename, x: 42 }
34+
35+
License
36+
-------
37+
38+
BSD
39+
40+
Author Information
41+
------------------
42+
43+
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
# defaults file for Memcached
3+
size: 1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
# handlers file for memcached
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
galaxy_info:
3+
author: your name
4+
description: your description
5+
company: your company (optional)
6+
7+
# If the issue tracker for your role is not on github, uncomment the
8+
# next line and provide a value
9+
# issue_tracker_url: http://example.com/issue/tracker
10+
11+
# Some suggested licenses:
12+
# - BSD (default)
13+
# - MIT
14+
# - GPLv2
15+
# - GPLv3
16+
# - Apache
17+
# - CC-BY
18+
license: license (GPLv2, CC-BY, etc)
19+
20+
min_ansible_version: 2.9
21+
22+
# If this a Container Enabled role, provide the minimum Ansible Container version.
23+
# min_ansible_container_version:
24+
25+
# Optionally specify the branch Galaxy will use when accessing the GitHub
26+
# repo for this role. During role install, if no tags are available,
27+
# Galaxy will use this branch. During import Galaxy will access files on
28+
# this branch. If Travis integration is configured, only notifications for this
29+
# branch will be accepted. Otherwise, in all cases, the repo's default branch
30+
# (usually master) will be used.
31+
#github_branch:
32+
33+
#
34+
# Provide a list of supported platforms, and for each platform a list of versions.
35+
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
36+
# To view available platforms and versions (or releases), visit:
37+
# https://galaxy.ansible.com/api/v1/platforms/
38+
#
39+
# platforms:
40+
# - name: Fedora
41+
# versions:
42+
# - all
43+
# - 25
44+
# - name: SomePlatform
45+
# versions:
46+
# - all
47+
# - 1.0
48+
# - 7
49+
# - 99.99
50+
51+
galaxy_tags: []
52+
# List tags for your role here, one per line. A tag is a keyword that describes
53+
# and categorizes the role. Users find roles by searching for tags. Be sure to
54+
# remove the '[]' above, if you add tags to this list.
55+
#
56+
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
57+
# Maximum 20 tags per role.
58+
59+
dependencies: []
60+
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
61+
# if you add dependencies to this list.
62+
collections:
63+
- operator_sdk.util
64+
- community.kubernetes
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
# tasks file for Memcached
3+
- name: start memcached
4+
k8s:
5+
definition:
6+
kind: Deployment
7+
apiVersion: apps/v1
8+
metadata:
9+
name: '{{ meta.name }}-memcached'
10+
namespace: '{{ meta.namespace }}'
11+
spec:
12+
replicas: "{{size}}"
13+
selector:
14+
matchLabels:
15+
app: memcached
16+
template:
17+
metadata:
18+
labels:
19+
app: memcached
20+
spec:
21+
containers:
22+
- name: memcached
23+
command:
24+
- memcached
25+
- -m=64
26+
- -o
27+
- modern
28+
- -v
29+
image: "docker.io/memcached:1.4.36-alpine"
30+
ports:
31+
- containerPort: 11211
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
localhost

0 commit comments

Comments
 (0)