Skip to content

Commit

Permalink
pkg/ansible/controller; Remove IsAlreadyRegistered() check in control…
Browse files Browse the repository at this point in the history
…ler (#973)

* pkg/ansible/controller; Remove IsVersionRegistered check

* Update e2e tests to watch multiple kinds
  • Loading branch information
dymurray authored Jan 23, 2019
1 parent 3d92c95 commit 43906dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions hack/tests/e2e-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ deploy_operator() {
kubectl create -f "$OPERATORDIR/deploy/role.yaml"
kubectl create -f "$OPERATORDIR/deploy/role_binding.yaml"
kubectl create -f "$OPERATORDIR/deploy/crds/ansible_v1alpha1_memcached_crd.yaml"
kubectl create -f "$OPERATORDIR/deploy/crds/ansible_v1alpha1_foo_crd.yaml"
kubectl create -f "$OPERATORDIR/deploy/operator.yaml"
}

Expand All @@ -22,6 +23,7 @@ remove_operator() {
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/role.yaml"
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/role_binding.yaml"
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/crds/ansible_v1alpha1_memcached_crd.yaml"
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/crds/ansible_v1alpha1_foo_crd.yaml"
kubectl delete --ignore-not-found=true -f "$OPERATORDIR/deploy/operator.yaml"
}

Expand Down Expand Up @@ -91,8 +93,11 @@ cp "$ROOTDIR/test/ansible-memcached/tasks.yml" memcached-operator/roles/memcache
cp "$ROOTDIR/test/ansible-memcached/defaults.yml" memcached-operator/roles/memcached/defaults/main.yml
cp -a "$ROOTDIR/test/ansible-memcached/memfin" memcached-operator/roles/
cat "$ROOTDIR/test/ansible-memcached/watches-finalizer.yaml" >> memcached-operator/watches.yaml
cat "$ROOTDIR/test/ansible-memcached/watches-foo-kind.yaml" >> memcached-operator/watches.yaml

pushd memcached-operator
# Add a second Kind to test watching multiple GVKs
operator-sdk add crd --kind=Foo --api-version=ansible.example.com/v1alpha1
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
operator-sdk build "$DEST_IMAGE"
sed -i "s|{{ REPLACE_IMAGE }}|$DEST_IMAGE|g" deploy/operator.yaml
Expand Down
7 changes: 0 additions & 7 deletions pkg/ansible/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ func Add(mgr manager.Manager, options Options) *controller.Controller {
ManageStatus: options.ManageStatus,
}

if mgr.GetScheme().IsVersionRegistered(schema.GroupVersion{
Group: options.GVK.Group,
Version: options.GVK.Version,
}) {
log.Info("Version already registered... skipping")
return nil
}
// Register the GVK with the schema
mgr.GetScheme().AddKnownTypeWithName(options.GVK, &unstructured.Unstructured{})
metav1.AddToGroupVersion(mgr.GetScheme(), schema.GroupVersion{
Expand Down
4 changes: 4 additions & 0 deletions test/ansible-memcached/watches-foo-kind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- version: v1alpha1
group: ansible.example.com
kind: Foo
role: /dev/null

0 comments on commit 43906dd

Please sign in to comment.