diff --git a/pkg/commands/build/testdata/testcase-variable-ref-ingress/expected.yaml b/pkg/commands/build/testdata/testcase-variable-ref-ingress/expected.yaml deleted file mode 100644 index 4bbd29393..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref-ingress/expected.yaml +++ /dev/null @@ -1,53 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app.kubernetes.io/component: nginx - name: kustomized-nginx -spec: - ports: - - name: http - port: 80 - protocol: TCP - targetPort: http ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app.kubernetes.io/component: nginx - name: kustomized-nginx -spec: - selector: - matchLabels: - app.kubernetes.io/component: nginx - template: - metadata: - labels: - app.kubernetes.io/component: nginx - spec: - containers: - - image: nginx:1.15.7-alpine - name: nginx - ports: - - containerPort: 80 - name: http ---- -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - labels: - app.kubernetes.io/component: nginx - name: kustomized-nginx -spec: - rules: - - host: kustomized-nginx.example.com - http: - paths: - - backend: - serviceName: kustomized-nginx - servicePort: 80 - path: / - tls: - - hosts: - - kustomized-nginx.example.com diff --git a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/deployment.yaml b/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/deployment.yaml deleted file mode 100644 index 469300ac4..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/deployment.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: nginx - labels: - app.kubernetes.io/component: nginx -spec: - selector: - matchLabels: - app.kubernetes.io/component: nginx - template: - metadata: - labels: - app.kubernetes.io/component: nginx - spec: - containers: - - name: nginx - image: nginx:1.15.7-alpine - ports: - - name: http - containerPort: 80 diff --git a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/ingress.yaml b/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/ingress.yaml deleted file mode 100644 index 733be9803..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/ingress.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: nginx - labels: - app.kubernetes.io/component: nginx -spec: - rules: - - host: $(DEPLOYMENT_NAME).example.com - http: - paths: - - backend: - serviceName: nginx - servicePort: 80 - path: / - tls: - - hosts: - - $(DEPLOYMENT_NAME).example.com diff --git a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/kustomization.yaml b/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/kustomization.yaml deleted file mode 100644 index 403316ec8..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/kustomization.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1beta1 -kind: Kustomization -resources: -- deployment.yaml -- ingress.yaml -- service.yaml - -vars: -- name: DEPLOYMENT_NAME - objref: - apiVersion: apps/v1 - kind: Deployment - name: nginx - fieldref: - fieldpath: metadata.name diff --git a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/service.yaml b/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/service.yaml deleted file mode 100644 index 6d426d9e6..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/base/service.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: nginx - labels: - app.kubernetes.io/component: nginx -spec: - ports: - - name: http - port: 80 - protocol: TCP - targetPort: http diff --git a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/overlay/kustomization.yaml b/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/overlay/kustomization.yaml deleted file mode 100644 index 0ae516e62..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref-ingress/in/overlay/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1beta1 -kind: Kustomization -nameprefix: kustomized- - -bases: -- ../base diff --git a/pkg/commands/build/testdata/testcase-variable-ref-ingress/test.yaml b/pkg/commands/build/testdata/testcase-variable-ref-ingress/test.yaml deleted file mode 100644 index 89ddf6a76..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref-ingress/test.yaml +++ /dev/null @@ -1,4 +0,0 @@ -description: variable reference and substitution for ingress resources -args: [] -filename: testdata/testcase-variable-ref-ingress/in/overlay/ -expectedStdout: testdata/testcase-variable-ref-ingress/expected.yaml diff --git a/pkg/commands/build/testdata/testcase-variable-ref/expected.diff b/pkg/commands/build/testdata/testcase-variable-ref/expected.diff deleted file mode 100644 index 76ec67755..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref/expected.diff +++ /dev/null @@ -1,186 +0,0 @@ -diff -u -N /tmp/noop/apps_v1beta1_StatefulSet_cockroachdb.yaml /tmp/transformed/apps_v1beta1_StatefulSet_cockroachdb.yaml ---- /tmp/noop/apps_v1beta1_StatefulSet_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/apps_v1beta1_StatefulSet_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -@@ -1,10 +1,10 @@ - apiVersion: apps/v1beta1 - kind: StatefulSet - metadata: -- name: base-cockroachdb -+ name: dev-base-cockroachdb - spec: - replicas: 3 -- serviceName: base-cockroachdb -+ serviceName: dev-base-cockroachdb - template: - metadata: - labels: -@@ -27,7 +27,7 @@ - - /bin/bash - - -ecx - - exec /cockroach/cockroach start --logtostderr --certs-dir /cockroach/cockroach-certs -- --host $(hostname -f) --http-host 0.0.0.0 --join base-cockroachdb-0.base-cockroachdb,base-cockroachdb-1.base-cockroachdb,base-cockroachdb-2.base-cockroachdb -+ --host $(hostname -f) --http-host 0.0.0.0 --join dev-base-cockroachdb-0.dev-base-cockroachdb,dev-base-cockroachdb-1.dev-base-cockroachdb,dev-base-cockroachdb-2.dev-base-cockroachdb - --cache 25% --max-sql-memory 25% - image: cockroachdb/cockroach:v1.1.5 - imagePullPolicy: IfNotPresent -@@ -48,7 +48,7 @@ - - -ecx - - /request-cert -namespace=${POD_NAMESPACE} -certs-dir=/cockroach-certs -type=node - -addresses=localhost,127.0.0.1,${POD_IP},$(hostname -f),$(hostname -f|cut -- -f 1-2 -d '.'),base-cockroachdb-public -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt -+ -f 1-2 -d '.'),dev-base-cockroachdb-public -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt - env: - - name: POD_IP - valueFrom: -@@ -64,7 +64,7 @@ - volumeMounts: - - mountPath: /cockroach-certs - name: certs -- serviceAccountName: base-cockroachdb -+ serviceAccountName: dev-base-cockroachdb - terminationGracePeriodSeconds: 60 - volumes: - - name: datadir -diff -u -N /tmp/noop/batch_v1beta1_CronJob_cronjob-example.yaml /tmp/transformed/batch_v1beta1_CronJob_cronjob-example.yaml ---- /tmp/noop/batch_v1beta1_CronJob_cronjob-example.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/batch_v1beta1_CronJob_cronjob-example.yaml YYYY-MM-DD HH:MM:SS -@@ -1,7 +1,7 @@ - apiVersion: batch/v1beta1 - kind: CronJob - metadata: -- name: base-cronjob-example -+ name: dev-base-cronjob-example - spec: - concurrencyPolicy: Forbid - jobTemplate: -@@ -11,11 +11,11 @@ - containers: - - command: - - echo -- - base-cockroachdb -- - base-test-config-map-259876d7fg -+ - dev-base-cockroachdb -+ - dev-base-test-config-map-b2g2dmd64b - env: - - name: CDB_PUBLIC_SVC -- value: base-cockroachdb-public -+ value: dev-base-cockroachdb-public - image: cockroachdb/cockroach:v1.1.5 - name: cronjob-example - schedule: '*/1 * * * *' -diff -u -N /tmp/noop/policy_v1beta1_PodDisruptionBudget_cockroachdb-budget.yaml /tmp/transformed/policy_v1beta1_PodDisruptionBudget_cockroachdb-budget.yaml ---- /tmp/noop/policy_v1beta1_PodDisruptionBudget_cockroachdb-budget.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/policy_v1beta1_PodDisruptionBudget_cockroachdb-budget.yaml YYYY-MM-DD HH:MM:SS -@@ -3,7 +3,7 @@ - metadata: - labels: - app: cockroachdb -- name: base-cockroachdb-budget -+ name: dev-base-cockroachdb-budget - spec: - maxUnavailable: 1 - selector: -diff -u -N /tmp/noop/rbac.authorization.k8s.io_v1beta1_ClusterRoleBinding_cockroachdb.yaml /tmp/transformed/rbac.authorization.k8s.io_v1beta1_ClusterRoleBinding_cockroachdb.yaml ---- /tmp/noop/rbac.authorization.k8s.io_v1beta1_ClusterRoleBinding_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/rbac.authorization.k8s.io_v1beta1_ClusterRoleBinding_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -@@ -3,12 +3,12 @@ - metadata: - labels: - app: cockroachdb -- name: base-cockroachdb -+ name: dev-base-cockroachdb - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole -- name: base-cockroachdb -+ name: dev-base-cockroachdb - subjects: - - kind: ServiceAccount -- name: base-cockroachdb -+ name: dev-base-cockroachdb - namespace: default -diff -u -N /tmp/noop/rbac.authorization.k8s.io_v1beta1_ClusterRole_cockroachdb.yaml /tmp/transformed/rbac.authorization.k8s.io_v1beta1_ClusterRole_cockroachdb.yaml ---- /tmp/noop/rbac.authorization.k8s.io_v1beta1_ClusterRole_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/rbac.authorization.k8s.io_v1beta1_ClusterRole_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -@@ -3,7 +3,7 @@ - metadata: - labels: - app: cockroachdb -- name: base-cockroachdb -+ name: dev-base-cockroachdb - rules: - - apiGroups: - - certificates.k8s.io -diff -u -N /tmp/noop/rbac.authorization.k8s.io_v1beta1_RoleBinding_cockroachdb.yaml /tmp/transformed/rbac.authorization.k8s.io_v1beta1_RoleBinding_cockroachdb.yaml ---- /tmp/noop/rbac.authorization.k8s.io_v1beta1_RoleBinding_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/rbac.authorization.k8s.io_v1beta1_RoleBinding_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -@@ -3,12 +3,12 @@ - metadata: - labels: - app: cockroachdb -- name: base-cockroachdb -+ name: dev-base-cockroachdb - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role -- name: base-cockroachdb -+ name: dev-base-cockroachdb - subjects: - - kind: ServiceAccount -- name: base-cockroachdb -+ name: dev-base-cockroachdb - namespace: default -diff -u -N /tmp/noop/rbac.authorization.k8s.io_v1beta1_Role_cockroachdb.yaml /tmp/transformed/rbac.authorization.k8s.io_v1beta1_Role_cockroachdb.yaml ---- /tmp/noop/rbac.authorization.k8s.io_v1beta1_Role_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/rbac.authorization.k8s.io_v1beta1_Role_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -@@ -3,7 +3,7 @@ - metadata: - labels: - app: cockroachdb -- name: base-cockroachdb -+ name: dev-base-cockroachdb - rules: - - apiGroups: - - "" -diff -u -N /tmp/noop/v1_ConfigMap_test-config-map.yaml /tmp/transformed/v1_ConfigMap_test-config-map.yaml ---- /tmp/noop/v1_ConfigMap_test-config-map.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/v1_ConfigMap_test-config-map.yaml YYYY-MM-DD HH:MM:SS -@@ -5,4 +5,4 @@ - kind: ConfigMap - metadata: - creationTimestamp: null -- name: base-test-config-map-259876d7fg -+ name: dev-base-test-config-map-b2g2dmd64b -diff -u -N /tmp/noop/v1_ServiceAccount_cockroachdb.yaml /tmp/transformed/v1_ServiceAccount_cockroachdb.yaml ---- /tmp/noop/v1_ServiceAccount_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/v1_ServiceAccount_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -@@ -3,4 +3,4 @@ - metadata: - labels: - app: cockroachdb -- name: base-cockroachdb -+ name: dev-base-cockroachdb -diff -u -N /tmp/noop/v1_Service_cockroachdb-public.yaml /tmp/transformed/v1_Service_cockroachdb-public.yaml ---- /tmp/noop/v1_Service_cockroachdb-public.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/v1_Service_cockroachdb-public.yaml YYYY-MM-DD HH:MM:SS -@@ -3,7 +3,7 @@ - metadata: - labels: - app: cockroachdb -- name: base-cockroachdb-public -+ name: dev-base-cockroachdb-public - spec: - ports: - - name: grpc -diff -u -N /tmp/noop/v1_Service_cockroachdb.yaml /tmp/transformed/v1_Service_cockroachdb.yaml ---- /tmp/noop/v1_Service_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -+++ /tmp/transformed/v1_Service_cockroachdb.yaml YYYY-MM-DD HH:MM:SS -@@ -8,7 +8,7 @@ - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" - labels: - app: cockroachdb -- name: base-cockroachdb -+ name: dev-base-cockroachdb - spec: - clusterIP: None - ports: diff --git a/pkg/commands/build/testdata/testcase-variable-ref/expected.yaml b/pkg/commands/build/testdata/testcase-variable-ref/expected.yaml deleted file mode 100644 index ab030bf5b..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref/expected.yaml +++ /dev/null @@ -1,235 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app: cockroachdb - name: dev-base-cockroachdb ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: Role -metadata: - labels: - app: cockroachdb - name: dev-base-cockroachdb -rules: -- apiGroups: - - "" - resources: - - secrets - verbs: - - create - - get ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRole -metadata: - labels: - app: cockroachdb - name: dev-base-cockroachdb -rules: -- apiGroups: - - certificates.k8s.io - resources: - - certificatesigningrequests - verbs: - - create - - get - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: RoleBinding -metadata: - labels: - app: cockroachdb - name: dev-base-cockroachdb -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: dev-base-cockroachdb -subjects: -- kind: ServiceAccount - name: dev-base-cockroachdb - namespace: default ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - labels: - app: cockroachdb - name: dev-base-cockroachdb -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: dev-base-cockroachdb -subjects: -- kind: ServiceAccount - name: dev-base-cockroachdb - namespace: default ---- -apiVersion: v1 -data: - baz: qux - foo: bar -kind: ConfigMap -metadata: - name: dev-base-test-config-map-b2g2dmd64b ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: cockroachdb - name: dev-base-cockroachdb-public -spec: - ports: - - name: grpc - port: 26257 - targetPort: 26257 - - name: http - port: 8080 - targetPort: 8080 - selector: - app: cockroachdb ---- -apiVersion: v1 -kind: Service -metadata: - annotations: - prometheus.io/path: _status/vars - prometheus.io/port: "8080" - prometheus.io/scrape: "true" - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" - labels: - app: cockroachdb - name: dev-base-cockroachdb -spec: - clusterIP: None - ports: - - name: grpc - port: 26257 - targetPort: 26257 - - name: http - port: 8080 - targetPort: 8080 - selector: - app: cockroachdb ---- -apiVersion: apps/v1beta1 -kind: StatefulSet -metadata: - name: dev-base-cockroachdb -spec: - replicas: 3 - serviceName: dev-base-cockroachdb - template: - metadata: - labels: - app: cockroachdb - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - cockroachdb - topologyKey: kubernetes.io/hostname - weight: 100 - containers: - - command: - - /bin/bash - - -ecx - - exec /cockroach/cockroach start --logtostderr --certs-dir /cockroach/cockroach-certs - --host $(hostname -f) --http-host 0.0.0.0 --join dev-base-cockroachdb-0.dev-base-cockroachdb,dev-base-cockroachdb-1.dev-base-cockroachdb,dev-base-cockroachdb-2.dev-base-cockroachdb - --cache 25% --max-sql-memory 25% - image: cockroachdb/cockroach:v1.1.5 - imagePullPolicy: IfNotPresent - name: cockroachdb - ports: - - containerPort: 26257 - name: grpc - - containerPort: 8080 - name: http - volumeMounts: - - mountPath: /cockroach/cockroach-data - name: datadir - - mountPath: /cockroach/cockroach-certs - name: certs - initContainers: - - command: - - /bin/ash - - -ecx - - /request-cert -namespace=${POD_NAMESPACE} -certs-dir=/cockroach-certs -type=node - -addresses=localhost,127.0.0.1,${POD_IP},$(hostname -f),$(hostname -f|cut - -f 1-2 -d '.'),dev-base-cockroachdb-public -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt - env: - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - image: cockroachdb/cockroach-k8s-request-cert:0.2 - imagePullPolicy: IfNotPresent - name: init-certs - volumeMounts: - - mountPath: /cockroach-certs - name: certs - serviceAccountName: dev-base-cockroachdb - terminationGracePeriodSeconds: 60 - volumes: - - name: datadir - persistentVolumeClaim: - claimName: datadir - - emptyDir: {} - name: certs - updateStrategy: - type: RollingUpdate - volumeClaimTemplates: - - metadata: - name: datadir - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi ---- -apiVersion: batch/v1beta1 -kind: CronJob -metadata: - name: dev-base-cronjob-example -spec: - concurrencyPolicy: Forbid - jobTemplate: - spec: - template: - spec: - containers: - - command: - - echo - - dev-base-cockroachdb - - dev-base-test-config-map-b2g2dmd64b - env: - - name: CDB_PUBLIC_SVC - value: dev-base-cockroachdb-public - image: cockroachdb/cockroach:v1.1.5 - name: cronjob-example - schedule: '*/1 * * * *' ---- -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - labels: - app: cockroachdb - name: dev-base-cockroachdb-budget -spec: - maxUnavailable: 1 - selector: - matchLabels: - app: cockroachdb diff --git a/pkg/commands/build/testdata/testcase-variable-ref/in/overlay/kustomization.yaml b/pkg/commands/build/testdata/testcase-variable-ref/in/overlay/kustomization.yaml deleted file mode 100644 index 9d4cc170d..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref/in/overlay/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v1beta1 -kind: Kustomization -namePrefix: dev- -bases: -- ../package - diff --git a/pkg/commands/build/testdata/testcase-variable-ref/in/package/cockroachdb-statefulset-secure.yaml b/pkg/commands/build/testdata/testcase-variable-ref/in/package/cockroachdb-statefulset-secure.yaml deleted file mode 100644 index 5feb4a669..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref/in/package/cockroachdb-statefulset-secure.yaml +++ /dev/null @@ -1,235 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: cockroachdb - labels: - app: cockroachdb ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: Role -metadata: - name: cockroachdb - labels: - app: cockroachdb -rules: -- apiGroups: - - "" - resources: - - secrets - verbs: - - create - - get ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRole -metadata: - name: cockroachdb - labels: - app: cockroachdb -rules: -- apiGroups: - - certificates.k8s.io - resources: - - certificatesigningrequests - verbs: - - create - - get - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: RoleBinding -metadata: - name: cockroachdb - labels: - app: cockroachdb -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: cockroachdb -subjects: -- kind: ServiceAccount - name: cockroachdb - namespace: default ---- -apiVersion: rbac.authorization.k8s.io/v1beta1 -kind: ClusterRoleBinding -metadata: - name: cockroachdb - labels: - app: cockroachdb -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cockroachdb -subjects: -- kind: ServiceAccount - name: cockroachdb - namespace: default ---- -apiVersion: v1 -kind: Service -metadata: - # This service is meant to be used by clients of the database. It exposes a ClusterIP that will - # automatically load balance connections to the different database pods. - name: cockroachdb-public - labels: - app: cockroachdb -spec: - ports: - # The main port, served by gRPC, serves Postgres-flavor SQL, internode - # traffic and the cli. - - port: 26257 - targetPort: 26257 - name: grpc - # The secondary port serves the UI as well as health and debug endpoints. - - port: 8080 - targetPort: 8080 - name: http - selector: - app: cockroachdb ---- -apiVersion: v1 -kind: Service -metadata: - # This service only exists to create DNS entries for each pod in the stateful - # set such that they can resolve each other's IP addresses. It does not - # create a load-balanced ClusterIP and should not be used directly by clients - # in most circumstances. - name: cockroachdb - labels: - app: cockroachdb - annotations: - # This is needed to make the peer-finder work properly and to help avoid - # edge cases where instance 0 comes up after losing its data and needs to - # decide whether it should create a new cluster or try to join an existing - # one. If it creates a new cluster when it should have joined an existing - # one, we'd end up with two separate clusters listening at the same service - # endpoint, which would be very bad. - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" - # Enable automatic monitoring of all instances when Prometheus is running in the cluster. - prometheus.io/scrape: "true" - prometheus.io/path: "_status/vars" - prometheus.io/port: "8080" -spec: - ports: - - port: 26257 - targetPort: 26257 - name: grpc - - port: 8080 - targetPort: 8080 - name: http - clusterIP: None - selector: - app: cockroachdb ---- -apiVersion: policy/v1beta1 -kind: PodDisruptionBudget -metadata: - name: cockroachdb-budget - labels: - app: cockroachdb -spec: - selector: - matchLabels: - app: cockroachdb - maxUnavailable: 1 ---- -apiVersion: apps/v1beta1 -kind: StatefulSet -metadata: - name: cockroachdb -spec: - serviceName: "cockroachdb" - replicas: 3 - template: - metadata: - labels: - app: cockroachdb - spec: - serviceAccountName: cockroachdb - # Init containers are run only once in the lifetime of a pod, before - # it's started up for the first time. It has to exit successfully - # before the pod's main containers are allowed to start. - initContainers: - # The init-certs container sends a certificate signing request to the - # kubernetes cluster. - # You can see pending requests using: kubectl get csr - # CSRs can be approved using: kubectl certificate approve - # - # All addresses used to contact a node must be specified in the --addresses arg. - # - # In addition to the node certificate and key, the init-certs entrypoint will symlink - # the cluster CA to the certs directory. - - name: init-certs - image: cockroachdb/cockroach-k8s-request-cert:0.2 - imagePullPolicy: IfNotPresent - command: - - "/bin/ash" - - "-ecx" - - "/request-cert -namespace=${POD_NAMESPACE} -certs-dir=/cockroach-certs -type=node -addresses=localhost,127.0.0.1,${POD_IP},$(hostname -f),$(hostname -f|cut -f 1-2 -d '.'),$(CDB_PUBLIC_SVC) -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" - env: - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: POD_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - volumeMounts: - - name: certs - mountPath: /cockroach-certs - - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - cockroachdb - topologyKey: kubernetes.io/hostname - containers: - - name: cockroachdb - image: cockroachdb/cockroach:v1.1.5 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 26257 - name: grpc - - containerPort: 8080 - name: http - volumeMounts: - - name: datadir - mountPath: /cockroach/cockroach-data - - name: certs - mountPath: /cockroach/cockroach-certs - command: - - "/bin/bash" - - "-ecx" - # The use of qualified `hostname -f` is crucial: - # Other nodes aren't able to look up the unqualified hostname. - # Once 2.0 is out, we should be able to switch from --host to --advertise-host to make port-forwarding work to the main port. - - "exec /cockroach/cockroach start --logtostderr --certs-dir /cockroach/cockroach-certs --host $(hostname -f) --http-host 0.0.0.0 --join $(CDB_STATEFULSET_NAME)-0.$(CDB_STATEFULSET_SVC),$(CDB_STATEFULSET_NAME)-1.$(CDB_STATEFULSET_SVC),$(CDB_STATEFULSET_NAME)-2.$(CDB_STATEFULSET_SVC) --cache 25% --max-sql-memory 25%" - # No pre-stop hook is required, a SIGTERM plus some time is all that's - # needed for graceful shutdown of a node. - terminationGracePeriodSeconds: 60 - volumes: - - name: datadir - persistentVolumeClaim: - claimName: datadir - - name: certs - emptyDir: {} - updateStrategy: - type: RollingUpdate - volumeClaimTemplates: - - metadata: - name: datadir - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 1Gi diff --git a/pkg/commands/build/testdata/testcase-variable-ref/in/package/cronjob.yaml b/pkg/commands/build/testdata/testcase-variable-ref/in/package/cronjob.yaml deleted file mode 100644 index 64615c251..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref/in/package/cronjob.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: batch/v1beta1 -kind: CronJob -metadata: - name: cronjob-example -spec: - schedule: "*/1 * * * *" - concurrencyPolicy: Forbid - jobTemplate: - spec: - template: - spec: - containers: - - name: cronjob-example - image: cockroachdb/cockroach:v1.1.5 - command: - - echo - - "$(CDB_STATEFULSET_NAME)" - - "$(TEST_CONFIG_MAP)" - env: - - name: CDB_PUBLIC_SVC - value: "$(CDB_PUBLIC_SVC)" diff --git a/pkg/commands/build/testdata/testcase-variable-ref/in/package/kustomization.yaml b/pkg/commands/build/testdata/testcase-variable-ref/in/package/kustomization.yaml deleted file mode 100644 index e081ba807..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref/in/package/kustomization.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: v1beta1 -kind: Kustomization -namePrefix: base- -resources: - - cockroachdb-statefulset-secure.yaml - - cronjob.yaml -configMapGenerator: -- name: test-config-map - literals: - - foo=bar - - baz=qux -vars: - - name: CDB_PUBLIC_SVC - objref: - kind: Service - name: cockroachdb-public - apiVersion: v1 - fieldref: - fieldpath: metadata.name - - name: CDB_STATEFULSET_NAME - objref: - kind: StatefulSet - name: cockroachdb - apiVersion: apps/v1beta1 - fieldref: - fieldpath: metadata.name - - name: CDB_STATEFULSET_SVC - objref: - kind: Service - name: cockroachdb - apiVersion: v1 - fieldref: - fieldpath: metadata.name - - - name: TEST_CONFIG_MAP - objref: - kind: ConfigMap - name: test-config-map - apiVersion: v1 - fieldref: - fieldpath: metadata.name diff --git a/pkg/commands/build/testdata/testcase-variable-ref/test.yaml b/pkg/commands/build/testdata/testcase-variable-ref/test.yaml deleted file mode 100644 index 0c94b121e..000000000 --- a/pkg/commands/build/testdata/testcase-variable-ref/test.yaml +++ /dev/null @@ -1,5 +0,0 @@ -description: variable reference and substitution -args: [] -filename: testdata/testcase-variable-ref/in/overlay/ -expectedStdout: testdata/testcase-variable-ref/expected.yaml -expectedDiff: testdata/testcase-variable-ref/expected.diff diff --git a/pkg/target/utils_for_test.go b/pkg/target/utils_for_test.go index 8aebc4f8e..97f17b5e3 100644 --- a/pkg/target/utils_for_test.go +++ b/pkg/target/utils_for_test.go @@ -151,9 +151,9 @@ func (th *KustTestHarness) assertActualEqualsExpected( func (th *KustTestHarness) reportDiffAndFail(actual []byte, expected string) { sE, maxLen := convertToArray(expected) sA, _ := convertToArray(string(actual)) - fmt.Println("-- ACTUAL -----------------") - fmt.Println(string(actual)) - fmt.Println("---------------------------") + fmt.Println("===== ACTUAL BEGIN ========================================") + fmt.Print(string(actual)) + fmt.Println("===== ACTUAL END ==========================================") format := fmt.Sprintf("%%s %%-%ds %%s\n", maxLen+4) limit := 0 if len(sE) < len(sA) { diff --git a/pkg/target/variableref_test.go b/pkg/target/variableref_test.go new file mode 100644 index 000000000..f923a026a --- /dev/null +++ b/pkg/target/variableref_test.go @@ -0,0 +1,725 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package target + +import ( + "testing" +) + +func TestVariableRef(t *testing.T) { + th := NewKustTestHarness(t, "/app/overlay/staging") + th.writeK("/app/base", ` +apiVersion: v1beta1 +kind: Kustomization +namePrefix: base- +resources: + - cockroachdb-statefulset-secure.yaml + - cronjob.yaml +configMapGenerator: +- name: test-config-map + literals: + - foo=bar + - baz=qux +vars: + - name: CDB_PUBLIC_SVC + objref: + kind: Service + name: cockroachdb-public + apiVersion: v1 + fieldref: + fieldpath: metadata.name + - name: CDB_STATEFULSET_NAME + objref: + kind: StatefulSet + name: cockroachdb + apiVersion: apps/v1beta1 + fieldref: + fieldpath: metadata.name + - name: CDB_STATEFULSET_SVC + objref: + kind: Service + name: cockroachdb + apiVersion: v1 + fieldref: + fieldpath: metadata.name + + - name: TEST_CONFIG_MAP + objref: + kind: ConfigMap + name: test-config-map + apiVersion: v1 + fieldref: + fieldpath: metadata.name`) + th.writeF("/app/base/cronjob.yaml", ` +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: cronjob-example +spec: + schedule: "*/1 * * * *" + concurrencyPolicy: Forbid + jobTemplate: + spec: + template: + spec: + containers: + - name: cronjob-example + image: cockroachdb/cockroach:v1.1.5 + command: + - echo + - "$(CDB_STATEFULSET_NAME)" + - "$(TEST_CONFIG_MAP)" + env: + - name: CDB_PUBLIC_SVC + value: "$(CDB_PUBLIC_SVC)" +`) + th.writeF("/app/base/cockroachdb-statefulset-secure.yaml", ` +apiVersion: v1 +kind: ServiceAccount +metadata: + name: cockroachdb + labels: + app: cockroachdb +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: Role +metadata: + name: cockroachdb + labels: + app: cockroachdb +rules: +- apiGroups: + - "" + resources: + - secrets + verbs: + - create + - get +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: cockroachdb + labels: + app: cockroachdb +rules: +- apiGroups: + - certificates.k8s.io + resources: + - certificatesigningrequests + verbs: + - create + - get + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + name: cockroachdb + labels: + app: cockroachdb +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: cockroachdb +subjects: +- kind: ServiceAccount + name: cockroachdb + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: cockroachdb + labels: + app: cockroachdb +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cockroachdb +subjects: +- kind: ServiceAccount + name: cockroachdb + namespace: default +--- +apiVersion: v1 +kind: Service +metadata: + # This service is meant to be used by clients of the database. It exposes a ClusterIP that will + # automatically load balance connections to the different database pods. + name: cockroachdb-public + labels: + app: cockroachdb +spec: + ports: + # The main port, served by gRPC, serves Postgres-flavor SQL, internode + # traffic and the cli. + - port: 26257 + targetPort: 26257 + name: grpc + # The secondary port serves the UI as well as health and debug endpoints. + - port: 8080 + targetPort: 8080 + name: http + selector: + app: cockroachdb +--- +apiVersion: v1 +kind: Service +metadata: + name: cockroachdb + labels: + app: cockroachdb + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" + # Enable automatic monitoring of all instances when Prometheus is running in the cluster. + prometheus.io/scrape: "true" + prometheus.io/path: "_status/vars" + prometheus.io/port: "8080" +spec: + ports: + - port: 26257 + targetPort: 26257 + name: grpc + - port: 8080 + targetPort: 8080 + name: http + clusterIP: None + selector: + app: cockroachdb +--- +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: cockroachdb-budget + labels: + app: cockroachdb +spec: + selector: + matchLabels: + app: cockroachdb + maxUnavailable: 1 +--- +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: cockroachdb +spec: + serviceName: "cockroachdb" + replicas: 3 + template: + metadata: + labels: + app: cockroachdb + spec: + serviceAccountName: cockroachdb + # Init containers are run only once in the lifetime of a pod, before + # it's started up for the first time. It has to exit successfully + # before the pod's main containers are allowed to start. + initContainers: + # The init-certs container sends a certificate signing request to the + # kubernetes cluster. + # You can see pending requests using: kubectl get csr + # CSRs can be approved using: kubectl certificate approve + # + # All addresses used to contact a node must be specified in the --addresses arg. + # + # In addition to the node certificate and key, the init-certs entrypoint will symlink + # the cluster CA to the certs directory. + - name: init-certs + image: cockroachdb/cockroach-k8s-request-cert:0.2 + imagePullPolicy: IfNotPresent + command: + - "/bin/ash" + - "-ecx" + - "/request-cert" + - -namespace=${POD_NAMESPACE} + - -certs-dir=/cockroach-certs + - -type=node + - -addresses=localhost,127.0.0.1,${POD_IP},$(hostname -f),$(hostname -f|cut -f 1-2 -d '.'),$(CDB_PUBLIC_SVC) + - -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt + env: + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + volumeMounts: + - name: certs + mountPath: /cockroach-certs + + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - cockroachdb + topologyKey: kubernetes.io/hostname + containers: + - name: cockroachdb + image: cockroachdb/cockroach:v1.1.5 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 26257 + name: grpc + - containerPort: 8080 + name: http + volumeMounts: + - name: datadir + mountPath: /cockroach/cockroach-data + - name: certs + mountPath: /cockroach/cockroach-certs + command: + - "/bin/bash" + - "-ecx" + - "exec /cockroach/cockroach start --logtostderr" + - --certs-dir /cockroach/cockroach-certs + - --host $(hostname -f) + - --http-host 0.0.0.0 + - --join $(CDB_STATEFULSET_NAME)-0.$(CDB_STATEFULSET_SVC),$(CDB_STATEFULSET_NAME)-1.$(CDB_STATEFULSET_SVC),$(CDB_STATEFULSET_NAME)-2.$(CDB_STATEFULSET_SVC) + - --cache 25% + - --max-sql-memory 25% + # No pre-stop hook is required, a SIGTERM plus some time is all that's + # needed for graceful shutdown of a node. + terminationGracePeriodSeconds: 60 + volumes: + - name: datadir + persistentVolumeClaim: + claimName: datadir + - name: certs + emptyDir: {} + updateStrategy: + type: RollingUpdate + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: 1Gi +`) + th.writeK("/app/overlay/staging", ` +apiVersion: v1beta1 +kind: Kustomization +namePrefix: dev- +bases: +- ../../base +`) + m, err := th.makeKustTarget().MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + th.assertActualEqualsExpected(m, ` +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: cockroachdb + name: dev-base-cockroachdb +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: Role +metadata: + labels: + app: cockroachdb + name: dev-base-cockroachdb +rules: +- apiGroups: + - "" + resources: + - secrets + verbs: + - create + - get +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + labels: + app: cockroachdb + name: dev-base-cockroachdb +rules: +- apiGroups: + - certificates.k8s.io + resources: + - certificatesigningrequests + verbs: + - create + - get + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + labels: + app: cockroachdb + name: dev-base-cockroachdb +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: dev-base-cockroachdb +subjects: +- kind: ServiceAccount + name: dev-base-cockroachdb + namespace: default +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + labels: + app: cockroachdb + name: dev-base-cockroachdb +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: dev-base-cockroachdb +subjects: +- kind: ServiceAccount + name: dev-base-cockroachdb + namespace: default +--- +apiVersion: v1 +data: + baz: qux + foo: bar +kind: ConfigMap +metadata: + name: dev-base-test-config-map-b2g2dmd64b +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: cockroachdb + name: dev-base-cockroachdb-public +spec: + ports: + - name: grpc + port: 26257 + targetPort: 26257 + - name: http + port: 8080 + targetPort: 8080 + selector: + app: cockroachdb +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/path: _status/vars + prometheus.io/port: "8080" + prometheus.io/scrape: "true" + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" + labels: + app: cockroachdb + name: dev-base-cockroachdb +spec: + clusterIP: None + ports: + - name: grpc + port: 26257 + targetPort: 26257 + - name: http + port: 8080 + targetPort: 8080 + selector: + app: cockroachdb +--- +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: dev-base-cockroachdb +spec: + replicas: 3 + serviceName: dev-base-cockroachdb + template: + metadata: + labels: + app: cockroachdb + spec: + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - cockroachdb + topologyKey: kubernetes.io/hostname + weight: 100 + containers: + - command: + - /bin/bash + - -ecx + - exec /cockroach/cockroach start --logtostderr + - --certs-dir /cockroach/cockroach-certs + - --host $(hostname -f) + - --http-host 0.0.0.0 + - --join dev-base-cockroachdb-0.dev-base-cockroachdb,dev-base-cockroachdb-1.dev-base-cockroachdb,dev-base-cockroachdb-2.dev-base-cockroachdb + - --cache 25% + - --max-sql-memory 25% + image: cockroachdb/cockroach:v1.1.5 + imagePullPolicy: IfNotPresent + name: cockroachdb + ports: + - containerPort: 26257 + name: grpc + - containerPort: 8080 + name: http + volumeMounts: + - mountPath: /cockroach/cockroach-data + name: datadir + - mountPath: /cockroach/cockroach-certs + name: certs + initContainers: + - command: + - /bin/ash + - -ecx + - /request-cert + - -namespace=${POD_NAMESPACE} + - -certs-dir=/cockroach-certs + - -type=node + - -addresses=localhost,127.0.0.1,${POD_IP},$(hostname -f),$(hostname -f|cut + -f 1-2 -d '.'),dev-base-cockroachdb-public + - -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt + env: + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + image: cockroachdb/cockroach-k8s-request-cert:0.2 + imagePullPolicy: IfNotPresent + name: init-certs + volumeMounts: + - mountPath: /cockroach-certs + name: certs + serviceAccountName: dev-base-cockroachdb + terminationGracePeriodSeconds: 60 + volumes: + - name: datadir + persistentVolumeClaim: + claimName: datadir + - emptyDir: {} + name: certs + updateStrategy: + type: RollingUpdate + volumeClaimTemplates: + - metadata: + name: datadir + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: dev-base-cronjob-example +spec: + concurrencyPolicy: Forbid + jobTemplate: + spec: + template: + spec: + containers: + - command: + - echo + - dev-base-cockroachdb + - dev-base-test-config-map-b2g2dmd64b + env: + - name: CDB_PUBLIC_SVC + value: dev-base-cockroachdb-public + image: cockroachdb/cockroach:v1.1.5 + name: cronjob-example + schedule: '*/1 * * * *' +--- +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + labels: + app: cockroachdb + name: dev-base-cockroachdb-budget +spec: + maxUnavailable: 1 + selector: + matchLabels: + app: cockroachdb +`) +} + +func TestVariableRefIngress(t *testing.T) { + th := NewKustTestHarness(t, "/app/overlay") + th.writeK("/app/base", ` +apiVersion: v1beta1 +kind: Kustomization +resources: +- deployment.yaml +- ingress.yaml +- service.yaml + +vars: +- name: DEPLOYMENT_NAME + objref: + apiVersion: apps/v1 + kind: Deployment + name: nginx + fieldref: + fieldpath: metadata.name +`) + th.writeF("/app/base/deployment.yaml", ` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx + labels: + app.kubernetes.io/component: nginx +spec: + selector: + matchLabels: + app.kubernetes.io/component: nginx + template: + metadata: + labels: + app.kubernetes.io/component: nginx + spec: + containers: + - name: nginx + image: nginx:1.15.7-alpine + ports: + - name: http + containerPort: 80 +`) + th.writeF("/app/base/ingress.yaml", ` +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: nginx + labels: + app.kubernetes.io/component: nginx +spec: + rules: + - host: $(DEPLOYMENT_NAME).example.com + http: + paths: + - backend: + serviceName: nginx + servicePort: 80 + path: / + tls: + - hosts: + - $(DEPLOYMENT_NAME).example.com +`) + th.writeF("/app/base/service.yaml", ` +apiVersion: v1 +kind: Service +metadata: + name: nginx + labels: + app.kubernetes.io/component: nginx +spec: + ports: + - name: http + port: 80 + protocol: TCP + targetPort: http +`) + th.writeK("/app/overlay", ` +apiVersion: v1beta1 +kind: Kustomization +nameprefix: kustomized- +bases: +- ../base +`) + m, err := th.makeKustTarget().MakeCustomizedResMap() + if err != nil { + t.Fatalf("Err: %v", err) + } + th.assertActualEqualsExpected(m, ` +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/component: nginx + name: kustomized-nginx +spec: + ports: + - name: http + port: 80 + protocol: TCP + targetPort: http +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: nginx + name: kustomized-nginx +spec: + selector: + matchLabels: + app.kubernetes.io/component: nginx + template: + metadata: + labels: + app.kubernetes.io/component: nginx + spec: + containers: + - image: nginx:1.15.7-alpine + name: nginx + ports: + - containerPort: 80 + name: http +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + labels: + app.kubernetes.io/component: nginx + name: kustomized-nginx +spec: + rules: + - host: kustomized-nginx.example.com + http: + paths: + - backend: + serviceName: kustomized-nginx + servicePort: 80 + path: / + tls: + - hosts: + - kustomized-nginx.example.com +`) +}