-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
k8s - allow resource definition using generateName #238
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few problems that will need to be sorted out. In general, we'll need to go through very carefully and make sure that in every instance that we are accessing, or trying to access, the name
that we are accounting for the changes here. Some examples of things that are not working, all for different reasons:
k8s:
kind: Namespace
generate_name: ns-
k8s:
kind: ConfigMap
namespace: whatever
generate_name: cmap-
append_hash: yes
k8s:
definition:
apiVersion: v1
kind: Pod
metadata:
namespace: whatever
name: pod1
spec:
containers:
- image: adslfkjadslfkjadslkfjsadf
name: non-existent-container
k8s:
definition:
apiVersion: v1
kind: Pod
metadata:
namespace: whatever
spec:
containers:
- image: busybox
name: c1
generate_name: pod-
wait: yes
In the latter case, because there is no name, we end up waiting on every pod in that namespace. This wait will fail because the first pod has a non-existent image name.
ok for the latter case, I see the issue with the wait mechanisms, I need to check for other scenarios |
1733e32
to
2ffe813
Compare
@gravesm regarding the latter case you just mentioned in your comment above, it is not failing the resource name is updated before calling the wait method, kubernetes.core/plugins/module_utils/common.py Lines 824 to 825 in 2ffe813
I have added test case to validate that kubernetes.core/molecule/default/tasks/generate_name.yml Lines 149 to 180 in 2ffe813
For others scenarios, code has been fixed and test updated accordingly |
@Akasurde could you please take a look at this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
dd74ea6
to
8529ba4
Compare
SUMMARY
#35
ISSUE TYPE
COMPONENT NAME
k8s
ADDITIONAL INFORMATION