| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package v1 |
| 20 |
|
| 21 |
import ( |
| 22 |
policyv1 "k8s.io/api/policy/v1" |
| 23 |
apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 24 |
types "k8s.io/apimachinery/pkg/types" |
| 25 |
managedfields "k8s.io/apimachinery/pkg/util/managedfields" |
| 26 |
internal "k8s.io/client-go/applyconfigurations/internal" |
| 27 |
metav1 "k8s.io/client-go/applyconfigurations/meta/v1" |
| 28 |
) |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
type PodDisruptionBudgetApplyConfiguration struct { |
| 33 |
metav1.TypeMetaApplyConfiguration `json:",inline"` |
| 34 |
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` |
| 35 |
Spec *PodDisruptionBudgetSpecApplyConfiguration `json:"spec,omitempty"` |
| 36 |
Status *PodDisruptionBudgetStatusApplyConfiguration `json:"status,omitempty"` |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
func PodDisruptionBudget(name, namespace string) *PodDisruptionBudgetApplyConfiguration { |
| 42 |
b := &PodDisruptionBudgetApplyConfiguration{} |
| 43 |
b.WithName(name) |
| 44 |
b.WithNamespace(namespace) |
| 45 |
b.WithKind("PodDisruptionBudget") |
| 46 |
b.WithAPIVersion("policy/v1") |
| 47 |
return b |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
func ExtractPodDisruptionBudget(podDisruptionBudget *policyv1.PodDisruptionBudget, fieldManager string) (*PodDisruptionBudgetApplyConfiguration, error) { |
| 62 |
return extractPodDisruptionBudget(podDisruptionBudget, fieldManager, "") |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
func ExtractPodDisruptionBudgetStatus(podDisruptionBudget *policyv1.PodDisruptionBudget, fieldManager string) (*PodDisruptionBudgetApplyConfiguration, error) { |
| 69 |
return extractPodDisruptionBudget(podDisruptionBudget, fieldManager, "status") |
| 70 |
} |
| 71 |
|
| 72 |
func extractPodDisruptionBudget(podDisruptionBudget *policyv1.PodDisruptionBudget, fieldManager string, subresource string) (*PodDisruptionBudgetApplyConfiguration, error) { |
| 73 |
b := &PodDisruptionBudgetApplyConfiguration{} |
| 74 |
err := managedfields.ExtractInto(podDisruptionBudget, internal.Parser().Type("io.k8s.api.policy.v1.PodDisruptionBudget"), fieldManager, b, subresource) |
| 75 |
if err != nil { |
| 76 |
return nil, err |
| 77 |
} |
| 78 |
b.WithName(podDisruptionBudget.Name) |
| 79 |
b.WithNamespace(podDisruptionBudget.Namespace) |
| 80 |
|
| 81 |
b.WithKind("PodDisruptionBudget") |
| 82 |
b.WithAPIVersion("policy/v1") |
| 83 |
return b, nil |
| 84 |
} |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
func (b *PodDisruptionBudgetApplyConfiguration) WithKind(value string) *PodDisruptionBudgetApplyConfiguration { |
| 90 |
b.TypeMetaApplyConfiguration.Kind = &value |
| 91 |
return b |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
func (b *PodDisruptionBudgetApplyConfiguration) WithAPIVersion(value string) *PodDisruptionBudgetApplyConfiguration { |
| 98 |
b.TypeMetaApplyConfiguration.APIVersion = &value |
| 99 |
return b |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
func (b *PodDisruptionBudgetApplyConfiguration) WithName(value string) *PodDisruptionBudgetApplyConfiguration { |
| 106 |
b.ensureObjectMetaApplyConfigurationExists() |
| 107 |
b.ObjectMetaApplyConfiguration.Name = &value |
| 108 |
return b |
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
func (b *PodDisruptionBudgetApplyConfiguration) WithGenerateName(value string) *PodDisruptionBudgetApplyConfiguration { |
| 115 |
b.ensureObjectMetaApplyConfigurationExists() |
| 116 |
b.ObjectMetaApplyConfiguration.GenerateName = &value |
| 117 |
return b |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
func (b *PodDisruptionBudgetApplyConfiguration) WithNamespace(value string) *PodDisruptionBudgetApplyConfiguration { |
| 124 |
b.ensureObjectMetaApplyConfigurationExists() |
| 125 |
b.ObjectMetaApplyConfiguration.Namespace = &value |
| 126 |
return b |
| 127 |
} |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
func (b *PodDisruptionBudgetApplyConfiguration) WithUID(value types.UID) *PodDisruptionBudgetApplyConfiguration { |
| 133 |
b.ensureObjectMetaApplyConfigurationExists() |
| 134 |
b.ObjectMetaApplyConfiguration.UID = &value |
| 135 |
return b |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
func (b *PodDisruptionBudgetApplyConfiguration) WithResourceVersion(value string) *PodDisruptionBudgetApplyConfiguration { |
| 142 |
b.ensureObjectMetaApplyConfigurationExists() |
| 143 |
b.ObjectMetaApplyConfiguration.ResourceVersion = &value |
| 144 |
return b |
| 145 |
} |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
func (b *PodDisruptionBudgetApplyConfiguration) WithGeneration(value int64) *PodDisruptionBudgetApplyConfiguration { |
| 151 |
b.ensureObjectMetaApplyConfigurationExists() |
| 152 |
b.ObjectMetaApplyConfiguration.Generation = &value |
| 153 |
return b |
| 154 |
} |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
func (b *PodDisruptionBudgetApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *PodDisruptionBudgetApplyConfiguration { |
| 160 |
b.ensureObjectMetaApplyConfigurationExists() |
| 161 |
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value |
| 162 |
return b |
| 163 |
} |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
func (b *PodDisruptionBudgetApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *PodDisruptionBudgetApplyConfiguration { |
| 169 |
b.ensureObjectMetaApplyConfigurationExists() |
| 170 |
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value |
| 171 |
return b |
| 172 |
} |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
func (b *PodDisruptionBudgetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodDisruptionBudgetApplyConfiguration { |
| 178 |
b.ensureObjectMetaApplyConfigurationExists() |
| 179 |
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value |
| 180 |
return b |
| 181 |
} |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
func (b *PodDisruptionBudgetApplyConfiguration) WithLabels(entries map[string]string) *PodDisruptionBudgetApplyConfiguration { |
| 188 |
b.ensureObjectMetaApplyConfigurationExists() |
| 189 |
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { |
| 190 |
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) |
| 191 |
} |
| 192 |
for k, v := range entries { |
| 193 |
b.ObjectMetaApplyConfiguration.Labels[k] = v |
| 194 |
} |
| 195 |
return b |
| 196 |
} |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
func (b *PodDisruptionBudgetApplyConfiguration) WithAnnotations(entries map[string]string) *PodDisruptionBudgetApplyConfiguration { |
| 203 |
b.ensureObjectMetaApplyConfigurationExists() |
| 204 |
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { |
| 205 |
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) |
| 206 |
} |
| 207 |
for k, v := range entries { |
| 208 |
b.ObjectMetaApplyConfiguration.Annotations[k] = v |
| 209 |
} |
| 210 |
return b |
| 211 |
} |
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
func (b *PodDisruptionBudgetApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *PodDisruptionBudgetApplyConfiguration { |
| 217 |
b.ensureObjectMetaApplyConfigurationExists() |
| 218 |
for i := range values { |
| 219 |
if values[i] == nil { |
| 220 |
panic("nil value passed to WithOwnerReferences") |
| 221 |
} |
| 222 |
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) |
| 223 |
} |
| 224 |
return b |
| 225 |
} |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
func (b *PodDisruptionBudgetApplyConfiguration) WithFinalizers(values ...string) *PodDisruptionBudgetApplyConfiguration { |
| 231 |
b.ensureObjectMetaApplyConfigurationExists() |
| 232 |
for i := range values { |
| 233 |
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) |
| 234 |
} |
| 235 |
return b |
| 236 |
} |
| 237 |
|
| 238 |
func (b *PodDisruptionBudgetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { |
| 239 |
if b.ObjectMetaApplyConfiguration == nil { |
| 240 |
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
func (b *PodDisruptionBudgetApplyConfiguration) WithSpec(value *PodDisruptionBudgetSpecApplyConfiguration) *PodDisruptionBudgetApplyConfiguration { |
| 248 |
b.Spec = value |
| 249 |
return b |
| 250 |
} |
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
func (b *PodDisruptionBudgetApplyConfiguration) WithStatus(value *PodDisruptionBudgetStatusApplyConfiguration) *PodDisruptionBudgetApplyConfiguration { |
| 256 |
b.Status = value |
| 257 |
return b |
| 258 |
} |
| 259 |
|
| 260 |
|
| 261 |
func (b *PodDisruptionBudgetApplyConfiguration) GetName() *string { |
| 262 |
b.ensureObjectMetaApplyConfigurationExists() |
| 263 |
return b.ObjectMetaApplyConfiguration.Name |
| 264 |
} |