Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix role for the metric services #2090

Merged
merged 4 commits into from
Oct 23, 2019
Merged

fix role for the metric services #2090

merged 4 commits into from
Oct 23, 2019

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Oct 22, 2019

Description of the change:
Add default role required for the services.

- apiGroups:
  - apps
  resources:
  - deployments
  verbs:
  - '*'

Motivation for the change:
#2088

Steps to verify it

Following the steps to make the review easier to be done.

  • Run operator-sdk new memcached-operator --api-version=cache.test.com/v1alpha1 --kind=Memcached --type=helm --helm-chart=stable/memcached
  • Replace the AntiAffinity: "hard" for AntiAffinity: "soft" in the values and CR
  • Rename the CRD for cache.test.com_v1alpha1_memcached_crd.yaml
  • Use the following makefile to make its easier
.DEFAULT_GOAL:=help
SHELL:=/bin/bash
NAMESPACE=fix

##@ Application

install: ## Install all resources (CR/CRD's, RBCA and Operator)
	@echo ....... Creating namespace ....... 
	- kubectl create namespace ${NAMESPACE}
	@echo ....... Applying CRDS and Operator .......
	- kubectl apply -f deploy/crds/cache.test.com_v1alpha1_memcached_crd.yaml -n ${NAMESPACE}
	@echo ....... Applying Rules and Service Account .......
	- kubectl apply -f deploy/role.yaml -n ${NAMESPACE}
	- kubectl apply -f deploy/role_binding.yaml  -n ${NAMESPACE}
	- kubectl apply -f deploy/service_account.yaml  -n ${NAMESPACE}
	@echo ....... Applying Operator .......
	- kubectl apply -f deploy/operator.yaml -n ${NAMESPACE}
	@echo ....... Creating the Memcached Instance .......
	- kubectl apply -f deploy/crds/cache.test.com_v1alpha1_memcached_cr.yaml -n ${NAMESPACE}

uninstall: ## Uninstall all that all performed in the $ make install
	@echo ....... Uninstalling .......
	@echo ....... Deleting CR and CRD.......
	- kubectl apply -f deploy/crds/cache.test.com_v1alpha1_memcached_cr.yaml -n ${NAMESPACE}
	- kubectl delete -f deploy/crds/cache.test.com_v1alpha1_memcached_crd.yaml -n ${NAMESPACE}
	@echo ....... Deleting Rules and Service Account .......
	- kubectl delete -f deploy/role.yaml -n ${NAMESPACE}
	- kubectl delete -f deploy/role_binding.yaml -n ${NAMESPACE}
	- kubectl delete -f deploy/service_account.yaml -n ${NAMESPACE}
	@echo ....... Deleting Operator .......
	- kubectl delete -f deploy/operator.yaml -n ${NAMESPACE}
	@echo ....... Deleting namespace ${NAMESPACE}.......
	- kubectl delete namespace ${NAMESPACE}

.PHONY: help
help:  ## Display this help
	@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf "  \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
  • Update the IMAGE in the operator.yaml file cmacedo/memcached-operator-fix
  • Run make install
  • Now, check if the cmacedo/memcached-operator-fix was created as follows.
$ kubectl get all -n fix
NAME                                      READY   STATUS    RESTARTS   AGE
pod/example-memcached-0                   1/1     Running   0          7m11s
pod/example-memcached-1                   1/1     Running   0          7m5s
pod/example-memcached-2                   1/1     Running   0          6m50s
pod/memcached-operator-79bd87dfbb-m7vc9   1/1     Running   0          7m15s

NAME                                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
service/example-memcached            ClusterIP   None            <none>        11211/TCP           7m11s
service/memcached-operator-metrics   ClusterIP   10.109.225.44   <none>        8686/TCP,8383/TCP   7m11s

NAME                                 READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/memcached-operator   1/1     1            1           7m15s

NAME                                            DESIRED   CURRENT   READY   AGE
replicaset.apps/memcached-operator-79bd87dfbb   1         1         1       7m15s

NAME                                 READY   AGE
statefulset.apps/example-memcached   3/3     7m11s

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 22, 2019
@joelanford
Copy link
Member

@camilamacedo86 I actually think we want to make this change here, so it applies to all generated roles.

@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 22, 2019
@camilamacedo86
Copy link
Contributor Author

Hi @joelanford,

Thank you for the good spot 👍 . All done now. Please, feel free to check.

@camilamacedo86 camilamacedo86 changed the title fix role for the services helm fix role for the metric services Oct 22, 2019
Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after addressing suggestion for the CHANGELOG line.

@camilamacedo86 camilamacedo86 added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Oct 23, 2019
@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-go

@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-go
/test e2e-aws-helm

@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-go

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@camilamacedo86
Copy link
Contributor Author

/test e2e-aws-go

@camilamacedo86 camilamacedo86 merged commit 72a86cd into operator-framework:master Oct 23, 2019
@camilamacedo86 camilamacedo86 deleted the fix-role-helm branch October 23, 2019 21:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants