From d0753732db65f85bba242a9d4d98b3b3851fcfa0 Mon Sep 17 00:00:00 2001 From: Shinebayar Gansukh <3091558+shinebayar-g@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:07:51 -0800 Subject: [PATCH] fix(core): add toYaml method for all ApiObjects fix(core): return type of ApiObject.name --- examples/helm-example.yaml | 801 ++++++++++++++++++ .../ClusterRole.ingress-nginx-admission.yaml | 23 - .../my-k8s-app/ClusterRole.ingress-nginx.yaml | 82 -- ...erRoleBinding.ingress-nginx-admission.yaml | 23 - .../ClusterRoleBinding.ingress-nginx.yaml | 19 - .../ConfigMap.ingress-nginx-controller.yaml | 15 - .../my-k8s-app/ConfigMap.my-config-map.yaml | 3 + .../Deployment.ingress-nginx-controller.yaml | 125 --- examples/my-k8s-app/IngressClass.nginx.yaml | 14 - .../Job.ingress-nginx-admission-create.yaml | 57 -- .../Job.ingress-nginx-admission-patch.yaml | 59 -- .../Role.ingress-nginx-admission.yaml | 24 - examples/my-k8s-app/Role.ingress-nginx.yaml | 91 -- .../RoleBinding.ingress-nginx-admission.yaml | 24 - .../my-k8s-app/RoleBinding.ingress-nginx.yaml | 21 - ...ce.ingress-nginx-controller-admission.yaml | 24 - ...vice.ingress-nginx-controller-metrics.yaml | 24 - .../Service.ingress-nginx-controller.yaml | 34 - ...erviceAccount.ingress-nginx-admission.yaml | 17 - .../ServiceAccount.ingress-nginx.yaml | 14 - ...rviceMonitor.ingress-nginx-controller.yaml | 25 - ...Configuration.ingress-nginx-admission.yaml | 36 - examples/src/example1.ts | 58 ++ examples/src/{main.ts => example2.ts} | 12 +- packages/cli/src/generateCore.ts | 2 +- packages/core/src/ApiObject.ts | 11 +- packages/core/src/Helm.ts | 30 +- packages/core/src/K8sApp.ts | 5 +- packages/core/src/models/APIServicev1.ts | 2 +- .../models/AuthenticationTokenRequestv1.ts | 2 +- packages/core/src/models/Bindingv1.ts | 2 +- packages/core/src/models/CSIDriverv1.ts | 2 +- packages/core/src/models/CSINodev1.ts | 2 +- .../core/src/models/CSIStorageCapacityv1.ts | 2 +- .../src/models/CertificateSigningRequestv1.ts | 2 +- .../core/src/models/ClusterRoleBindingv1.ts | 2 +- packages/core/src/models/ClusterRolev1.ts | 2 +- .../src/models/ClusterTrustBundlev1alpha1.ts | 2 +- packages/core/src/models/ConfigMapv1.ts | 2 +- .../core/src/models/ControllerRevisionv1.ts | 2 +- packages/core/src/models/CoreEventv1.ts | 2 +- packages/core/src/models/CronJobv1.ts | 2 +- .../src/models/CustomResourceDefinitionv1.ts | 2 +- packages/core/src/models/DaemonSetv1.ts | 2 +- packages/core/src/models/Deploymentv1.ts | 2 +- .../core/src/models/DeviceClassv1alpha3.ts | 2 +- .../core/src/models/DeviceClassv1beta1.ts | 2 +- packages/core/src/models/EndpointSlicev1.ts | 2 +- packages/core/src/models/Endpointsv1.ts | 2 +- packages/core/src/models/EventsEventv1.ts | 2 +- packages/core/src/models/Evictionv1.ts | 2 +- packages/core/src/models/FlowSchemav1.ts | 2 +- .../src/models/HorizontalPodAutoscalerv1.ts | 2 +- .../src/models/HorizontalPodAutoscalerv2.ts | 2 +- packages/core/src/models/IPAddressv1beta1.ts | 2 +- packages/core/src/models/IngressClassv1.ts | 2 +- packages/core/src/models/Ingressv1.ts | 2 +- packages/core/src/models/Jobv1.ts | 2 +- .../core/src/models/LeaseCandidatev1alpha2.ts | 2 +- packages/core/src/models/Leasev1.ts | 2 +- packages/core/src/models/LimitRangev1.ts | 2 +- .../src/models/LocalSubjectAccessReviewv1.ts | 2 +- .../MutatingAdmissionPolicyBindingv1alpha1.ts | 2 +- .../models/MutatingAdmissionPolicyv1alpha1.ts | 2 +- .../models/MutatingWebhookConfigurationv1.ts | 2 +- packages/core/src/models/Namespacev1.ts | 2 +- packages/core/src/models/NetworkPolicyv1.ts | 2 +- packages/core/src/models/Nodev1.ts | 2 +- .../core/src/models/PersistentVolumev1.ts | 2 +- .../core/src/models/PodDisruptionBudgetv1.ts | 2 +- packages/core/src/models/PodTemplatev1.ts | 2 +- packages/core/src/models/Podv1.ts | 2 +- packages/core/src/models/PriorityClassv1.ts | 2 +- .../models/PriorityLevelConfigurationv1.ts | 2 +- packages/core/src/models/ReplicaSetv1.ts | 2 +- .../src/models/ReplicationControllerv1.ts | 2 +- .../models/ResourceClaimTemplatev1alpha3.ts | 2 +- .../models/ResourceClaimTemplatev1beta1.ts | 2 +- .../core/src/models/ResourceClaimv1alpha3.ts | 2 +- .../core/src/models/ResourceClaimv1beta1.ts | 2 +- packages/core/src/models/ResourceQuotav1.ts | 2 +- .../core/src/models/ResourceSlicev1alpha3.ts | 2 +- .../core/src/models/ResourceSlicev1beta1.ts | 2 +- packages/core/src/models/RoleBindingv1.ts | 2 +- packages/core/src/models/Rolev1.ts | 2 +- packages/core/src/models/RuntimeClassv1.ts | 2 +- packages/core/src/models/Secretv1.ts | 2 +- .../src/models/SelfSubjectAccessReviewv1.ts | 2 +- .../core/src/models/SelfSubjectReviewv1.ts | 2 +- .../src/models/SelfSubjectReviewv1beta1.ts | 2 +- .../src/models/SelfSubjectRulesReviewv1.ts | 2 +- packages/core/src/models/ServiceAccountv1.ts | 2 +- .../core/src/models/ServiceCIDRv1beta1.ts | 2 +- packages/core/src/models/Servicev1.ts | 2 +- packages/core/src/models/StatefulSetv1.ts | 2 +- packages/core/src/models/StorageClassv1.ts | 2 +- .../models/StorageVersionMigrationv1alpha1.ts | 2 +- .../core/src/models/StorageVersionv1alpha1.ts | 2 +- .../core/src/models/SubjectAccessReviewv1.ts | 2 +- packages/core/src/models/TokenReviewv1.ts | 2 +- .../ValidatingAdmissionPolicyBindingv1.ts | 2 +- ...ValidatingAdmissionPolicyBindingv1beta1.ts | 2 +- .../src/models/ValidatingAdmissionPolicyv1.ts | 2 +- .../ValidatingAdmissionPolicyv1beta1.ts | 2 +- .../ValidatingWebhookConfigurationv1.ts | 2 +- .../core/src/models/VolumeAttachmentv1.ts | 2 +- .../models/VolumeAttributesClassv1alpha1.ts | 2 +- .../models/VolumeAttributesClassv1beta1.ts | 2 +- 108 files changed, 987 insertions(+), 846 deletions(-) create mode 100644 examples/helm-example.yaml delete mode 100644 examples/my-k8s-app/ClusterRole.ingress-nginx-admission.yaml delete mode 100644 examples/my-k8s-app/ClusterRole.ingress-nginx.yaml delete mode 100644 examples/my-k8s-app/ClusterRoleBinding.ingress-nginx-admission.yaml delete mode 100644 examples/my-k8s-app/ClusterRoleBinding.ingress-nginx.yaml delete mode 100644 examples/my-k8s-app/ConfigMap.ingress-nginx-controller.yaml delete mode 100644 examples/my-k8s-app/Deployment.ingress-nginx-controller.yaml delete mode 100644 examples/my-k8s-app/IngressClass.nginx.yaml delete mode 100644 examples/my-k8s-app/Job.ingress-nginx-admission-create.yaml delete mode 100644 examples/my-k8s-app/Job.ingress-nginx-admission-patch.yaml delete mode 100644 examples/my-k8s-app/Role.ingress-nginx-admission.yaml delete mode 100644 examples/my-k8s-app/Role.ingress-nginx.yaml delete mode 100644 examples/my-k8s-app/RoleBinding.ingress-nginx-admission.yaml delete mode 100644 examples/my-k8s-app/RoleBinding.ingress-nginx.yaml delete mode 100644 examples/my-k8s-app/Service.ingress-nginx-controller-admission.yaml delete mode 100644 examples/my-k8s-app/Service.ingress-nginx-controller-metrics.yaml delete mode 100644 examples/my-k8s-app/Service.ingress-nginx-controller.yaml delete mode 100644 examples/my-k8s-app/ServiceAccount.ingress-nginx-admission.yaml delete mode 100644 examples/my-k8s-app/ServiceAccount.ingress-nginx.yaml delete mode 100644 examples/my-k8s-app/ServiceMonitor.ingress-nginx-controller.yaml delete mode 100644 examples/my-k8s-app/ValidatingWebhookConfiguration.ingress-nginx-admission.yaml create mode 100644 examples/src/example1.ts rename examples/src/{main.ts => example2.ts} (88%) diff --git a/examples/helm-example.yaml b/examples/helm-example.yaml new file mode 100644 index 0000000..b19aef3 --- /dev/null +++ b/examples/helm-example.yaml @@ -0,0 +1,801 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: ingress-nginx + namespace: nginx +automountServiceAccountToken: true +--- +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: ingress-nginx-controller + namespace: nginx +data: + allow-snippet-annotations: 'false' +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + name: ingress-nginx +rules: + - apiGroups: + - '' + resources: + - configmaps + - endpoints + - nodes + - pods + - secrets + - namespaces + verbs: + - list + - watch + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - list + - watch + - apiGroups: + - '' + resources: + - nodes + verbs: + - get + - apiGroups: + - '' + resources: + - services + verbs: + - get + - list + - watch + - apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + - watch + - apiGroups: + - '' + resources: + - events + verbs: + - create + - patch + - apiGroups: + - networking.k8s.io + resources: + - ingresses/status + verbs: + - update + - apiGroups: + - networking.k8s.io + resources: + - ingressclasses + verbs: + - get + - list + - watch + - apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - list + - watch + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + name: ingress-nginx +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: ingress-nginx +subjects: + - kind: ServiceAccount + name: ingress-nginx + namespace: nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: ingress-nginx + namespace: nginx +rules: + - apiGroups: + - '' + resources: + - namespaces + verbs: + - get + - apiGroups: + - '' + resources: + - configmaps + - pods + - secrets + - endpoints + verbs: + - get + - list + - watch + - apiGroups: + - '' + resources: + - services + verbs: + - get + - list + - watch + - apiGroups: + - networking.k8s.io + resources: + - ingresses + verbs: + - get + - list + - watch + - apiGroups: + - networking.k8s.io + resources: + - ingresses/status + verbs: + - update + - apiGroups: + - networking.k8s.io + resources: + - ingressclasses + verbs: + - get + - list + - watch + - apiGroups: + - coordination.k8s.io + resources: + - leases + resourceNames: + - ingress-nginx-leader + verbs: + - get + - update + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - apiGroups: + - '' + resources: + - events + verbs: + - create + - patch + - apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - list + - watch + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: ingress-nginx + namespace: nginx +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: ingress-nginx +subjects: + - kind: ServiceAccount + name: ingress-nginx + namespace: nginx +--- +apiVersion: v1 +kind: Service +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: ingress-nginx-controller-metrics + namespace: nginx +spec: + type: ClusterIP + ports: + - name: metrics + port: 10254 + protocol: TCP + targetPort: metrics + selector: + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/component: controller +--- +apiVersion: v1 +kind: Service +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: ingress-nginx-controller-admission + namespace: nginx +spec: + type: ClusterIP + ports: + - name: https-webhook + port: 443 + targetPort: webhook + appProtocol: https + selector: + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/component: controller +--- +apiVersion: v1 +kind: Service +metadata: + annotations: null + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: ingress-nginx-controller + namespace: nginx +spec: + type: NodePort + ipFamilyPolicy: SingleStack + ipFamilies: + - IPv4 + ports: + - name: http + port: 80 + protocol: TCP + targetPort: http + appProtocol: http + - name: https + port: 443 + protocol: TCP + targetPort: https + appProtocol: https + selector: + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/component: controller +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: ingress-nginx-controller + namespace: nginx +spec: + selector: + matchLabels: + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/component: controller + replicas: 1 + revisionHistoryLimit: 10 + minReadySeconds: 0 + template: + metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + spec: + dnsPolicy: ClusterFirst + containers: + - name: controller + image: registry.k8s.io/ingress-nginx/controller:v1.11.3@sha256:d56f135b6462cfc476447cfe564b83a45e8bb7da2774963b00d12161112270b7 + imagePullPolicy: IfNotPresent + lifecycle: + preStop: + exec: + command: + - /wait-shutdown + args: + - /nginx-ingress-controller + - --publish-service=$(POD_NAMESPACE)/ingress-nginx-controller + - --election-id=ingress-nginx-leader + - --controller-class=k8s.io/ingress-nginx + - --ingress-class=nginx + - --configmap=$(POD_NAMESPACE)/ingress-nginx-controller + - --validating-webhook=:8443 + - --validating-webhook-certificate=/usr/local/certificates/cert + - --validating-webhook-key=/usr/local/certificates/key + securityContext: + runAsNonRoot: true + runAsUser: 101 + allowPrivilegeEscalation: false + seccompProfile: + type: RuntimeDefault + capabilities: + drop: + - ALL + add: + - NET_BIND_SERVICE + readOnlyRootFilesystem: false + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: LD_PRELOAD + value: /usr/local/lib/libmimalloc.so + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + readinessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + - name: metrics + containerPort: 10254 + protocol: TCP + - name: webhook + containerPort: 8443 + protocol: TCP + volumeMounts: + - name: webhook-cert + mountPath: /usr/local/certificates/ + readOnly: true + resources: + requests: + cpu: 100m + memory: 90Mi + nodeSelector: + kubernetes.io/os: linux + serviceAccountName: ingress-nginx + terminationGracePeriodSeconds: 300 + volumes: + - name: webhook-cert + secret: + secretName: ingress-nginx-admission +--- +apiVersion: networking.k8s.io/v1 +kind: IngressClass +metadata: + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller + name: nginx +spec: + controller: k8s.io/ingress-nginx +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: ingress-nginx-controller + namespace: nginx + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: controller +spec: + endpoints: + - port: metrics + interval: 30s + namespaceSelector: + matchNames: + - nginx + selector: + matchLabels: + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/component: controller +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + annotations: null + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook + name: ingress-nginx-admission +webhooks: + - name: validate.nginx.ingress.kubernetes.io + matchPolicy: Equivalent + rules: + - apiGroups: + - networking.k8s.io + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - ingresses + failurePolicy: Fail + sideEffects: None + admissionReviewVersions: + - v1 + clientConfig: + service: + name: ingress-nginx-controller-admission + namespace: nginx + port: 443 + path: /networking/v1/ingresses +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: ingress-nginx-admission + namespace: nginx + annotations: + helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook +automountServiceAccountToken: true +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: ingress-nginx-admission + annotations: + helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook +rules: + - apiGroups: + - admissionregistration.k8s.io + resources: + - validatingwebhookconfigurations + verbs: + - get + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: ingress-nginx-admission + annotations: + helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: ingress-nginx-admission +subjects: + - kind: ServiceAccount + name: ingress-nginx-admission + namespace: nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: ingress-nginx-admission + namespace: nginx + annotations: + helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook +rules: + - apiGroups: + - '' + resources: + - secrets + verbs: + - get + - create +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: ingress-nginx-admission + namespace: nginx + annotations: + helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: ingress-nginx-admission +subjects: + - kind: ServiceAccount + name: ingress-nginx-admission + namespace: nginx +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: ingress-nginx-admission-create + namespace: nginx + annotations: + helm.sh/hook: pre-install,pre-upgrade + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook +spec: + template: + metadata: + name: ingress-nginx-admission-create + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook + spec: + containers: + - name: create + image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.4.4@sha256:a9f03b34a3cbfbb26d103a14046ab2c5130a80c3d69d526ff8063d2b37b9fd3f + imagePullPolicy: IfNotPresent + args: + - create + - --host=ingress-nginx-controller-admission,ingress-nginx-controller-admission.$(POD_NAMESPACE).svc + - --namespace=$(POD_NAMESPACE) + - --secret-name=ingress-nginx-admission + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 65532 + seccompProfile: + type: RuntimeDefault + restartPolicy: OnFailure + serviceAccountName: ingress-nginx-admission + nodeSelector: + kubernetes.io/os: linux +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: ingress-nginx-admission-patch + namespace: nginx + annotations: + helm.sh/hook: post-install,post-upgrade + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook +spec: + template: + metadata: + name: ingress-nginx-admission-patch + labels: + helm.sh/chart: ingress-nginx-4.11.3 + app.kubernetes.io/name: ingress-nginx + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/version: 1.11.3 + app.kubernetes.io/part-of: ingress-nginx + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: admission-webhook + spec: + containers: + - name: patch + image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.4.4@sha256:a9f03b34a3cbfbb26d103a14046ab2c5130a80c3d69d526ff8063d2b37b9fd3f + imagePullPolicy: IfNotPresent + args: + - patch + - --webhook-name=ingress-nginx-admission + - --namespace=$(POD_NAMESPACE) + - --patch-mutating=false + - --secret-name=ingress-nginx-admission + - --patch-failure-policy=Fail + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 65532 + seccompProfile: + type: RuntimeDefault + restartPolicy: OnFailure + serviceAccountName: ingress-nginx-admission + nodeSelector: + kubernetes.io/os: linux +--- +apiVersion: v1 +data: + key1: value1 + key2: value2 +kind: ConfigMap +metadata: + namespace: fooo + name: my-config-map +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-nginx-deployment + namespace: my-app-namespace +spec: + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:alpine + ports: + - containerPort: 80 + name: http diff --git a/examples/my-k8s-app/ClusterRole.ingress-nginx-admission.yaml b/examples/my-k8s-app/ClusterRole.ingress-nginx-admission.yaml deleted file mode 100644 index 54a9e3d..0000000 --- a/examples/my-k8s-app/ClusterRole.ingress-nginx-admission.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: ingress-nginx-admission - annotations: - helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade - helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook -rules: - - apiGroups: - - admissionregistration.k8s.io - resources: - - validatingwebhookconfigurations - verbs: - - get - - update diff --git a/examples/my-k8s-app/ClusterRole.ingress-nginx.yaml b/examples/my-k8s-app/ClusterRole.ingress-nginx.yaml deleted file mode 100644 index 4649e68..0000000 --- a/examples/my-k8s-app/ClusterRole.ingress-nginx.yaml +++ /dev/null @@ -1,82 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - name: ingress-nginx -rules: - - apiGroups: - - "" - resources: - - configmaps - - endpoints - - nodes - - pods - - secrets - - namespaces - verbs: - - list - - watch - - apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - list - - watch - - apiGroups: - - "" - resources: - - nodes - verbs: - - get - - apiGroups: - - "" - resources: - - services - verbs: - - get - - list - - watch - - apiGroups: - - networking.k8s.io - resources: - - ingresses - verbs: - - get - - list - - watch - - apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - - apiGroups: - - networking.k8s.io - resources: - - ingresses/status - verbs: - - update - - apiGroups: - - networking.k8s.io - resources: - - ingressclasses - verbs: - - get - - list - - watch - - apiGroups: - - discovery.k8s.io - resources: - - endpointslices - verbs: - - list - - watch - - get diff --git a/examples/my-k8s-app/ClusterRoleBinding.ingress-nginx-admission.yaml b/examples/my-k8s-app/ClusterRoleBinding.ingress-nginx-admission.yaml deleted file mode 100644 index 09398bb..0000000 --- a/examples/my-k8s-app/ClusterRoleBinding.ingress-nginx-admission.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: ingress-nginx-admission - annotations: - helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade - helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: ingress-nginx-admission -subjects: - - kind: ServiceAccount - name: ingress-nginx-admission - namespace: nginx diff --git a/examples/my-k8s-app/ClusterRoleBinding.ingress-nginx.yaml b/examples/my-k8s-app/ClusterRoleBinding.ingress-nginx.yaml deleted file mode 100644 index 9bcce53..0000000 --- a/examples/my-k8s-app/ClusterRoleBinding.ingress-nginx.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - name: ingress-nginx -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: ingress-nginx -subjects: - - kind: ServiceAccount - name: ingress-nginx - namespace: nginx diff --git a/examples/my-k8s-app/ConfigMap.ingress-nginx-controller.yaml b/examples/my-k8s-app/ConfigMap.ingress-nginx-controller.yaml deleted file mode 100644 index 399098e..0000000 --- a/examples/my-k8s-app/ConfigMap.ingress-nginx-controller.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: ingress-nginx-controller - namespace: nginx -data: - allow-snippet-annotations: "false" diff --git a/examples/my-k8s-app/ConfigMap.my-config-map.yaml b/examples/my-k8s-app/ConfigMap.my-config-map.yaml index 56bdf71..c5cb00a 100644 --- a/examples/my-k8s-app/ConfigMap.my-config-map.yaml +++ b/examples/my-k8s-app/ConfigMap.my-config-map.yaml @@ -1,4 +1,7 @@ apiVersion: v1 +data: + key1: value1 + key2: value2 kind: ConfigMap metadata: namespace: fooo diff --git a/examples/my-k8s-app/Deployment.ingress-nginx-controller.yaml b/examples/my-k8s-app/Deployment.ingress-nginx-controller.yaml deleted file mode 100644 index 070f1e7..0000000 --- a/examples/my-k8s-app/Deployment.ingress-nginx-controller.yaml +++ /dev/null @@ -1,125 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: ingress-nginx-controller - namespace: nginx -spec: - selector: - matchLabels: - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/component: controller - replicas: 1 - revisionHistoryLimit: 10 - minReadySeconds: 0 - template: - metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - spec: - dnsPolicy: ClusterFirst - containers: - - name: controller - image: registry.k8s.io/ingress-nginx/controller:v1.11.3@sha256:d56f135b6462cfc476447cfe564b83a45e8bb7da2774963b00d12161112270b7 - imagePullPolicy: IfNotPresent - lifecycle: - preStop: - exec: - command: - - /wait-shutdown - args: - - /nginx-ingress-controller - - --publish-service=$(POD_NAMESPACE)/ingress-nginx-controller - - --election-id=ingress-nginx-leader - - --controller-class=k8s.io/ingress-nginx - - --ingress-class=nginx - - --configmap=$(POD_NAMESPACE)/ingress-nginx-controller - - --validating-webhook=:8443 - - --validating-webhook-certificate=/usr/local/certificates/cert - - --validating-webhook-key=/usr/local/certificates/key - securityContext: - runAsNonRoot: true - runAsUser: 101 - allowPrivilegeEscalation: false - seccompProfile: - type: RuntimeDefault - capabilities: - drop: - - ALL - add: - - NET_BIND_SERVICE - readOnlyRootFilesystem: false - env: - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: LD_PRELOAD - value: /usr/local/lib/libmimalloc.so - livenessProbe: - failureThreshold: 5 - httpGet: - path: /healthz - port: 10254 - scheme: HTTP - initialDelaySeconds: 10 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - readinessProbe: - failureThreshold: 3 - httpGet: - path: /healthz - port: 10254 - scheme: HTTP - initialDelaySeconds: 10 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - ports: - - name: http - containerPort: 80 - protocol: TCP - - name: https - containerPort: 443 - protocol: TCP - - name: metrics - containerPort: 10254 - protocol: TCP - - name: webhook - containerPort: 8443 - protocol: TCP - volumeMounts: - - name: webhook-cert - mountPath: /usr/local/certificates/ - readOnly: true - resources: - requests: - cpu: 100m - memory: 90Mi - nodeSelector: - kubernetes.io/os: linux - serviceAccountName: ingress-nginx - terminationGracePeriodSeconds: 300 - volumes: - - name: webhook-cert - secret: - secretName: ingress-nginx-admission diff --git a/examples/my-k8s-app/IngressClass.nginx.yaml b/examples/my-k8s-app/IngressClass.nginx.yaml deleted file mode 100644 index f036d8b..0000000 --- a/examples/my-k8s-app/IngressClass.nginx.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: IngressClass -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: nginx -spec: - controller: k8s.io/ingress-nginx diff --git a/examples/my-k8s-app/Job.ingress-nginx-admission-create.yaml b/examples/my-k8s-app/Job.ingress-nginx-admission-create.yaml deleted file mode 100644 index 742dff7..0000000 --- a/examples/my-k8s-app/Job.ingress-nginx-admission-create.yaml +++ /dev/null @@ -1,57 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: ingress-nginx-admission-create - namespace: nginx - annotations: - helm.sh/hook: pre-install,pre-upgrade - helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook -spec: - template: - metadata: - name: ingress-nginx-admission-create - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook - spec: - containers: - - name: create - image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.4.4@sha256:a9f03b34a3cbfbb26d103a14046ab2c5130a80c3d69d526ff8063d2b37b9fd3f - imagePullPolicy: IfNotPresent - args: - - create - - --host=ingress-nginx-controller-admission,ingress-nginx-controller-admission.$(POD_NAMESPACE).svc - - --namespace=$(POD_NAMESPACE) - - --secret-name=ingress-nginx-admission - env: - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 65532 - seccompProfile: - type: RuntimeDefault - restartPolicy: OnFailure - serviceAccountName: ingress-nginx-admission - nodeSelector: - kubernetes.io/os: linux diff --git a/examples/my-k8s-app/Job.ingress-nginx-admission-patch.yaml b/examples/my-k8s-app/Job.ingress-nginx-admission-patch.yaml deleted file mode 100644 index efb71f9..0000000 --- a/examples/my-k8s-app/Job.ingress-nginx-admission-patch.yaml +++ /dev/null @@ -1,59 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: ingress-nginx-admission-patch - namespace: nginx - annotations: - helm.sh/hook: post-install,post-upgrade - helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook -spec: - template: - metadata: - name: ingress-nginx-admission-patch - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook - spec: - containers: - - name: patch - image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.4.4@sha256:a9f03b34a3cbfbb26d103a14046ab2c5130a80c3d69d526ff8063d2b37b9fd3f - imagePullPolicy: IfNotPresent - args: - - patch - - --webhook-name=ingress-nginx-admission - - --namespace=$(POD_NAMESPACE) - - --patch-mutating=false - - --secret-name=ingress-nginx-admission - - --patch-failure-policy=Fail - env: - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 65532 - seccompProfile: - type: RuntimeDefault - restartPolicy: OnFailure - serviceAccountName: ingress-nginx-admission - nodeSelector: - kubernetes.io/os: linux diff --git a/examples/my-k8s-app/Role.ingress-nginx-admission.yaml b/examples/my-k8s-app/Role.ingress-nginx-admission.yaml deleted file mode 100644 index fe8eeab..0000000 --- a/examples/my-k8s-app/Role.ingress-nginx-admission.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: ingress-nginx-admission - namespace: nginx - annotations: - helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade - helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook -rules: - - apiGroups: - - "" - resources: - - secrets - verbs: - - get - - create diff --git a/examples/my-k8s-app/Role.ingress-nginx.yaml b/examples/my-k8s-app/Role.ingress-nginx.yaml deleted file mode 100644 index 9bec592..0000000 --- a/examples/my-k8s-app/Role.ingress-nginx.yaml +++ /dev/null @@ -1,91 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: ingress-nginx - namespace: nginx -rules: - - apiGroups: - - "" - resources: - - namespaces - verbs: - - get - - apiGroups: - - "" - resources: - - configmaps - - pods - - secrets - - endpoints - verbs: - - get - - list - - watch - - apiGroups: - - "" - resources: - - services - verbs: - - get - - list - - watch - - apiGroups: - - networking.k8s.io - resources: - - ingresses - verbs: - - get - - list - - watch - - apiGroups: - - networking.k8s.io - resources: - - ingresses/status - verbs: - - update - - apiGroups: - - networking.k8s.io - resources: - - ingressclasses - verbs: - - get - - list - - watch - - apiGroups: - - coordination.k8s.io - resources: - - leases - resourceNames: - - ingress-nginx-leader - verbs: - - get - - update - - apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - create - - apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - - apiGroups: - - discovery.k8s.io - resources: - - endpointslices - verbs: - - list - - watch - - get diff --git a/examples/my-k8s-app/RoleBinding.ingress-nginx-admission.yaml b/examples/my-k8s-app/RoleBinding.ingress-nginx-admission.yaml deleted file mode 100644 index eb9998a..0000000 --- a/examples/my-k8s-app/RoleBinding.ingress-nginx-admission.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: ingress-nginx-admission - namespace: nginx - annotations: - helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade - helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: ingress-nginx-admission -subjects: - - kind: ServiceAccount - name: ingress-nginx-admission - namespace: nginx diff --git a/examples/my-k8s-app/RoleBinding.ingress-nginx.yaml b/examples/my-k8s-app/RoleBinding.ingress-nginx.yaml deleted file mode 100644 index da66a5c..0000000 --- a/examples/my-k8s-app/RoleBinding.ingress-nginx.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: ingress-nginx - namespace: nginx -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: ingress-nginx -subjects: - - kind: ServiceAccount - name: ingress-nginx - namespace: nginx diff --git a/examples/my-k8s-app/Service.ingress-nginx-controller-admission.yaml b/examples/my-k8s-app/Service.ingress-nginx-controller-admission.yaml deleted file mode 100644 index 4e4186d..0000000 --- a/examples/my-k8s-app/Service.ingress-nginx-controller-admission.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: ingress-nginx-controller-admission - namespace: nginx -spec: - type: ClusterIP - ports: - - name: https-webhook - port: 443 - targetPort: webhook - appProtocol: https - selector: - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/component: controller diff --git a/examples/my-k8s-app/Service.ingress-nginx-controller-metrics.yaml b/examples/my-k8s-app/Service.ingress-nginx-controller-metrics.yaml deleted file mode 100644 index 221befe..0000000 --- a/examples/my-k8s-app/Service.ingress-nginx-controller-metrics.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: ingress-nginx-controller-metrics - namespace: nginx -spec: - type: ClusterIP - ports: - - name: metrics - port: 10254 - protocol: TCP - targetPort: metrics - selector: - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/component: controller diff --git a/examples/my-k8s-app/Service.ingress-nginx-controller.yaml b/examples/my-k8s-app/Service.ingress-nginx-controller.yaml deleted file mode 100644 index 8f1fe88..0000000 --- a/examples/my-k8s-app/Service.ingress-nginx-controller.yaml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - annotations: null - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: ingress-nginx-controller - namespace: nginx -spec: - type: NodePort - ipFamilyPolicy: SingleStack - ipFamilies: - - IPv4 - ports: - - name: http - port: 80 - protocol: TCP - targetPort: http - appProtocol: http - - name: https - port: 443 - protocol: TCP - targetPort: https - appProtocol: https - selector: - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/component: controller diff --git a/examples/my-k8s-app/ServiceAccount.ingress-nginx-admission.yaml b/examples/my-k8s-app/ServiceAccount.ingress-nginx-admission.yaml deleted file mode 100644 index c0a4395..0000000 --- a/examples/my-k8s-app/ServiceAccount.ingress-nginx-admission.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: ingress-nginx-admission - namespace: nginx - annotations: - helm.sh/hook: pre-install,pre-upgrade,post-install,post-upgrade - helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook -automountServiceAccountToken: true diff --git a/examples/my-k8s-app/ServiceAccount.ingress-nginx.yaml b/examples/my-k8s-app/ServiceAccount.ingress-nginx.yaml deleted file mode 100644 index 2468491..0000000 --- a/examples/my-k8s-app/ServiceAccount.ingress-nginx.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller - name: ingress-nginx - namespace: nginx -automountServiceAccountToken: true diff --git a/examples/my-k8s-app/ServiceMonitor.ingress-nginx-controller.yaml b/examples/my-k8s-app/ServiceMonitor.ingress-nginx-controller.yaml deleted file mode 100644 index b8a613f..0000000 --- a/examples/my-k8s-app/ServiceMonitor.ingress-nginx-controller.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - name: ingress-nginx-controller - namespace: nginx - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: controller -spec: - endpoints: - - port: metrics - interval: 30s - namespaceSelector: - matchNames: - - nginx - selector: - matchLabels: - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/component: controller diff --git a/examples/my-k8s-app/ValidatingWebhookConfiguration.ingress-nginx-admission.yaml b/examples/my-k8s-app/ValidatingWebhookConfiguration.ingress-nginx-admission.yaml deleted file mode 100644 index 5b34f44..0000000 --- a/examples/my-k8s-app/ValidatingWebhookConfiguration.ingress-nginx-admission.yaml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - annotations: null - labels: - helm.sh/chart: ingress-nginx-4.11.3 - app.kubernetes.io/name: ingress-nginx - app.kubernetes.io/instance: ingress-nginx - app.kubernetes.io/version: 1.11.3 - app.kubernetes.io/part-of: ingress-nginx - app.kubernetes.io/managed-by: Helm - app.kubernetes.io/component: admission-webhook - name: ingress-nginx-admission -webhooks: - - name: validate.nginx.ingress.kubernetes.io - matchPolicy: Equivalent - rules: - - apiGroups: - - networking.k8s.io - apiVersions: - - v1 - operations: - - CREATE - - UPDATE - resources: - - ingresses - failurePolicy: Fail - sideEffects: None - admissionReviewVersions: - - v1 - clientConfig: - service: - name: ingress-nginx-controller-admission - namespace: nginx - port: 443 - path: /networking/v1/ingresses diff --git a/examples/src/example1.ts b/examples/src/example1.ts new file mode 100644 index 0000000..c728e9a --- /dev/null +++ b/examples/src/example1.ts @@ -0,0 +1,58 @@ +import { log } from 'node:console'; +import { K8sApp } from '@k8skonf/core'; +import { ConfigMapv1 } from '@k8skonf/core/ConfigMapv1'; +import { Deploymentv1 } from '@k8skonf/core/Deploymentv1'; + +const app = new K8sApp('my-k8s-app', { namespace: 'my-app-namespace' }); + +const cm = new ConfigMapv1(app, 'my-config-map', { + metadata: { + // name: 'my-config-map2', // inferred from resource name + namespace: 'fooo', + }, + data: { + key1: 'value1', + key2: 'value2', + }, +}); + +console.log('configmap name:', cm.name); + +const d = new Deploymentv1(app, 'my-nginx-deployment', { + metadata: { + // name: 'my-nginx-deployment2', // inferred from resource name + // namespace: 'fooo', // inferred from app namespace + }, + spec: { + selector: { + matchLabels: { + app: 'nginx', + }, + }, + template: { + metadata: { + labels: { + app: 'nginx', + }, + }, + spec: { + containers: [ + { + name: 'nginx', + image: 'nginx:alpine', + ports: [ + { + containerPort: 80, + name: 'http', + }, + ], + }, + ], + }, + }, + }, +}); + +log('name is:', d.name); + +app.save(); diff --git a/examples/src/main.ts b/examples/src/example2.ts similarity index 88% rename from examples/src/main.ts rename to examples/src/example2.ts index d7cdab2..50f9f2b 100644 --- a/examples/src/main.ts +++ b/examples/src/example2.ts @@ -1,9 +1,9 @@ +import { log } from 'node:console'; import { Helm, K8sApp } from '@k8skonf/core'; import { ConfigMapv1 } from '@k8skonf/core/ConfigMapv1'; import { Deploymentv1 } from '@k8skonf/core/Deploymentv1'; -import { log } from 'node:console'; -const app = new K8sApp('my-k8s-app', { namespace: 'my-app-namespace' }); +const app = new K8sApp('helm-example', { namespace: 'my-app-namespace', outputType: 'singleFile' }); const chart = new Helm(app, 'ingress-nginx', { chart: 'ingress-nginx', @@ -31,13 +31,19 @@ chart.resources.forEach((resource) => { console.log(resource.apiVersion); }); -new ConfigMapv1(app, 'my-config-map', { +const cm = new ConfigMapv1(app, 'my-config-map', { metadata: { // name: 'my-config-map2', // inferred from resource name namespace: 'fooo', }, + data: { + key1: 'value1', + key2: 'value2', + }, }); +console.log('configmap name:', cm.name); + const d = new Deploymentv1(app, 'my-nginx-deployment', { metadata: { // name: 'my-nginx-deployment2', // inferred from resource name diff --git a/packages/cli/src/generateCore.ts b/packages/cli/src/generateCore.ts index 620a7cd..44716f0 100644 --- a/packages/cli/src/generateCore.ts +++ b/packages/cli/src/generateCore.ts @@ -195,7 +195,7 @@ function morph() { }; c.statements = new Array(); - c.statements.push('super();'); + c.statements.push('super(args.metadata?.name || name);'); for (const prop of classDeclaration.getProperties()) { prop.setIsReadonly(true); const interfaceProp: PropertySignatureStructure = { diff --git a/packages/core/src/ApiObject.ts b/packages/core/src/ApiObject.ts index 962dde8..2b80645 100644 --- a/packages/core/src/ApiObject.ts +++ b/packages/core/src/ApiObject.ts @@ -1,3 +1,4 @@ +import * as yaml from 'yaml'; import { ObjectMetav1 } from './models/ObjectMetav1.js'; export interface NamespacedObjectMetav1 extends ObjectMetav1 { @@ -14,12 +15,18 @@ export interface NamespacedObjectMetav1 extends ObjectMetav1 { * ApiObject is the base class for all Kubernetes API objects. */ export abstract class ApiObject { + readonly name: string; abstract readonly metadata: ObjectMetav1; abstract readonly apiVersion: string; abstract readonly kind: string; - get name() { - return this.metadata.name; + constructor(name: string) { + this.name = name; + } + + toYaml(): string { + const { name, ...rest } = this; + return yaml.stringify(rest, { schema: 'yaml-1.1' }); } } diff --git a/packages/core/src/Helm.ts b/packages/core/src/Helm.ts index 14af593..a0c44dd 100644 --- a/packages/core/src/Helm.ts +++ b/packages/core/src/Helm.ts @@ -7,12 +7,28 @@ import { ApiObject } from './ApiObject.js'; import { K8sApp } from './K8sApp.js'; import { ObjectMetav1 } from './models/ObjectMetav1.js'; +interface HelmObjectArgs { + readonly apiVersion: string; + readonly kind: string; + readonly metadata: ObjectMetav1; + readonly spec: any; + readonly [key: string]: any; +} + class HelmObject extends ApiObject { - readonly apiVersion!: string; - readonly kind!: string; - readonly metadata!: ObjectMetav1; + readonly apiVersion: string; + readonly kind: string; + readonly metadata: ObjectMetav1; readonly spec: any; readonly [key: string]: any; + constructor(name: string, args: HelmObjectArgs) { + super(name); + this.apiVersion = args.apiVersion; + this.kind = args.kind; + this.metadata = args.metadata; + this.spec = args.spec; + Object.assign(this, args); + } } export interface HelmArgs { @@ -89,9 +105,11 @@ export class Helm { if (file.errors.length) { console.error('Error parsing file:', file.errors); } - if (file.toJS() !== null) { - this.resources.push(file.toJS()); - app.addResource(file.toJS()); + const helmObj = file.toJS(); + if (helmObj !== null) { + const resource = new HelmObject(helmObj.metadata.name, helmObj); + this.resources.push(resource); + app.addResource(resource); } } diff --git a/packages/core/src/K8sApp.ts b/packages/core/src/K8sApp.ts index b750f9d..b216a39 100644 --- a/packages/core/src/K8sApp.ts +++ b/packages/core/src/K8sApp.ts @@ -1,7 +1,6 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import pc from 'picocolors'; -import * as yaml from 'yaml'; import { ApiObject, NamespacedApiObject } from './ApiObject.js'; interface K8sAppArgs { @@ -39,7 +38,7 @@ export class K8sApp { } toYaml() { - return `---\n${this.resources.map((resource) => yaml.stringify(resource, { schema: 'yaml-1.1' })).join('---\n')}`; + return `---\n${this.resources.map((resource) => resource.toYaml()).join('---\n')}`; } save() { @@ -59,7 +58,7 @@ export class K8sApp { ); fs.writeFileSync( path.join(this.outputName, `${r.kind}.${r.metadata.name}.yaml`), - yaml.stringify(r, { schema: 'yaml-1.1' }), + r.toYaml(), ); } } diff --git a/packages/core/src/models/APIServicev1.ts b/packages/core/src/models/APIServicev1.ts index e8595ca..5419f2d 100644 --- a/packages/core/src/models/APIServicev1.ts +++ b/packages/core/src/models/APIServicev1.ts @@ -30,7 +30,7 @@ export class APIServicev1 extends ApiObject { readonly spec?: APIServiceSpecv1; constructor(app: K8sApp, name: string, args: APIServicev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/AuthenticationTokenRequestv1.ts b/packages/core/src/models/AuthenticationTokenRequestv1.ts index 99e3f12..3372fc6 100644 --- a/packages/core/src/models/AuthenticationTokenRequestv1.ts +++ b/packages/core/src/models/AuthenticationTokenRequestv1.ts @@ -29,7 +29,7 @@ export class AuthenticationTokenRequestv1 extends NamespacedApiObject { readonly spec: TokenRequestSpecv1; constructor(app: K8sApp, name: string, args: AuthenticationTokenRequestv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/Bindingv1.ts b/packages/core/src/models/Bindingv1.ts index c8c60d9..9e83613 100644 --- a/packages/core/src/models/Bindingv1.ts +++ b/packages/core/src/models/Bindingv1.ts @@ -29,7 +29,7 @@ export class Bindingv1 extends NamespacedApiObject { readonly target: ObjectReferencev1; constructor(app: K8sApp, name: string, args: Bindingv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.target = args.target; diff --git a/packages/core/src/models/CSIDriverv1.ts b/packages/core/src/models/CSIDriverv1.ts index 0e0f0e9..d03ba4b 100644 --- a/packages/core/src/models/CSIDriverv1.ts +++ b/packages/core/src/models/CSIDriverv1.ts @@ -30,7 +30,7 @@ export class CSIDriverv1 extends ApiObject { readonly spec: CSIDriverSpecv1; constructor(app: K8sApp, name: string, args: CSIDriverv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/CSINodev1.ts b/packages/core/src/models/CSINodev1.ts index 2b0ed8a..9d34085 100644 --- a/packages/core/src/models/CSINodev1.ts +++ b/packages/core/src/models/CSINodev1.ts @@ -30,7 +30,7 @@ export class CSINodev1 extends ApiObject { readonly spec: CSINodeSpecv1; constructor(app: K8sApp, name: string, args: CSINodev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/CSIStorageCapacityv1.ts b/packages/core/src/models/CSIStorageCapacityv1.ts index e72664b..4a03fb4 100644 --- a/packages/core/src/models/CSIStorageCapacityv1.ts +++ b/packages/core/src/models/CSIStorageCapacityv1.ts @@ -44,7 +44,7 @@ export class CSIStorageCapacityv1 extends NamespacedApiObject { readonly storageClassName: string; constructor(app: K8sApp, name: string, args: CSIStorageCapacityv1Args) { - super(); + super(args.metadata?.name || name); this.capacity = args.capacity; this.maximumVolumeSize = args.maximumVolumeSize; this.metadata = args.metadata || { name }; diff --git a/packages/core/src/models/CertificateSigningRequestv1.ts b/packages/core/src/models/CertificateSigningRequestv1.ts index 12be8b0..abe7037 100644 --- a/packages/core/src/models/CertificateSigningRequestv1.ts +++ b/packages/core/src/models/CertificateSigningRequestv1.ts @@ -27,7 +27,7 @@ export class CertificateSigningRequestv1 extends ApiObject { readonly spec: CertificateSigningRequestSpecv1; constructor(app: K8sApp, name: string, args: CertificateSigningRequestv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ClusterRoleBindingv1.ts b/packages/core/src/models/ClusterRoleBindingv1.ts index fcab100..22d9ec3 100644 --- a/packages/core/src/models/ClusterRoleBindingv1.ts +++ b/packages/core/src/models/ClusterRoleBindingv1.ts @@ -36,7 +36,7 @@ export class ClusterRoleBindingv1 extends ApiObject { readonly subjects?: Array; constructor(app: K8sApp, name: string, args: ClusterRoleBindingv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.roleRef = args.roleRef; diff --git a/packages/core/src/models/ClusterRolev1.ts b/packages/core/src/models/ClusterRolev1.ts index 9470e4a..2cabb5e 100644 --- a/packages/core/src/models/ClusterRolev1.ts +++ b/packages/core/src/models/ClusterRolev1.ts @@ -36,7 +36,7 @@ export class ClusterRolev1 extends ApiObject { readonly rules?: Array; constructor(app: K8sApp, name: string, args: ClusterRolev1Args) { - super(); + super(args.metadata?.name || name); this.aggregationRule = args.aggregationRule; this.metadata = args.metadata || { name }; this.metadata.name ??= name; diff --git a/packages/core/src/models/ClusterTrustBundlev1alpha1.ts b/packages/core/src/models/ClusterTrustBundlev1alpha1.ts index 3086f5d..50b617b 100644 --- a/packages/core/src/models/ClusterTrustBundlev1alpha1.ts +++ b/packages/core/src/models/ClusterTrustBundlev1alpha1.ts @@ -30,7 +30,7 @@ export class ClusterTrustBundlev1alpha1 extends ApiObject { readonly spec: ClusterTrustBundleSpecv1alpha1; constructor(app: K8sApp, name: string, args: ClusterTrustBundlev1alpha1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ConfigMapv1.ts b/packages/core/src/models/ConfigMapv1.ts index b53b13a..b069871 100644 --- a/packages/core/src/models/ConfigMapv1.ts +++ b/packages/core/src/models/ConfigMapv1.ts @@ -38,7 +38,7 @@ export class ConfigMapv1 extends NamespacedApiObject { readonly metadata: NamespacedObjectMetav1; constructor(app: K8sApp, name: string, args: ConfigMapv1Args) { - super(); + super(args.metadata?.name || name); this.binaryData = args.binaryData; this.data = args.data; this.immutable = args.immutable; diff --git a/packages/core/src/models/ControllerRevisionv1.ts b/packages/core/src/models/ControllerRevisionv1.ts index 45d333c..a07435b 100644 --- a/packages/core/src/models/ControllerRevisionv1.ts +++ b/packages/core/src/models/ControllerRevisionv1.ts @@ -33,7 +33,7 @@ export class ControllerRevisionv1 extends NamespacedApiObject { readonly revision: number; constructor(app: K8sApp, name: string, args: ControllerRevisionv1Args) { - super(); + super(args.metadata?.name || name); this.data = args.data; this.metadata = args.metadata || { name }; this.metadata.name ??= name; diff --git a/packages/core/src/models/CoreEventv1.ts b/packages/core/src/models/CoreEventv1.ts index 0b728e0..2ded137 100644 --- a/packages/core/src/models/CoreEventv1.ts +++ b/packages/core/src/models/CoreEventv1.ts @@ -96,7 +96,7 @@ export class CoreEventv1 extends NamespacedApiObject { readonly type?: string; constructor(app: K8sApp, name: string, args: CoreEventv1Args) { - super(); + super(args.metadata?.name || name); this.action = args.action; this.count = args.count; this.eventTime = args.eventTime; diff --git a/packages/core/src/models/CronJobv1.ts b/packages/core/src/models/CronJobv1.ts index d3f1d7d..2184add 100644 --- a/packages/core/src/models/CronJobv1.ts +++ b/packages/core/src/models/CronJobv1.ts @@ -29,7 +29,7 @@ export class CronJobv1 extends NamespacedApiObject { readonly spec?: CronJobSpecv1; constructor(app: K8sApp, name: string, args: CronJobv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/CustomResourceDefinitionv1.ts b/packages/core/src/models/CustomResourceDefinitionv1.ts index d8391f2..8d200e4 100644 --- a/packages/core/src/models/CustomResourceDefinitionv1.ts +++ b/packages/core/src/models/CustomResourceDefinitionv1.ts @@ -30,7 +30,7 @@ export class CustomResourceDefinitionv1 extends ApiObject { readonly spec: CustomResourceDefinitionSpecv1; constructor(app: K8sApp, name: string, args: CustomResourceDefinitionv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/DaemonSetv1.ts b/packages/core/src/models/DaemonSetv1.ts index 6fd9d87..7c71722 100644 --- a/packages/core/src/models/DaemonSetv1.ts +++ b/packages/core/src/models/DaemonSetv1.ts @@ -29,7 +29,7 @@ export class DaemonSetv1 extends NamespacedApiObject { readonly spec?: DaemonSetSpecv1; constructor(app: K8sApp, name: string, args: DaemonSetv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/Deploymentv1.ts b/packages/core/src/models/Deploymentv1.ts index 82882fb..108049a 100644 --- a/packages/core/src/models/Deploymentv1.ts +++ b/packages/core/src/models/Deploymentv1.ts @@ -29,7 +29,7 @@ export class Deploymentv1 extends NamespacedApiObject { readonly spec?: DeploymentSpecv1; constructor(app: K8sApp, name: string, args: Deploymentv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/DeviceClassv1alpha3.ts b/packages/core/src/models/DeviceClassv1alpha3.ts index 8df47e2..dad4c24 100644 --- a/packages/core/src/models/DeviceClassv1alpha3.ts +++ b/packages/core/src/models/DeviceClassv1alpha3.ts @@ -30,7 +30,7 @@ export class DeviceClassv1alpha3 extends ApiObject { readonly spec: DeviceClassSpecv1alpha3; constructor(app: K8sApp, name: string, args: DeviceClassv1alpha3Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/DeviceClassv1beta1.ts b/packages/core/src/models/DeviceClassv1beta1.ts index 0ad1b4f..45c0d1c 100644 --- a/packages/core/src/models/DeviceClassv1beta1.ts +++ b/packages/core/src/models/DeviceClassv1beta1.ts @@ -30,7 +30,7 @@ export class DeviceClassv1beta1 extends ApiObject { readonly spec: DeviceClassSpecv1beta1; constructor(app: K8sApp, name: string, args: DeviceClassv1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/EndpointSlicev1.ts b/packages/core/src/models/EndpointSlicev1.ts index ea23c62..7766cb7 100644 --- a/packages/core/src/models/EndpointSlicev1.ts +++ b/packages/core/src/models/EndpointSlicev1.ts @@ -40,7 +40,7 @@ export class EndpointSlicev1 extends NamespacedApiObject { readonly ports?: Array; constructor(app: K8sApp, name: string, args: EndpointSlicev1Args) { - super(); + super(args.metadata?.name || name); this.addressType = args.addressType; this.endpoints = args.endpoints; this.metadata = args.metadata || { name }; diff --git a/packages/core/src/models/Endpointsv1.ts b/packages/core/src/models/Endpointsv1.ts index 15cf7e7..b2feb61 100644 --- a/packages/core/src/models/Endpointsv1.ts +++ b/packages/core/src/models/Endpointsv1.ts @@ -29,7 +29,7 @@ export class Endpointsv1 extends NamespacedApiObject { readonly subsets?: Array; constructor(app: K8sApp, name: string, args: Endpointsv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.subsets = args.subsets; diff --git a/packages/core/src/models/EventsEventv1.ts b/packages/core/src/models/EventsEventv1.ts index dc43d34..c7371c6 100644 --- a/packages/core/src/models/EventsEventv1.ts +++ b/packages/core/src/models/EventsEventv1.ts @@ -96,7 +96,7 @@ export class EventsEventv1 extends NamespacedApiObject { readonly type?: string; constructor(app: K8sApp, name: string, args: EventsEventv1Args) { - super(); + super(args.metadata?.name || name); this.action = args.action; this.deprecatedCount = args.deprecatedCount; this.deprecatedFirstTimestamp = args.deprecatedFirstTimestamp; diff --git a/packages/core/src/models/Evictionv1.ts b/packages/core/src/models/Evictionv1.ts index 7815328..df9cf6f 100644 --- a/packages/core/src/models/Evictionv1.ts +++ b/packages/core/src/models/Evictionv1.ts @@ -29,7 +29,7 @@ export class Evictionv1 extends NamespacedApiObject { readonly metadata: NamespacedObjectMetav1; constructor(app: K8sApp, name: string, args: Evictionv1Args) { - super(); + super(args.metadata?.name || name); this.deleteOptions = args.deleteOptions; this.metadata = args.metadata || { name }; this.metadata.name ??= name; diff --git a/packages/core/src/models/FlowSchemav1.ts b/packages/core/src/models/FlowSchemav1.ts index 045bcae..c0bc8d8 100644 --- a/packages/core/src/models/FlowSchemav1.ts +++ b/packages/core/src/models/FlowSchemav1.ts @@ -30,7 +30,7 @@ export class FlowSchemav1 extends ApiObject { readonly spec?: FlowSchemaSpecv1; constructor(app: K8sApp, name: string, args: FlowSchemav1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/HorizontalPodAutoscalerv1.ts b/packages/core/src/models/HorizontalPodAutoscalerv1.ts index 2a590dc..7ecf97b 100644 --- a/packages/core/src/models/HorizontalPodAutoscalerv1.ts +++ b/packages/core/src/models/HorizontalPodAutoscalerv1.ts @@ -29,7 +29,7 @@ export class HorizontalPodAutoscalerv1 extends NamespacedApiObject { readonly spec?: HorizontalPodAutoscalerSpecv1; constructor(app: K8sApp, name: string, args: HorizontalPodAutoscalerv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/HorizontalPodAutoscalerv2.ts b/packages/core/src/models/HorizontalPodAutoscalerv2.ts index d34a13c..65b7699 100644 --- a/packages/core/src/models/HorizontalPodAutoscalerv2.ts +++ b/packages/core/src/models/HorizontalPodAutoscalerv2.ts @@ -29,7 +29,7 @@ export class HorizontalPodAutoscalerv2 extends NamespacedApiObject { readonly spec?: HorizontalPodAutoscalerSpecv2; constructor(app: K8sApp, name: string, args: HorizontalPodAutoscalerv2Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/IPAddressv1beta1.ts b/packages/core/src/models/IPAddressv1beta1.ts index 939640b..8593ea5 100644 --- a/packages/core/src/models/IPAddressv1beta1.ts +++ b/packages/core/src/models/IPAddressv1beta1.ts @@ -30,7 +30,7 @@ export class IPAddressv1beta1 extends ApiObject { readonly spec?: IPAddressSpecv1beta1; constructor(app: K8sApp, name: string, args: IPAddressv1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/IngressClassv1.ts b/packages/core/src/models/IngressClassv1.ts index bfa5a5a..cb7b1fe 100644 --- a/packages/core/src/models/IngressClassv1.ts +++ b/packages/core/src/models/IngressClassv1.ts @@ -30,7 +30,7 @@ export class IngressClassv1 extends ApiObject { readonly spec?: IngressClassSpecv1; constructor(app: K8sApp, name: string, args: IngressClassv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/Ingressv1.ts b/packages/core/src/models/Ingressv1.ts index 4ccf245..b00bb0c 100644 --- a/packages/core/src/models/Ingressv1.ts +++ b/packages/core/src/models/Ingressv1.ts @@ -29,7 +29,7 @@ export class Ingressv1 extends NamespacedApiObject { readonly spec?: IngressSpecv1; constructor(app: K8sApp, name: string, args: Ingressv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/Jobv1.ts b/packages/core/src/models/Jobv1.ts index 6311d84..707d9f8 100644 --- a/packages/core/src/models/Jobv1.ts +++ b/packages/core/src/models/Jobv1.ts @@ -29,7 +29,7 @@ export class Jobv1 extends NamespacedApiObject { readonly spec?: JobSpecv1; constructor(app: K8sApp, name: string, args: Jobv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/LeaseCandidatev1alpha2.ts b/packages/core/src/models/LeaseCandidatev1alpha2.ts index 87f1a48..9dd33d7 100644 --- a/packages/core/src/models/LeaseCandidatev1alpha2.ts +++ b/packages/core/src/models/LeaseCandidatev1alpha2.ts @@ -29,7 +29,7 @@ export class LeaseCandidatev1alpha2 extends NamespacedApiObject { readonly spec?: LeaseCandidateSpecv1alpha2; constructor(app: K8sApp, name: string, args: LeaseCandidatev1alpha2Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/Leasev1.ts b/packages/core/src/models/Leasev1.ts index f61323b..f8a1444 100644 --- a/packages/core/src/models/Leasev1.ts +++ b/packages/core/src/models/Leasev1.ts @@ -29,7 +29,7 @@ export class Leasev1 extends NamespacedApiObject { readonly spec?: LeaseSpecv1; constructor(app: K8sApp, name: string, args: Leasev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/LimitRangev1.ts b/packages/core/src/models/LimitRangev1.ts index 662bcaa..b57f5db 100644 --- a/packages/core/src/models/LimitRangev1.ts +++ b/packages/core/src/models/LimitRangev1.ts @@ -29,7 +29,7 @@ export class LimitRangev1 extends NamespacedApiObject { readonly spec?: LimitRangeSpecv1; constructor(app: K8sApp, name: string, args: LimitRangev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/LocalSubjectAccessReviewv1.ts b/packages/core/src/models/LocalSubjectAccessReviewv1.ts index f6bc24c..02bfcd9 100644 --- a/packages/core/src/models/LocalSubjectAccessReviewv1.ts +++ b/packages/core/src/models/LocalSubjectAccessReviewv1.ts @@ -29,7 +29,7 @@ export class LocalSubjectAccessReviewv1 extends NamespacedApiObject { readonly spec: SubjectAccessReviewSpecv1; constructor(app: K8sApp, name: string, args: LocalSubjectAccessReviewv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/MutatingAdmissionPolicyBindingv1alpha1.ts b/packages/core/src/models/MutatingAdmissionPolicyBindingv1alpha1.ts index e39d2ff..384a309 100644 --- a/packages/core/src/models/MutatingAdmissionPolicyBindingv1alpha1.ts +++ b/packages/core/src/models/MutatingAdmissionPolicyBindingv1alpha1.ts @@ -30,7 +30,7 @@ export class MutatingAdmissionPolicyBindingv1alpha1 extends ApiObject { readonly spec?: MutatingAdmissionPolicyBindingSpecv1alpha1; constructor(app: K8sApp, name: string, args: MutatingAdmissionPolicyBindingv1alpha1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/MutatingAdmissionPolicyv1alpha1.ts b/packages/core/src/models/MutatingAdmissionPolicyv1alpha1.ts index ef5d964..372af9d 100644 --- a/packages/core/src/models/MutatingAdmissionPolicyv1alpha1.ts +++ b/packages/core/src/models/MutatingAdmissionPolicyv1alpha1.ts @@ -30,7 +30,7 @@ export class MutatingAdmissionPolicyv1alpha1 extends ApiObject { readonly spec?: MutatingAdmissionPolicySpecv1alpha1; constructor(app: K8sApp, name: string, args: MutatingAdmissionPolicyv1alpha1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/MutatingWebhookConfigurationv1.ts b/packages/core/src/models/MutatingWebhookConfigurationv1.ts index bdffdf8..7ef01cc 100644 --- a/packages/core/src/models/MutatingWebhookConfigurationv1.ts +++ b/packages/core/src/models/MutatingWebhookConfigurationv1.ts @@ -30,7 +30,7 @@ export class MutatingWebhookConfigurationv1 extends ApiObject { readonly webhooks?: Array; constructor(app: K8sApp, name: string, args: MutatingWebhookConfigurationv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.webhooks = args.webhooks; diff --git a/packages/core/src/models/Namespacev1.ts b/packages/core/src/models/Namespacev1.ts index 2e4d9a3..c474523 100644 --- a/packages/core/src/models/Namespacev1.ts +++ b/packages/core/src/models/Namespacev1.ts @@ -30,7 +30,7 @@ export class Namespacev1 extends ApiObject { readonly spec?: NamespaceSpecv1; constructor(app: K8sApp, name: string, args: Namespacev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/NetworkPolicyv1.ts b/packages/core/src/models/NetworkPolicyv1.ts index 5dba13c..6118a41 100644 --- a/packages/core/src/models/NetworkPolicyv1.ts +++ b/packages/core/src/models/NetworkPolicyv1.ts @@ -29,7 +29,7 @@ export class NetworkPolicyv1 extends NamespacedApiObject { readonly spec?: NetworkPolicySpecv1; constructor(app: K8sApp, name: string, args: NetworkPolicyv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/Nodev1.ts b/packages/core/src/models/Nodev1.ts index 4def378..aaa8067 100644 --- a/packages/core/src/models/Nodev1.ts +++ b/packages/core/src/models/Nodev1.ts @@ -30,7 +30,7 @@ export class Nodev1 extends ApiObject { readonly spec?: NodeSpecv1; constructor(app: K8sApp, name: string, args: Nodev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/PersistentVolumev1.ts b/packages/core/src/models/PersistentVolumev1.ts index 345ed42..c38e279 100644 --- a/packages/core/src/models/PersistentVolumev1.ts +++ b/packages/core/src/models/PersistentVolumev1.ts @@ -30,7 +30,7 @@ export class PersistentVolumev1 extends ApiObject { readonly spec?: PersistentVolumeSpecv1; constructor(app: K8sApp, name: string, args: PersistentVolumev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/PodDisruptionBudgetv1.ts b/packages/core/src/models/PodDisruptionBudgetv1.ts index 2f284df..bd60667 100644 --- a/packages/core/src/models/PodDisruptionBudgetv1.ts +++ b/packages/core/src/models/PodDisruptionBudgetv1.ts @@ -29,7 +29,7 @@ export class PodDisruptionBudgetv1 extends NamespacedApiObject { readonly spec?: PodDisruptionBudgetSpecv1; constructor(app: K8sApp, name: string, args: PodDisruptionBudgetv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/PodTemplatev1.ts b/packages/core/src/models/PodTemplatev1.ts index a99021f..6591004 100644 --- a/packages/core/src/models/PodTemplatev1.ts +++ b/packages/core/src/models/PodTemplatev1.ts @@ -29,7 +29,7 @@ export class PodTemplatev1 extends NamespacedApiObject { readonly template?: PodTemplateSpecv1; constructor(app: K8sApp, name: string, args: PodTemplatev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.template = args.template; diff --git a/packages/core/src/models/Podv1.ts b/packages/core/src/models/Podv1.ts index cc153c9..cba108f 100644 --- a/packages/core/src/models/Podv1.ts +++ b/packages/core/src/models/Podv1.ts @@ -29,7 +29,7 @@ export class Podv1 extends NamespacedApiObject { readonly spec?: PodSpecv1; constructor(app: K8sApp, name: string, args: Podv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/PriorityClassv1.ts b/packages/core/src/models/PriorityClassv1.ts index dab19e1..d9bc72b 100644 --- a/packages/core/src/models/PriorityClassv1.ts +++ b/packages/core/src/models/PriorityClassv1.ts @@ -44,7 +44,7 @@ export class PriorityClassv1 extends ApiObject { readonly value: number; constructor(app: K8sApp, name: string, args: PriorityClassv1Args) { - super(); + super(args.metadata?.name || name); this.description = args.description; this.globalDefault = args.globalDefault; this.metadata = args.metadata || { name }; diff --git a/packages/core/src/models/PriorityLevelConfigurationv1.ts b/packages/core/src/models/PriorityLevelConfigurationv1.ts index 17caeec..7de8734 100644 --- a/packages/core/src/models/PriorityLevelConfigurationv1.ts +++ b/packages/core/src/models/PriorityLevelConfigurationv1.ts @@ -30,7 +30,7 @@ export class PriorityLevelConfigurationv1 extends ApiObject { readonly spec?: PriorityLevelConfigurationSpecv1; constructor(app: K8sApp, name: string, args: PriorityLevelConfigurationv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ReplicaSetv1.ts b/packages/core/src/models/ReplicaSetv1.ts index 90c670d..6083d73 100644 --- a/packages/core/src/models/ReplicaSetv1.ts +++ b/packages/core/src/models/ReplicaSetv1.ts @@ -29,7 +29,7 @@ export class ReplicaSetv1 extends NamespacedApiObject { readonly spec?: ReplicaSetSpecv1; constructor(app: K8sApp, name: string, args: ReplicaSetv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ReplicationControllerv1.ts b/packages/core/src/models/ReplicationControllerv1.ts index c997d6a..a74d798 100644 --- a/packages/core/src/models/ReplicationControllerv1.ts +++ b/packages/core/src/models/ReplicationControllerv1.ts @@ -29,7 +29,7 @@ export class ReplicationControllerv1 extends NamespacedApiObject { readonly spec?: ReplicationControllerSpecv1; constructor(app: K8sApp, name: string, args: ReplicationControllerv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ResourceClaimTemplatev1alpha3.ts b/packages/core/src/models/ResourceClaimTemplatev1alpha3.ts index e13508d..7c26542 100644 --- a/packages/core/src/models/ResourceClaimTemplatev1alpha3.ts +++ b/packages/core/src/models/ResourceClaimTemplatev1alpha3.ts @@ -29,7 +29,7 @@ export class ResourceClaimTemplatev1alpha3 extends NamespacedApiObject { readonly spec: ResourceClaimTemplateSpecv1alpha3; constructor(app: K8sApp, name: string, args: ResourceClaimTemplatev1alpha3Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ResourceClaimTemplatev1beta1.ts b/packages/core/src/models/ResourceClaimTemplatev1beta1.ts index b5916ef..6aa8e56 100644 --- a/packages/core/src/models/ResourceClaimTemplatev1beta1.ts +++ b/packages/core/src/models/ResourceClaimTemplatev1beta1.ts @@ -29,7 +29,7 @@ export class ResourceClaimTemplatev1beta1 extends NamespacedApiObject { readonly spec: ResourceClaimTemplateSpecv1beta1; constructor(app: K8sApp, name: string, args: ResourceClaimTemplatev1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ResourceClaimv1alpha3.ts b/packages/core/src/models/ResourceClaimv1alpha3.ts index 2581fdb..463660a 100644 --- a/packages/core/src/models/ResourceClaimv1alpha3.ts +++ b/packages/core/src/models/ResourceClaimv1alpha3.ts @@ -29,7 +29,7 @@ export class ResourceClaimv1alpha3 extends NamespacedApiObject { readonly spec: ResourceClaimSpecv1alpha3; constructor(app: K8sApp, name: string, args: ResourceClaimv1alpha3Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ResourceClaimv1beta1.ts b/packages/core/src/models/ResourceClaimv1beta1.ts index eba207f..b9b374c 100644 --- a/packages/core/src/models/ResourceClaimv1beta1.ts +++ b/packages/core/src/models/ResourceClaimv1beta1.ts @@ -29,7 +29,7 @@ export class ResourceClaimv1beta1 extends NamespacedApiObject { readonly spec: ResourceClaimSpecv1beta1; constructor(app: K8sApp, name: string, args: ResourceClaimv1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ResourceQuotav1.ts b/packages/core/src/models/ResourceQuotav1.ts index e22b06a..a5d3e3b 100644 --- a/packages/core/src/models/ResourceQuotav1.ts +++ b/packages/core/src/models/ResourceQuotav1.ts @@ -29,7 +29,7 @@ export class ResourceQuotav1 extends NamespacedApiObject { readonly spec?: ResourceQuotaSpecv1; constructor(app: K8sApp, name: string, args: ResourceQuotav1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ResourceSlicev1alpha3.ts b/packages/core/src/models/ResourceSlicev1alpha3.ts index f70a5f3..da7ddf0 100644 --- a/packages/core/src/models/ResourceSlicev1alpha3.ts +++ b/packages/core/src/models/ResourceSlicev1alpha3.ts @@ -30,7 +30,7 @@ export class ResourceSlicev1alpha3 extends ApiObject { readonly spec: ResourceSliceSpecv1alpha3; constructor(app: K8sApp, name: string, args: ResourceSlicev1alpha3Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ResourceSlicev1beta1.ts b/packages/core/src/models/ResourceSlicev1beta1.ts index eb74a53..7be887d 100644 --- a/packages/core/src/models/ResourceSlicev1beta1.ts +++ b/packages/core/src/models/ResourceSlicev1beta1.ts @@ -30,7 +30,7 @@ export class ResourceSlicev1beta1 extends ApiObject { readonly spec: ResourceSliceSpecv1beta1; constructor(app: K8sApp, name: string, args: ResourceSlicev1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/RoleBindingv1.ts b/packages/core/src/models/RoleBindingv1.ts index b208e38..20d531f 100644 --- a/packages/core/src/models/RoleBindingv1.ts +++ b/packages/core/src/models/RoleBindingv1.ts @@ -35,7 +35,7 @@ export class RoleBindingv1 extends NamespacedApiObject { readonly subjects?: Array; constructor(app: K8sApp, name: string, args: RoleBindingv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.roleRef = args.roleRef; diff --git a/packages/core/src/models/Rolev1.ts b/packages/core/src/models/Rolev1.ts index 8c1b6a5..7371062 100644 --- a/packages/core/src/models/Rolev1.ts +++ b/packages/core/src/models/Rolev1.ts @@ -29,7 +29,7 @@ export class Rolev1 extends NamespacedApiObject { readonly rules?: Array; constructor(app: K8sApp, name: string, args: Rolev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.rules = args.rules; diff --git a/packages/core/src/models/RuntimeClassv1.ts b/packages/core/src/models/RuntimeClassv1.ts index cfab7fd..4d996b5 100644 --- a/packages/core/src/models/RuntimeClassv1.ts +++ b/packages/core/src/models/RuntimeClassv1.ts @@ -41,7 +41,7 @@ export class RuntimeClassv1 extends ApiObject { readonly scheduling?: Schedulingv1; constructor(app: K8sApp, name: string, args: RuntimeClassv1Args) { - super(); + super(args.metadata?.name || name); this.handler = args.handler; this.metadata = args.metadata || { name }; this.metadata.name ??= name; diff --git a/packages/core/src/models/Secretv1.ts b/packages/core/src/models/Secretv1.ts index 48952a7..2b5f8e7 100644 --- a/packages/core/src/models/Secretv1.ts +++ b/packages/core/src/models/Secretv1.ts @@ -43,7 +43,7 @@ export class Secretv1 extends NamespacedApiObject { readonly type?: string; constructor(app: K8sApp, name: string, args: Secretv1Args) { - super(); + super(args.metadata?.name || name); this.data = args.data; this.immutable = args.immutable; this.metadata = args.metadata || { name }; diff --git a/packages/core/src/models/SelfSubjectAccessReviewv1.ts b/packages/core/src/models/SelfSubjectAccessReviewv1.ts index 683ebb1..7668fca 100644 --- a/packages/core/src/models/SelfSubjectAccessReviewv1.ts +++ b/packages/core/src/models/SelfSubjectAccessReviewv1.ts @@ -30,7 +30,7 @@ export class SelfSubjectAccessReviewv1 extends ApiObject { readonly spec: SelfSubjectAccessReviewSpecv1; constructor(app: K8sApp, name: string, args: SelfSubjectAccessReviewv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/SelfSubjectReviewv1.ts b/packages/core/src/models/SelfSubjectReviewv1.ts index b3b64e6..83c9a29 100644 --- a/packages/core/src/models/SelfSubjectReviewv1.ts +++ b/packages/core/src/models/SelfSubjectReviewv1.ts @@ -24,7 +24,7 @@ export class SelfSubjectReviewv1 extends ApiObject { readonly metadata: ObjectMetav1; constructor(app: K8sApp, name: string, args: SelfSubjectReviewv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; app.addResource(this); diff --git a/packages/core/src/models/SelfSubjectReviewv1beta1.ts b/packages/core/src/models/SelfSubjectReviewv1beta1.ts index b3cdf87..2174761 100644 --- a/packages/core/src/models/SelfSubjectReviewv1beta1.ts +++ b/packages/core/src/models/SelfSubjectReviewv1beta1.ts @@ -24,7 +24,7 @@ export class SelfSubjectReviewv1beta1 extends ApiObject { readonly metadata: ObjectMetav1; constructor(app: K8sApp, name: string, args: SelfSubjectReviewv1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; app.addResource(this); diff --git a/packages/core/src/models/SelfSubjectRulesReviewv1.ts b/packages/core/src/models/SelfSubjectRulesReviewv1.ts index 5287adb..f8d1f2a 100644 --- a/packages/core/src/models/SelfSubjectRulesReviewv1.ts +++ b/packages/core/src/models/SelfSubjectRulesReviewv1.ts @@ -30,7 +30,7 @@ export class SelfSubjectRulesReviewv1 extends ApiObject { readonly spec: SelfSubjectRulesReviewSpecv1; constructor(app: K8sApp, name: string, args: SelfSubjectRulesReviewv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ServiceAccountv1.ts b/packages/core/src/models/ServiceAccountv1.ts index 835b2c4..f5f7d16 100644 --- a/packages/core/src/models/ServiceAccountv1.ts +++ b/packages/core/src/models/ServiceAccountv1.ts @@ -40,7 +40,7 @@ export class ServiceAccountv1 extends NamespacedApiObject { readonly secrets?: Array; constructor(app: K8sApp, name: string, args: ServiceAccountv1Args) { - super(); + super(args.metadata?.name || name); this.automountServiceAccountToken = args.automountServiceAccountToken; this.imagePullSecrets = args.imagePullSecrets; this.metadata = args.metadata || { name }; diff --git a/packages/core/src/models/ServiceCIDRv1beta1.ts b/packages/core/src/models/ServiceCIDRv1beta1.ts index 030c137..4e96cfc 100644 --- a/packages/core/src/models/ServiceCIDRv1beta1.ts +++ b/packages/core/src/models/ServiceCIDRv1beta1.ts @@ -30,7 +30,7 @@ export class ServiceCIDRv1beta1 extends ApiObject { readonly spec?: ServiceCIDRSpecv1beta1; constructor(app: K8sApp, name: string, args: ServiceCIDRv1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/Servicev1.ts b/packages/core/src/models/Servicev1.ts index c9a49cf..932c1b4 100644 --- a/packages/core/src/models/Servicev1.ts +++ b/packages/core/src/models/Servicev1.ts @@ -29,7 +29,7 @@ export class Servicev1 extends NamespacedApiObject { readonly spec?: ServiceSpecv1; constructor(app: K8sApp, name: string, args: Servicev1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/StatefulSetv1.ts b/packages/core/src/models/StatefulSetv1.ts index 59c45ab..ff31422 100644 --- a/packages/core/src/models/StatefulSetv1.ts +++ b/packages/core/src/models/StatefulSetv1.ts @@ -29,7 +29,7 @@ export class StatefulSetv1 extends NamespacedApiObject { readonly spec?: StatefulSetSpecv1; constructor(app: K8sApp, name: string, args: StatefulSetv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/StorageClassv1.ts b/packages/core/src/models/StorageClassv1.ts index 1e1fc1a..5448948 100644 --- a/packages/core/src/models/StorageClassv1.ts +++ b/packages/core/src/models/StorageClassv1.ts @@ -60,7 +60,7 @@ export class StorageClassv1 extends ApiObject { readonly volumeBindingMode?: string; constructor(app: K8sApp, name: string, args: StorageClassv1Args) { - super(); + super(args.metadata?.name || name); this.allowVolumeExpansion = args.allowVolumeExpansion; this.allowedTopologies = args.allowedTopologies; this.metadata = args.metadata || { name }; diff --git a/packages/core/src/models/StorageVersionMigrationv1alpha1.ts b/packages/core/src/models/StorageVersionMigrationv1alpha1.ts index f3baea9..05dc041 100644 --- a/packages/core/src/models/StorageVersionMigrationv1alpha1.ts +++ b/packages/core/src/models/StorageVersionMigrationv1alpha1.ts @@ -30,7 +30,7 @@ export class StorageVersionMigrationv1alpha1 extends ApiObject { readonly spec?: StorageVersionMigrationSpecv1alpha1; constructor(app: K8sApp, name: string, args: StorageVersionMigrationv1alpha1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/StorageVersionv1alpha1.ts b/packages/core/src/models/StorageVersionv1alpha1.ts index c541e4f..2259811 100644 --- a/packages/core/src/models/StorageVersionv1alpha1.ts +++ b/packages/core/src/models/StorageVersionv1alpha1.ts @@ -29,7 +29,7 @@ export class StorageVersionv1alpha1 extends ApiObject { readonly spec: any; constructor(app: K8sApp, name: string, args: StorageVersionv1alpha1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/SubjectAccessReviewv1.ts b/packages/core/src/models/SubjectAccessReviewv1.ts index 49a8589..411bbc2 100644 --- a/packages/core/src/models/SubjectAccessReviewv1.ts +++ b/packages/core/src/models/SubjectAccessReviewv1.ts @@ -30,7 +30,7 @@ export class SubjectAccessReviewv1 extends ApiObject { readonly spec: SubjectAccessReviewSpecv1; constructor(app: K8sApp, name: string, args: SubjectAccessReviewv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/TokenReviewv1.ts b/packages/core/src/models/TokenReviewv1.ts index 3297c60..6b349c2 100644 --- a/packages/core/src/models/TokenReviewv1.ts +++ b/packages/core/src/models/TokenReviewv1.ts @@ -30,7 +30,7 @@ export class TokenReviewv1 extends ApiObject { readonly spec: TokenReviewSpecv1; constructor(app: K8sApp, name: string, args: TokenReviewv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ValidatingAdmissionPolicyBindingv1.ts b/packages/core/src/models/ValidatingAdmissionPolicyBindingv1.ts index d3fd95a..445bc88 100644 --- a/packages/core/src/models/ValidatingAdmissionPolicyBindingv1.ts +++ b/packages/core/src/models/ValidatingAdmissionPolicyBindingv1.ts @@ -30,7 +30,7 @@ export class ValidatingAdmissionPolicyBindingv1 extends ApiObject { readonly spec?: ValidatingAdmissionPolicyBindingSpecv1; constructor(app: K8sApp, name: string, args: ValidatingAdmissionPolicyBindingv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ValidatingAdmissionPolicyBindingv1beta1.ts b/packages/core/src/models/ValidatingAdmissionPolicyBindingv1beta1.ts index bdeaf3d..71ff3b7 100644 --- a/packages/core/src/models/ValidatingAdmissionPolicyBindingv1beta1.ts +++ b/packages/core/src/models/ValidatingAdmissionPolicyBindingv1beta1.ts @@ -30,7 +30,7 @@ export class ValidatingAdmissionPolicyBindingv1beta1 extends ApiObject { readonly spec?: ValidatingAdmissionPolicyBindingSpecv1beta1; constructor(app: K8sApp, name: string, args: ValidatingAdmissionPolicyBindingv1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ValidatingAdmissionPolicyv1.ts b/packages/core/src/models/ValidatingAdmissionPolicyv1.ts index 2910dbb..8ed2842 100644 --- a/packages/core/src/models/ValidatingAdmissionPolicyv1.ts +++ b/packages/core/src/models/ValidatingAdmissionPolicyv1.ts @@ -30,7 +30,7 @@ export class ValidatingAdmissionPolicyv1 extends ApiObject { readonly spec?: ValidatingAdmissionPolicySpecv1; constructor(app: K8sApp, name: string, args: ValidatingAdmissionPolicyv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ValidatingAdmissionPolicyv1beta1.ts b/packages/core/src/models/ValidatingAdmissionPolicyv1beta1.ts index 46fabc1..39aac58 100644 --- a/packages/core/src/models/ValidatingAdmissionPolicyv1beta1.ts +++ b/packages/core/src/models/ValidatingAdmissionPolicyv1beta1.ts @@ -30,7 +30,7 @@ export class ValidatingAdmissionPolicyv1beta1 extends ApiObject { readonly spec?: ValidatingAdmissionPolicySpecv1beta1; constructor(app: K8sApp, name: string, args: ValidatingAdmissionPolicyv1beta1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/ValidatingWebhookConfigurationv1.ts b/packages/core/src/models/ValidatingWebhookConfigurationv1.ts index 1f6c107..4277207 100644 --- a/packages/core/src/models/ValidatingWebhookConfigurationv1.ts +++ b/packages/core/src/models/ValidatingWebhookConfigurationv1.ts @@ -30,7 +30,7 @@ export class ValidatingWebhookConfigurationv1 extends ApiObject { readonly webhooks?: Array; constructor(app: K8sApp, name: string, args: ValidatingWebhookConfigurationv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.webhooks = args.webhooks; diff --git a/packages/core/src/models/VolumeAttachmentv1.ts b/packages/core/src/models/VolumeAttachmentv1.ts index dda39a3..5fbb28f 100644 --- a/packages/core/src/models/VolumeAttachmentv1.ts +++ b/packages/core/src/models/VolumeAttachmentv1.ts @@ -30,7 +30,7 @@ export class VolumeAttachmentv1 extends ApiObject { readonly spec: VolumeAttachmentSpecv1; constructor(app: K8sApp, name: string, args: VolumeAttachmentv1Args) { - super(); + super(args.metadata?.name || name); this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; diff --git a/packages/core/src/models/VolumeAttributesClassv1alpha1.ts b/packages/core/src/models/VolumeAttributesClassv1alpha1.ts index 6f4f373..a851c08 100644 --- a/packages/core/src/models/VolumeAttributesClassv1alpha1.ts +++ b/packages/core/src/models/VolumeAttributesClassv1alpha1.ts @@ -34,7 +34,7 @@ export class VolumeAttributesClassv1alpha1 extends ApiObject { readonly parameters?: { [key: string]: string }; constructor(app: K8sApp, name: string, args: VolumeAttributesClassv1alpha1Args) { - super(); + super(args.metadata?.name || name); this.driverName = args.driverName; this.metadata = args.metadata || { name }; this.metadata.name ??= name; diff --git a/packages/core/src/models/VolumeAttributesClassv1beta1.ts b/packages/core/src/models/VolumeAttributesClassv1beta1.ts index 996ed17..52b4c65 100644 --- a/packages/core/src/models/VolumeAttributesClassv1beta1.ts +++ b/packages/core/src/models/VolumeAttributesClassv1beta1.ts @@ -34,7 +34,7 @@ export class VolumeAttributesClassv1beta1 extends ApiObject { readonly parameters?: { [key: string]: string }; constructor(app: K8sApp, name: string, args: VolumeAttributesClassv1beta1Args) { - super(); + super(args.metadata?.name || name); this.driverName = args.driverName; this.metadata = args.metadata || { name }; this.metadata.name ??= name;