-
Notifications
You must be signed in to change notification settings - Fork 15
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
OCP4 OLM integration and visual display in OLM deloyment status page #28
base: master
Are you sure you want to change the base?
Conversation
for _, pod := range pods { | ||
if pod.GetObjectMeta().GetDeletionTimestamp() == nil { | ||
podNames = append(podNames, pod.Name) | ||
func getPodStatus(r *ReconcileInterconnect, instance *v1alpha1.Interconnect) v1alpha1.InterconnectPodStatus { |
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.
@myeung18 I've moved this logic to the shared library now, please refactor to use it as done in corresponding PR
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.
refactoring is done
345f942
to
d541fe0
Compare
Could we separate out the examples from the OLM fixes? I'm hesitant to include a lot of different examples without any verification as it becomes easy for them to go stale. I think they also need some explanation, so perhaps worth doing in conjunction with some improved docs. In any case they seem a separate issue from the OLM fixes. |
Sure, let me separate those examples from OLM changes. update: merge has split out, this branch only has the OLM related changes. |
db09570
to
87bc599
Compare
- "urn:alm:descriptor:com.tectonic.ui:label" | ||
- description: Listeners for incoming connections to the router | ||
displayName: Listener Port | ||
path: listeners.port |
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.
I don't think displaying the first listener port is particularly useful. There doesn't seem to be a way to handle lists effectively yet. From what I can see this mainly affects the overview page in the openshift console. I'd be inclined to keep things simple and just display the role and placement (since those are really the defining characteristics of the deployment) for the time being.
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.
statusDescriptors: | ||
- description: The current revision of the Interconnect cluster | ||
displayName: Revision Number | ||
path: revNumber | ||
- description: The current pods | ||
displayName: Pods | ||
path: pods | ||
- description: The current conditions | ||
displayName: Conditions |
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.
I think the conditions are worth keeping (though I think the operator's use of them needs to be improved a little). There is an x-descriptor available that will display them.
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.
Conditions added back. Please refer to the pic above
} | ||
podNames := getPodNames(podList.Items) | ||
reqLogger.Info("Collecting Pod Status") | ||
dStatus := getPodStatus(r, instance) |
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.
I'm not quite following the logic here. It looks like the pod statuses are retrieved for whichever placement option is used, but then it is ignored unless placement is 'Every'? Or am I missing something?
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.
That was not good, agree.
I change to check with DeploymentStatus.Starting slice. If the Starting slice is not empty, we will continue the loop.
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.
@myeung18 Why? What does starting
have to do with it?
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.
Starting mean there are pods that is still creating/starting and they are not in ready status. So we should continue the loop, unless there is better way to do so.
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.
That does not seem correct to me. Starting means a specific state. If the pod starts faster, you may never see it. After it has started, it goes away, which probably indicates a bug in your code right now. Please test thoroughly to make sure you get the right behavior.
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.
if the pods status is somehow changed, that means it is different from the existing podstaus in instance object, this should fall to the or condition check where both statuses are compared to determine if the status should be updated.
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.
Oh right, it's an or
. So why do you need the first condition?
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.
The daemonset pod creation somehow is slower. After the initial update and requeue. The controller will get exact same status data with all pods in starting state. This event won’t get the chance to enter the if block. The If block is not executed and the requeue is not called. Then no status update event comes in even after all the pods are created. Adding this starting slice check meanly wants to have that requeue get called.
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.
That's not the expected flow. Instead, you should watch created daemon set objects. That would then ensure that any changes to the deployment is reflected in the OLM status.
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.
Changed to watch DaemonSet and removed that Starting slice check. The Controller will now update deployment pod status if there is newer status comes: new and old status objects are compared.
// List the pods for this deployment | ||
var status olm.DeploymentStatus | ||
depFound := &appsv1.Deployment{} | ||
err := r.client.Get(context.TODO(), types.NamespacedName{Name: instance.Name, Namespace: instance.Namespace}, depFound) |
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.
It might be cleaner to use the placement value to determine which method to call for the pod statuses?
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.
changed
8ea7e2e
to
db2e3ba
Compare
I have a new change(or fix) in this branch. A one line change below fixes the issue when we create the operator in cluster scope and it failed to receive events from correct namespaces to create resources. This change will make operator work in cluster scope as well as singe namespace scope. |
clusterPermission is added so that interconnect can query cert-manager through OLM deployment. However, this clusterPermission works only in OLM 0.8.1 or above. To validate the existence of cert-manager, a recommended way should be using discovery api, which doesn't need the cluster role binding. |
Signed-off-by: Marco Yeung <[email protected]>
Signed-off-by: Marco Yeung [email protected]
OLM integration on OCP4
operator status display fixes for OLM
add few custom resource examples for OLM and/or CLI