| 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 |
corev1 "k8s.io/api/core/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 ServiceAccountApplyConfiguration struct { |
| 33 |
metav1.TypeMetaApplyConfiguration `json:",inline"` |
| 34 |
*metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` |
| 35 |
Secrets []ObjectReferenceApplyConfiguration `json:"secrets,omitempty"` |
| 36 |
ImagePullSecrets []LocalObjectReferenceApplyConfiguration `json:"imagePullSecrets,omitempty"` |
| 37 |
AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty"` |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
func ServiceAccount(name, namespace string) *ServiceAccountApplyConfiguration { |
| 43 |
b := &ServiceAccountApplyConfiguration{} |
| 44 |
b.WithName(name) |
| 45 |
b.WithNamespace(namespace) |
| 46 |
b.WithKind("ServiceAccount") |
| 47 |
b.WithAPIVersion("v1") |
| 48 |
return b |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
func ExtractServiceAccount(serviceAccount *corev1.ServiceAccount, fieldManager string) (*ServiceAccountApplyConfiguration, error) { |
| 63 |
return extractServiceAccount(serviceAccount, fieldManager, "") |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
func ExtractServiceAccountStatus(serviceAccount *corev1.ServiceAccount, fieldManager string) (*ServiceAccountApplyConfiguration, error) { |
| 70 |
return extractServiceAccount(serviceAccount, fieldManager, "status") |
| 71 |
} |
| 72 |
|
| 73 |
func extractServiceAccount(serviceAccount *corev1.ServiceAccount, fieldManager string, subresource string) (*ServiceAccountApplyConfiguration, error) { |
| 74 |
b := &ServiceAccountApplyConfiguration{} |
| 75 |
err := managedfields.ExtractInto(serviceAccount, internal.Parser().Type("io.k8s.api.core.v1.ServiceAccount"), fieldManager, b, subresource) |
| 76 |
if err != nil { |
| 77 |
return nil, err |
| 78 |
} |
| 79 |
b.WithName(serviceAccount.Name) |
| 80 |
b.WithNamespace(serviceAccount.Namespace) |
| 81 |
|
| 82 |
b.WithKind("ServiceAccount") |
| 83 |
b.WithAPIVersion("v1") |
| 84 |
return b, nil |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
func (b *ServiceAccountApplyConfiguration) WithKind(value string) *ServiceAccountApplyConfiguration { |
| 91 |
b.TypeMetaApplyConfiguration.Kind = &value |
| 92 |
return b |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
func (b *ServiceAccountApplyConfiguration) WithAPIVersion(value string) *ServiceAccountApplyConfiguration { |
| 99 |
b.TypeMetaApplyConfiguration.APIVersion = &value |
| 100 |
return b |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
func (b *ServiceAccountApplyConfiguration) WithName(value string) *ServiceAccountApplyConfiguration { |
| 107 |
b.ensureObjectMetaApplyConfigurationExists() |
| 108 |
b.ObjectMetaApplyConfiguration.Name = &value |
| 109 |
return b |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
func (b *ServiceAccountApplyConfiguration) WithGenerateName(value string) *ServiceAccountApplyConfiguration { |
| 116 |
b.ensureObjectMetaApplyConfigurationExists() |
| 117 |
b.ObjectMetaApplyConfiguration.GenerateName = &value |
| 118 |
return b |
| 119 |
} |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
func (b *ServiceAccountApplyConfiguration) WithNamespace(value string) *ServiceAccountApplyConfiguration { |
| 125 |
b.ensureObjectMetaApplyConfigurationExists() |
| 126 |
b.ObjectMetaApplyConfiguration.Namespace = &value |
| 127 |
return b |
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
func (b *ServiceAccountApplyConfiguration) WithUID(value types.UID) *ServiceAccountApplyConfiguration { |
| 134 |
b.ensureObjectMetaApplyConfigurationExists() |
| 135 |
b.ObjectMetaApplyConfiguration.UID = &value |
| 136 |
return b |
| 137 |
} |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
func (b *ServiceAccountApplyConfiguration) WithResourceVersion(value string) *ServiceAccountApplyConfiguration { |
| 143 |
b.ensureObjectMetaApplyConfigurationExists() |
| 144 |
b.ObjectMetaApplyConfiguration.ResourceVersion = &value |
| 145 |
return b |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
func (b *ServiceAccountApplyConfiguration) WithGeneration(value int64) *ServiceAccountApplyConfiguration { |
| 152 |
b.ensureObjectMetaApplyConfigurationExists() |
| 153 |
b.ObjectMetaApplyConfiguration.Generation = &value |
| 154 |
return b |
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
func (b *ServiceAccountApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ServiceAccountApplyConfiguration { |
| 161 |
b.ensureObjectMetaApplyConfigurationExists() |
| 162 |
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value |
| 163 |
return b |
| 164 |
} |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
func (b *ServiceAccountApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ServiceAccountApplyConfiguration { |
| 170 |
b.ensureObjectMetaApplyConfigurationExists() |
| 171 |
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value |
| 172 |
return b |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
func (b *ServiceAccountApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ServiceAccountApplyConfiguration { |
| 179 |
b.ensureObjectMetaApplyConfigurationExists() |
| 180 |
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value |
| 181 |
return b |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
func (b *ServiceAccountApplyConfiguration) WithLabels(entries map[string]string) *ServiceAccountApplyConfiguration { |
| 189 |
b.ensureObjectMetaApplyConfigurationExists() |
| 190 |
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { |
| 191 |
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) |
| 192 |
} |
| 193 |
for k, v := range entries { |
| 194 |
b.ObjectMetaApplyConfiguration.Labels[k] = v |
| 195 |
} |
| 196 |
return b |
| 197 |
} |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
func (b *ServiceAccountApplyConfiguration) WithAnnotations(entries map[string]string) *ServiceAccountApplyConfiguration { |
| 204 |
b.ensureObjectMetaApplyConfigurationExists() |
| 205 |
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { |
| 206 |
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) |
| 207 |
} |
| 208 |
for k, v := range entries { |
| 209 |
b.ObjectMetaApplyConfiguration.Annotations[k] = v |
| 210 |
} |
| 211 |
return b |
| 212 |
} |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
func (b *ServiceAccountApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ServiceAccountApplyConfiguration { |
| 218 |
b.ensureObjectMetaApplyConfigurationExists() |
| 219 |
for i := range values { |
| 220 |
if values[i] == nil { |
| 221 |
panic("nil value passed to WithOwnerReferences") |
| 222 |
} |
| 223 |
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) |
| 224 |
} |
| 225 |
return b |
| 226 |
} |
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
func (b *ServiceAccountApplyConfiguration) WithFinalizers(values ...string) *ServiceAccountApplyConfiguration { |
| 232 |
b.ensureObjectMetaApplyConfigurationExists() |
| 233 |
for i := range values { |
| 234 |
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) |
| 235 |
} |
| 236 |
return b |
| 237 |
} |
| 238 |
|
| 239 |
func (b *ServiceAccountApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { |
| 240 |
if b.ObjectMetaApplyConfiguration == nil { |
| 241 |
b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} |
| 242 |
} |
| 243 |
} |
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
func (b *ServiceAccountApplyConfiguration) WithSecrets(values ...*ObjectReferenceApplyConfiguration) *ServiceAccountApplyConfiguration { |
| 249 |
for i := range values { |
| 250 |
if values[i] == nil { |
| 251 |
panic("nil value passed to WithSecrets") |
| 252 |
} |
| 253 |
b.Secrets = append(b.Secrets, *values[i]) |
| 254 |
} |
| 255 |
return b |
| 256 |
} |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
func (b *ServiceAccountApplyConfiguration) WithImagePullSecrets(values ...*LocalObjectReferenceApplyConfiguration) *ServiceAccountApplyConfiguration { |
| 262 |
for i := range values { |
| 263 |
if values[i] == nil { |
| 264 |
panic("nil value passed to WithImagePullSecrets") |
| 265 |
} |
| 266 |
b.ImagePullSecrets = append(b.ImagePullSecrets, *values[i]) |
| 267 |
} |
| 268 |
return b |
| 269 |
} |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
func (b *ServiceAccountApplyConfiguration) WithAutomountServiceAccountToken(value bool) *ServiceAccountApplyConfiguration { |
| 275 |
b.AutomountServiceAccountToken = &value |
| 276 |
return b |
| 277 |
} |
| 278 |
|
| 279 |
|
| 280 |
func (b *ServiceAccountApplyConfiguration) GetName() *string { |
| 281 |
b.ensureObjectMetaApplyConfigurationExists() |
| 282 |
return b.ObjectMetaApplyConfiguration.Name |
| 283 |
} |