Skip to content
This repository has been archived by the owner. It is now read-only.

Getting 'namespaces "memcached-operator-system" not found' during make install #158

Closed
geerlingguy opened this issue Sep 7, 2020 · 3 comments

Comments

@geerlingguy
Copy link
Contributor

@geerlingguy geerlingguy commented Sep 7, 2020

For example, see failed build: https://github.com/geerlingguy/operator-sdk-performance-testing/runs/1059679784?check_suite_focus=true#step:7:140

I am running this build process using Ansible, but it seems with v1.0.0 of this project, all the three sample operators—in a clean environment—seem to fail on make install due to a namespace not being created (maybe just out of order?).

Steps to Reproduce

First, go into any of the three sample operator directories. (I tested with ansible, go, and helm, all three had the same issue.)

Second, run the make routine:

export IMG=ttl.sh/operator-sdk-sample:1h
make docker-build
make docker-push
make install
make deploy

Expected Result

Everything should work (assuming you have a working Kubernetes cluster and the privileges to deploy into it).

Actual Result

stderr:

go: creating new go.mod: module tmp
go: found sigs.k8s.io/controller-tools/cmd/controller-gen in sigs.k8s.io/controller-tools v0.3.0
Error from server (NotFound): error when creating "STDIN": namespaces "memcached-operator-system" not found
Error from server (NotFound): error when creating "STDIN": namespaces "memcached-operator-system" not found
Error from server (NotFound): error when creating "STDIN": namespaces "memcached-operator-system" not found
Error from server (NotFound): error when creating "STDIN": namespaces "memcached-operator-system" not found
Error from server (NotFound): error when creating "STDIN": namespaces "memcached-operator-system" not found
Error from server (NotFound): error when creating "STDIN": namespaces "memcached-operator-system" not found
Error from server (NotFound): error when creating "STDIN": namespaces "memcached-operator-system" not found
make: *** [deploy] Error 1

stdout:

/home/runner/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
cd config/manager && /snap/bin/kustomize edit set image controller=ttl.sh/operator-sdk-performance-test-go:1h
/snap/bin/kustomize build config/default | kubectl apply -f -
namespace/system created
customresourcedefinition.apiextensions.k8s.io/memcacheds.cache.example.com configured
clusterrole.rbac.authorization.k8s.io/memcached-operator-manager-role created
clusterrole.rbac.authorization.k8s.io/memcached-operator-proxy-role created
clusterrole.rbac.authorization.k8s.io/memcached-operator-metrics-reader created
clusterrolebinding.rbac.authorization.k8s.io/memcached-operator-manager-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/memcached-operator-proxy-rolebinding created
mutatingwebhookconfiguration.admissionregistration.k8s.io/memcached-operator-mutating-webhook-configuration created
validatingwebhookconfiguration.admissionregistration.k8s.io/memcached-operator-validating-webhook-configuration created
Makefile:53: recipe for target 'deploy' failed
@geerlingguy
Copy link
Contributor Author

@geerlingguy geerlingguy commented Sep 7, 2020

My fix was to manually create the namespace in the cluster prior to running the make tasks—using Ansible the following task does this:

- name: Ensure the operator namespace exists.
  k8s:
    name: memcached-operator-system
    api_version: v1
    kind: Namespace
    state: present
@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Sep 7, 2020

Hi @geerlingguy,

This project https://github.com/geerlingguy/operator-sdk-performance-testing shows not have the config, the files that are scaffold by default and are not respecting the layout/standard of the tool. So, it will not work as expected. Are you trying to migrate an existing project to use 1.0? If yes, I'd like to recommend you follow its guide https://sdk.operatorframework.io/docs/building-operators/ansible/migration/.

@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Oct 7, 2020

hi @geerlingguy,

Also, see that the idea is to deprecate this one. More info: #163. However, if you need help with your projects please feel free to raise issues against SDK.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.