istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/config/analysis/analyzers/testdata/injection.yaml (about)

     1  # Broken config in a yaml config file
     2  #
     3  
     4  # Namespace is explicitly enabled
     5  apiVersion: v1
     6  kind: Namespace
     7  metadata:
     8    labels:
     9      istio-injection: enabled
    10    name: default
    11  ---
    12  # Namespace doesn't have the injection label, but is labeled for ambient
    13  apiVersion: v1
    14  kind: Namespace
    15  metadata:
    16    labels:
    17      istio.io/dataplane-mode: ambient
    18    name: ambient
    19  ---
    20  # Namespace is explicitly disabled, Should not generate warning!
    21  apiVersion: v1
    22  kind: Namespace
    23  metadata:
    24    labels:
    25      istio-injection: disabled
    26    name: foo
    27  ---
    28  # Namespace doesn't have the label at all
    29  apiVersion: v1
    30  kind: Namespace
    31  metadata:
    32    name: bar
    33  ---
    34  # Namespace is explicitly enabled in the new style
    35  apiVersion: v1
    36  kind: Namespace
    37  metadata:
    38    labels:
    39      istio.io/rev: canary
    40    name: canary-test
    41  ---
    42  # Namespace is explicitly enabled in the new style, but refers to a non-existent control plane
    43  apiVersion: v1
    44  kind: Namespace
    45  metadata:
    46    labels:
    47      istio.io/rev: pidgeon
    48    name: pidgeon-test
    49  ---
    50  # Namespace has both old and new labels
    51  apiVersion: v1
    52  kind: Namespace
    53  metadata:
    54    name: busted
    55    labels:
    56      istio-injection: enabled
    57      istio.io/rev: canary
    58  ---
    59  # Pod that's injected. No warning
    60  apiVersion: v1
    61  kind: Pod
    62  metadata:
    63    name: injectedpod
    64    namespace: default
    65  spec:
    66    containers:
    67    - image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
    68      name: server
    69    - image: docker.io/istio/proxyv2:1.3.0-rc.2
    70      name: istio-proxy
    71  ---
    72  # Pod that's not injected and should be. Should generate warning
    73  apiVersion: v1
    74  kind: Pod
    75  metadata:
    76    name: noninjectedpod
    77    namespace: default
    78  spec:
    79    containers:
    80    - image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
    81      name: server
    82  ---
    83  # Pod that explicitly disables injection. Should not generate a warning.
    84  apiVersion: v1
    85  kind: Pod
    86  metadata:
    87    name: podinjectiondisabled
    88    namespace: default
    89    annotations:
    90      sidecar.istio.io/inject: "false"
    91  spec:
    92    containers:
    93    - image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
    94      name: server
    95  ---
    96  # Control plane pod proving the existence of istio.io/rev 'canary'
    97  apiVersion: v1
    98  kind: Pod
    99  metadata:
   100    name: istiod-canary-1234567890-12345
   101    namespace: istio-system
   102    labels:
   103      app: istiod
   104      istio: pilot
   105      istio.io/rev: canary
   106  spec:
   107    containers:
   108    - image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
   109      name: server
   110  ---
   111  # Pod that explicitly disables injection with label. Should not generate a warning.
   112  apiVersion: v1
   113  kind: Pod
   114  metadata:
   115    name: podinjectiondisabled-label
   116    namespace: default
   117    labels:
   118      sidecar.istio.io/inject: "false"
   119  spec:
   120    containers:
   121      - image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
   122        name: server
   123  ---
   124  # Pod that explicitly disables injection with label. Should not generate a warning.
   125  apiVersion: v1
   126  kind: Pod
   127  metadata:
   128    name: podinjectiondisabled-label-and-anno
   129    namespace: default
   130    annotations:
   131      sidecar.istio.io/inject: "true"
   132    labels:
   133      sidecar.istio.io/inject: "false"
   134  spec:
   135    containers:
   136      - image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
   137        name: server
   138  # Pod on the host network that's not injected and should not be. Should not generate warning
   139  ---
   140  apiVersion: v1
   141  kind: Pod
   142  metadata:
   143    name: noninjectedpodhostnetwork
   144    namespace: default
   145  spec:
   146    hostNetwork: true
   147    containers:
   148    - image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
   149      name: server
   150  ---
   151  apiVersion: v1
   152  kind: Namespace
   153  metadata:
   154    labels:
   155      istio-injection: enabled
   156      istio.io/rev: test
   157    name: multi-ns-1
   158  ---
   159  apiVersion: v1
   160  kind: Namespace
   161  metadata:
   162    labels:
   163      istio-injection: enabled
   164      istio.io/dataplane-mode: ambient
   165    name: multi-ns-2
   166  ---
   167  apiVersion: v1
   168  kind: Namespace
   169  metadata:
   170    labels:
   171      istio.io/rev: test
   172      istio.io/dataplane-mode: ambient
   173    name: multi-ns-3
   174  ---
   175  apiVersion: v1
   176  kind: Namespace
   177  metadata:
   178    labels:
   179      istio-injection: disabled # should not generate warning since it's disabled
   180      istio.io/dataplane-mode: ambient
   181    name: not-conflict-ns-1
   182  ---
   183  apiVersion: v1
   184  kind: Namespace
   185  metadata:
   186    labels:
   187      istio-injection: disabled # should not generate warning since it's disabled
   188      istio.io/rev: test
   189    name: not-conflict-ns-2