Skip to content

Conversation

asmacdo
Copy link
Member

@asmacdo asmacdo commented Jul 15, 2020

No description provided.

@asmacdo asmacdo added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2020
Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

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.

@fabianvf
Copy link
Member

@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

@camilamacedo86
Copy link
Contributor

camilamacedo86 commented Jul 15, 2020

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?

@joelanford
Copy link
Member

joelanford commented Jul 15, 2020

I am of the same mindset as @camilamacedo86 is. Putting static scaffolded files in the repo isn't the best. That's what test/test-framework is (was?), and it was generally a source of problems. If we can avoid it, it would be nice.

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 testdata directory.

EDIT: I see we already have test/ansible and this is just updating it to use the new project structure. In that case, I partially rescind this comment. This PR doesn't introduce new test directories. It merely updates existing ones. Carry on!

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.

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"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
version: "2"
version: "3-alpha"

@@ -0,0 +1,7 @@
domain: com
Copy link
Member

Choose a reason for hiding this comment

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

Add the layout key/value?

Copy link
Contributor

Choose a reason for hiding this comment

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

value: layout: ansible.operator-sdk.io/v1

@@ -0,0 +1,85 @@

Copy link
Member

Choose a reason for hiding this comment

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

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?

Comment on lines 12 to 25
# - 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"
Copy link
Member

Choose a reason for hiding this comment

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

We'll probably want a lot of this re-enabled. Should we add TODOs?

Comment on lines 3 to 8
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/asmacdo/controller
newTag: v0.0.1
Copy link
Member

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

is webhooks supported with the current ansible image?

Comment on lines 22 to 27
resources:
- configmaps/status
verbs:
- get
- update
- patch
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 28, 2020
@fabianvf fabianvf force-pushed the ansible-test-kb-layout branch from 1c1c598 to 794eda6 Compare July 29, 2020 16:44
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 29, 2020
@fabianvf fabianvf force-pushed the ansible-test-kb-layout branch from 794eda6 to 73c5963 Compare July 29, 2020 16:53
go.mod Outdated
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
Copy link
Member

Choose a reason for hiding this comment

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

Where's this coming from?

Copy link
Contributor

@camilamacedo86 camilamacedo86 Jul 29, 2020

Choose a reason for hiding this comment

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

Just go mod tidy will solve -> it is the reason for the PR fails in the sanity test.

Copy link
Member

Choose a reason for hiding this comment

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

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 .'
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +69 to +74
make kustomize
if [ -f ./bin/kustomize ] ; then
KUSTOMIZE="$(realpath ./bin/kustomize)"
else
KUSTOMIZE="$(which kustomize)"
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

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 :-)

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/lgtm

terrific great work 🥇

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 30, 2020
@fabianvf fabianvf force-pushed the ansible-test-kb-layout branch from dc6568d to 26a7661 Compare July 31, 2020 16:30
@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2020
operator_image: ${OPERATOR_IMAGE:-""}
operator_pull_policy: ${OPERATOR_PULL_POLICY:-"Always"}
pull_policy: ${OPERATOR_PULL_POLICY:-"Always"}
kustomize: ${KUSTOMIZE_PATH:-kustomize}
Copy link
Contributor

Choose a reason for hiding this comment

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

@camilamacedo86
Copy link
Contributor

This PR can be replaced by : #4011

c/c @asmacdo @fabianvf

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

.

@camilamacedo86
Copy link
Contributor

@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.

camilamacedo86 added a commit that referenced this pull request Dec 15, 2020
**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
reinvantveer pushed a commit to reinvantveer/operator-sdk that referenced this pull request Feb 5, 2021
**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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants