|
1 | 1 | package generators |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "fmt" |
5 | | - |
6 | 4 | admissionregistrationv1 "k8s.io/api/admissionregistration/v1" |
7 | 5 | appsv1 "k8s.io/api/apps/v1" |
8 | 6 | corev1 "k8s.io/api/core/v1" |
@@ -217,36 +215,41 @@ func CreateDeploymentResource(name string, namespace string, opts ...ResourceCre |
217 | 215 | ).(*appsv1.Deployment) |
218 | 216 | } |
219 | 217 |
|
220 | | -func CreateValidatingWebhookConfigurationResource(generateName string, namespace string, opts ...ResourceCreatorOption) *admissionregistrationv1.ValidatingWebhookConfiguration { |
| 218 | +// CreateValidatingWebhookConfigurationResource creates a ValidatingWebhookConfiguration resource with name 'name', |
| 219 | +// namespace 'namespace', and applying any ValidatingWebhookConfiguration related options in opts |
| 220 | +func CreateValidatingWebhookConfigurationResource(name string, namespace string, opts ...ResourceCreatorOption) *admissionregistrationv1.ValidatingWebhookConfiguration { |
221 | 221 | return ResourceCreatorOptions(opts).ApplyTo( |
222 | 222 | &admissionregistrationv1.ValidatingWebhookConfiguration{ |
223 | 223 | TypeMeta: metav1.TypeMeta{ |
224 | 224 | Kind: "ValidatingWebhookConfiguration", |
225 | 225 | APIVersion: admissionregistrationv1.SchemeGroupVersion.String(), |
226 | 226 | }, |
227 | 227 | ObjectMeta: metav1.ObjectMeta{ |
228 | | - GenerateName: fmt.Sprintf("%s-", generateName), |
229 | | - Namespace: namespace, |
| 228 | + Name: name, |
| 229 | + Namespace: namespace, |
230 | 230 | }, |
231 | 231 | }, |
232 | 232 | ).(*admissionregistrationv1.ValidatingWebhookConfiguration) |
233 | 233 | } |
234 | 234 |
|
235 | | -func CreateMutatingWebhookConfigurationResource(generateName string, namespace string, opts ...ResourceCreatorOption) *admissionregistrationv1.MutatingWebhookConfiguration { |
| 235 | +// CreateMutatingWebhookConfigurationResource creates a MutatingWebhookConfiguration resource with name 'name', |
| 236 | +// namespace 'namespace', and applying any MutatingWebhookConfiguration related options in opts |
| 237 | +func CreateMutatingWebhookConfigurationResource(name string, namespace string, opts ...ResourceCreatorOption) *admissionregistrationv1.MutatingWebhookConfiguration { |
236 | 238 | return ResourceCreatorOptions(opts).ApplyTo( |
237 | 239 | &admissionregistrationv1.MutatingWebhookConfiguration{ |
238 | 240 | TypeMeta: metav1.TypeMeta{ |
239 | 241 | Kind: "MutatingWebhookConfiguration", |
240 | 242 | APIVersion: admissionregistrationv1.SchemeGroupVersion.String(), |
241 | 243 | }, |
242 | 244 | ObjectMeta: metav1.ObjectMeta{ |
243 | | - GenerateName: fmt.Sprintf("%s-", generateName), |
244 | | - Namespace: namespace, |
| 245 | + Name: name, |
| 246 | + Namespace: namespace, |
245 | 247 | }, |
246 | 248 | }, |
247 | 249 | ).(*admissionregistrationv1.MutatingWebhookConfiguration) |
248 | 250 | } |
249 | 251 |
|
| 252 | +// CreateServiceResource creates a Service resource with name 'name', namespace 'namespace', and applying any Service related options in opts |
250 | 253 | func CreateServiceResource(name string, namespace string, opts ...ResourceCreatorOption) *corev1.Service { |
251 | 254 | return ResourceCreatorOptions(opts).ApplyTo(&corev1.Service{ |
252 | 255 | TypeMeta: metav1.TypeMeta{ |
|
0 commit comments