Kubebuilder layout ansible tests, by Fabian#3433
Kubebuilder layout ansible tests, by Fabian#3433asmacdo wants to merge 8 commits intooperator-framework:masterfrom
Conversation
camilamacedo86
left a comment
There was a problem hiding this comment.
Could we not run the commands and create the mock project to do the test instead of adding the files? e.g https://github.com/operator-framework/operator-sdk/blob/5725a5e3a90e2f2b580a7774b4e4d39e17335e0b/hack/tests/e2e-helm.sh
Otherwise, we are not acctually testing what is scaffold by the tool as well.
|
@camilamacedo86 these tests are not for scaffolding but for more advanced integration tests of Ansible + ansible-runner + the kubernetes modules, there's another test (that's not updated by this PR) that tests the scaffolded code |
|
Hi @fabianvf, I do see too much the point of we have tests in the project that are not executed from the code which is gen via the tool. However, if it is required for we move forward and have the Ansible plugin I am 100% OK with. See that with kbutils we can inject code and manipulating the files in the Go tests. (e.g https://github.com/kubernetes-sigs/kubebuilder/blob/master/test/e2e/v3/e2e_suite.go#L84-L92 and https://github.com/kubernetes-sigs/kubebuilder/blob/master/test/e2e/v3/e2e_suite.go#L124-L158) Could we track the need to replace this for a generated code via an issue in the repo and a todo in the project/dir to remember? Also, would not be better we put the mock project in a dir named testdata? |
|
I am of the same mindset as @camilamacedo86 is. Putting static scaffolded files in the repo isn't the best. That's what How much differs in this test project vs a vanilla test project? If it isn't much, could we do as Camila suggests and fully-regenerate it during the e2e using the actual plugin code and then applying the changes? +1 on putting this in a EDIT: I see we already have |
joelanford
left a comment
There was a problem hiding this comment.
There are still a bunch of legacy files left over. E.g. build/Dockerfile and all of deploy. Are we waiting to remove those until we remove the legacy project scaffolding?
| - group: cache.example.com | ||
| kind: Memcached | ||
| version: v1alpha1 | ||
| version: "2" |
There was a problem hiding this comment.
| version: "2" | |
| version: "3-alpha" |
| @@ -0,0 +1,7 @@ | |||
| domain: com | |||
There was a problem hiding this comment.
value: layout: ansible.operator-sdk.io/v1
| @@ -0,0 +1,85 @@ | |||
|
|
|||
There was a problem hiding this comment.
There's a whole bunch of Go-operator related code here.
Is the intention to fully rebuild this directory once the plugin can scaffold it with all of the ansible-specific stuff?
| # - name: kube-rbac-proxy | ||
| # image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0 | ||
| # args: | ||
| # - "--secure-listen-address=0.0.0.0:8443" | ||
| # - "--upstream=http://127.0.0.1:8080/" | ||
| # - "--logtostderr=true" | ||
| # - "--v=10" | ||
| # ports: | ||
| # - containerPort: 8443 | ||
| # name: https | ||
| - name: manager | ||
| args: | ||
| # - "--metrics-addr=127.0.0.1:8080" | ||
| # - "--enable-leader-election" |
There was a problem hiding this comment.
We'll probably want a lot of this re-enabled. Should we add TODOs?
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
| images: | ||
| - name: controller | ||
| newName: quay.io/asmacdo/controller | ||
| newTag: v0.0.1 |
There was a problem hiding this comment.
Are these lines necessary? It looks like the default scaffolded file is usually just the resources field.
| domain: com | ||
| repo: wut | ||
| resources: | ||
| - group: cache.example.com |
There was a problem hiding this comment.
It is more than just the group. I think it will be cache.example and the domain would be com
| issuerRef: | ||
| kind: Issuer | ||
| name: selfsigned-issuer | ||
| secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize |
There was a problem hiding this comment.
is webhooks supported with the current ansible image?
| resources: | ||
| - configmaps/status | ||
| verbs: | ||
| - get | ||
| - update | ||
| - patch |
There was a problem hiding this comment.
it is something that does not exist. Also, for Ansible/Helm we need to add the roles that are required for the current impl/base image. See;
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- get
- create
- apiGroups:
- apps
resourceNames:
- ""
resources:
- deployments/finalizers
verbs:
- update
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- apiGroups:
- apps
resources:
- replicasets
- deployments
verbs:
- get
- apiGroups:
- example.com
resources:
- '*'
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
There was a problem hiding this comment.
1c1c598 to
794eda6
Compare
794eda6 to
73c5963
Compare
| github.com/go-logr/zapr v0.1.1 | ||
| github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 | ||
| github.com/kr/text v0.1.0 | ||
| github.com/kubernetes-sigs/kustomize v2.0.3+incompatible // indirect |
There was a problem hiding this comment.
Just go mod tidy will solve -> it is the reason for the PR fails in the sanity test.
There was a problem hiding this comment.
that's a good question, I have no idea why/how that's in there, my bad
| --- | ||
| - name: Build kustomize testing overlay | ||
| # load_restrictor must be set to none so we can load patch files from the default overlay | ||
| command: '{{ kustomize }} build --load_restrictor none .' |
There was a problem hiding this comment.
Thee CI is failing here. If worked locally and not in the CI is because you have the kustomize locally installed and can perform it directly. But in the CI it will have not.
| make kustomize | ||
| if [ -f ./bin/kustomize ] ; then | ||
| KUSTOMIZE="$(realpath ./bin/kustomize)" | ||
| else | ||
| KUSTOMIZE="$(which kustomize)" | ||
| fi |
There was a problem hiding this comment.
I think might have a better way.
However, IMO the goal is to ensure that we are doing the same tests with the new layout.
I understand that all these tests will be migrated to GO tests, in this way in POV has no reason to be too precious with :-)
camilamacedo86
left a comment
There was a problem hiding this comment.
/lgtm
terrific great work 🥇
dc6568d to
26a7661
Compare
|
New changes are detected. LGTM label has been removed. |
Co-authored-by: Eric Stroczynski <estroczy@redhat.com>
26a7661 to
0a7b4b6
Compare
| operator_image: ${OPERATOR_IMAGE:-""} | ||
| operator_pull_policy: ${OPERATOR_PULL_POLICY:-"Always"} | ||
| pull_policy: ${OPERATOR_PULL_POLICY:-"Always"} | ||
| kustomize: ${KUSTOMIZE_PATH:-kustomize} |
There was a problem hiding this comment.
@asmacdo you will need to change here as well. https://github.com/operator-framework/operator-sdk/pull/3654/files :-)
|
@asmacdo 50% of this pr is addressed already with #4011 and for the advanced scenarios, we have the issue; #4025. So, since it is outdated and if we close it we still able to use as a helper to achieve the #4025 I think it is fine to close this one. However, feel free to re-open if you think that it should not be close at all. |
**Description of the change:** - update advanced mock static scenario with 1.0+ layout (#3433) - (note that we need to ensure that the test works with the new layout) - Fix CI issue (blocker master): `The error was: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='172.30.99.1', port=24443): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f28647cdb38>: Failed to establish a new connection: [Errno 110] Connection timed out',))` in GA. NOTE: The follow up here is to replace the test/ansible static mock with samples to ensure that we are testing it with the latest changes always. See the issue #4025 and its PR : #4312
**Description of the change:** - update advanced mock static scenario with 1.0+ layout (operator-framework#3433) - (note that we need to ensure that the test works with the new layout) - Fix CI issue (blocker master): `The error was: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='172.30.99.1', port=24443): Max retries exceeded with url: /version (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f28647cdb38>: Failed to establish a new connection: [Errno 110] Connection timed out',))` in GA. NOTE: The follow up here is to replace the test/ansible static mock with samples to ensure that we are testing it with the latest changes always. See the issue operator-framework#4025 and its PR : operator-framework#4312 Signed-off-by: reinvantveer <rein.van.t.veer@geodan.nl>
No description provided.