• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kubernetes-sigs / lws / 17770845641

16 Sep 2025 03:26PM UTC coverage: 35.096% (+1.5%) from 33.646%
17770845641

push

github

web-flow
Bump the kubernetes group with 8 updates (#651)

Bumps the kubernetes group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.34.0` | `0.34.1` |
| [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) | `0.34.0` | `0.34.1` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.34.0` | `0.34.1` |
| [k8s.io/apiserver](https://github.com/kubernetes/apiserver) | `0.34.0` | `0.34.1` |
| [k8s.io/client-go](https://github.com/kubernetes/client-go) | `0.34.0` | `0.34.1` |
| [k8s.io/code-generator](https://github.com/kubernetes/code-generator) | `0.34.0` | `0.34.1` |
| [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.34.0` | `0.34.1` |
| [k8s.io/component-helpers](https://github.com/kubernetes/component-helpers) | `0.34.0` | `0.34.1` |


Updates `k8s.io/api` from 0.34.0 to 0.34.1
- [Commits](https://github.com/kubernetes/api/compare/v0.34.0...v0.34.1)

Updates `k8s.io/apiextensions-apiserver` from 0.34.0 to 0.34.1
- [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases)
- [Commits](https://github.com/kubernetes/apiextensions-apiserver/compare/v0.34.0...v0.34.1)

Updates `k8s.io/apimachinery` from 0.34.0 to 0.34.1
- [Commits](https://github.com/kubernetes/apimachinery/compare/v0.34.0...v0.34.1)

Updates `k8s.io/apiserver` from 0.34.0 to 0.34.1
- [Commits](https://github.com/kubernetes/apiserver/compare/v0.34.0...v0.34.1)

Updates `k8s.io/client-go` from 0.34.0 to 0.34.1
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes/client-go/compare/v0.34.0...v0.34.1)

Updates `k8s.io/code-generator` from 0.34.0 to 0.34.1
- [Commits](https://github.com/kubernetes/code-generator/compare/v0.34.0...v0.34.1)

Updates `k8s.io/component-base` from 0.34.0 to 0.34.1
- [Commits](https://github.com/kubernetes/component-base/compare/v0.34.0...v0.... (continued)

803 of 2288 relevant lines covered (35.1%)

2.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.43
/pkg/utils/controller/controller_utils.go
1
/*
2
Copyright 2023.
3

4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7

8
    http://www.apache.org/licenses/LICENSE-2.0
9

10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16

17
package controller
18

19
import (
20
        "context"
21

22
        corev1 "k8s.io/api/core/v1"
23
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24
        "k8s.io/apimachinery/pkg/runtime"
25
        "k8s.io/apimachinery/pkg/types"
26
        coreapplyv1 "k8s.io/client-go/applyconfigurations/core/v1"
27
        ctrl "sigs.k8s.io/controller-runtime"
28
        "sigs.k8s.io/controller-runtime/pkg/client"
29

30
        leaderworkerset "sigs.k8s.io/lws/api/leaderworkerset/v1"
31
)
32

33
func CreateHeadlessServiceIfNotExists(ctx context.Context, k8sClient client.Client, Scheme *runtime.Scheme, lws *leaderworkerset.LeaderWorkerSet, serviceName string, serviceSelector map[string]string, owner metav1.Object) error {
×
34
        log := ctrl.LoggerFrom(ctx)
×
35
        // If the headless service does not exist in the namespace, create it.
×
36
        var headlessService corev1.Service
×
37
        if err := k8sClient.Get(ctx, types.NamespacedName{Name: serviceName, Namespace: lws.Namespace}, &headlessService); err != nil {
×
38
                if client.IgnoreNotFound(err) != nil {
×
39
                        return err
×
40
                }
×
41
                headlessService := corev1.Service{
×
42
                        ObjectMeta: metav1.ObjectMeta{
×
43
                                Name:      serviceName,
×
44
                                Namespace: lws.Namespace,
×
45
                                Labels:    map[string]string{leaderworkerset.SetNameLabelKey: lws.Name},
×
46
                        },
×
47
                        Spec: corev1.ServiceSpec{
×
48
                                ClusterIP:                "None", // defines service as headless
×
49
                                Selector:                 serviceSelector,
×
50
                                PublishNotReadyAddresses: true,
×
51
                        },
×
52
                }
×
53

×
54
                // Set the controller owner reference for garbage collection and reconciliation.
×
55
                if err := ctrl.SetControllerReference(owner, &headlessService, Scheme); err != nil {
×
56
                        return err
×
57
                }
×
58
                // create the service in the cluster
59
                log.V(2).Info("Creating headless service.")
×
60
                if err := k8sClient.Create(ctx, &headlessService); err != nil {
×
61
                        return err
×
62
                }
×
63
        }
64
        return nil
×
65
}
66

67
func GetPVCApplyConfiguration(lws *leaderworkerset.LeaderWorkerSet) []*coreapplyv1.PersistentVolumeClaimApplyConfiguration {
4✔
68
        pvcApplyConfiguration := []*coreapplyv1.PersistentVolumeClaimApplyConfiguration{}
4✔
69
        if lws == nil {
5✔
70
                return pvcApplyConfiguration
1✔
71
        }
1✔
72

73
        for _, pvc := range lws.Spec.LeaderWorkerTemplate.VolumeClaimTemplates {
6✔
74
                pvcSpecApplyConfig := coreapplyv1.PersistentVolumeClaimSpec().WithAccessModes(pvc.Spec.AccessModes...)
3✔
75
                if pvc.Spec.StorageClassName != nil {
5✔
76
                        pvcSpecApplyConfig = pvcSpecApplyConfig.WithStorageClassName(*pvc.Spec.StorageClassName)
2✔
77
                }
2✔
78
                if pvc.Spec.VolumeMode != nil {
4✔
79
                        pvcSpecApplyConfig = pvcSpecApplyConfig.WithVolumeMode(*pvc.Spec.VolumeMode)
1✔
80
                }
1✔
81
                if pvc.Spec.Resources.Requests != nil || pvc.Spec.Resources.Limits != nil {
4✔
82
                        vrrApplyConfig := coreapplyv1.VolumeResourceRequirementsApplyConfiguration{}
1✔
83
                        if pvc.Spec.Resources.Requests != nil {
2✔
84
                                vrrApplyConfig.Requests = &pvc.Spec.Resources.Requests
1✔
85
                        }
1✔
86
                        if pvc.Spec.Resources.Limits != nil {
2✔
87
                                vrrApplyConfig.Limits = &pvc.Spec.Resources.Limits
1✔
88
                        }
1✔
89
                        pvcSpecApplyConfig = pvcSpecApplyConfig.WithResources(&vrrApplyConfig)
1✔
90
                }
91
                config := coreapplyv1.PersistentVolumeClaim(pvc.Name, lws.Namespace).
3✔
92
                        WithSpec(pvcSpecApplyConfig)
3✔
93
                pvcApplyConfiguration = append(pvcApplyConfiguration, config)
3✔
94
        }
95
        return pvcApplyConfiguration
3✔
96
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc