Skip to content
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

notes on exploring k8s api reliability #9630

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions master/internal/rm/kubernetesrm/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,14 @@ func newJobsService(
return p, nil
}

// kristine building the client
func (j *jobsService) startClientSet() error {
config, err := readClientConfig(j.kubeconfigPath)
if err != nil {
return fmt.Errorf("error building kubernetes config: %w", err)
}

j.syslog.Infof(" ***** config timeout: %d ms", config.Timeout.Milliseconds())
j.clientSet, err = k8sClient.NewForConfig(config)
if err != nil {
return fmt.Errorf("failed to initialize kubernetes clientSet: %w", err)
Expand Down Expand Up @@ -380,11 +382,16 @@ func (j *jobsService) getMasterIPAndPort() error {
}

func (j *jobsService) getSystemResourceRequests() error {
start := time.Now()
systemPods, err := j.podInterfaces[j.namespace].List(
context.TODO(), metaV1.ListOptions{LabelSelector: determinedSystemLabel})
if err != nil {
elapsed := time.Since(start)
j.syslog.Infof(" ***** error: List Pods: %d ms", elapsed.Milliseconds())
return fmt.Errorf("failed to get system pods: %w", err)
}
elapsed := time.Since(start)
j.syslog.Infof(" ***** List Pods: %d ms", elapsed.Milliseconds())

for _, systemPod := range systemPods.Items {
for _, container := range systemPod.Spec.Containers {
Expand Down Expand Up @@ -1902,6 +1909,7 @@ func (j *jobsService) getNonDetPods() ([]k8sV1.Pod, error) {
// TODO(RM-235) use a filter in metaV1.ListOptions. This change gets a lot easier after
// we have K8s integration tests. Using a filter means we should really talk to a real
// k8s server. Doing an e2e test for this is possible but would take a lot more work.
// kristine
allPods, err := j.listPodsInAllNamespaces(context.TODO(), metaV1.ListOptions{})
if err != nil {
return nil, err
Expand Down Expand Up @@ -1996,10 +2004,14 @@ func (j *jobsService) listJobsInAllNamespaces(
) ([]batchV1.Job, error) {
var res []batchV1.Job
for n, i := range j.jobInterfaces {
start := time.Now()
pods, err := i.List(ctx, opts)
elapsed := time.Since(start)
if err != nil {
j.syslog.Infof(" ***** List Pods in all Namespaces: %d ms", elapsed.Milliseconds())
return nil, fmt.Errorf("error listing pods for namespace %s: %w", n, err)
}
j.syslog.Infof(" ***** List Pods in all Namespaces: %d ms", elapsed.Milliseconds())

res = append(res, pods.Items...)
}
Expand Down
Loading