istio.io/istio@v0.0.0-20240520182934-d79c90f27776/samples/sleep/notsleep.yaml (about)

     1  # Copyright Istio Authors
     2  #
     3  #   Licensed under the Apache License, Version 2.0 (the "License");
     4  #   you may not use this file except in compliance with the License.
     5  #   You may obtain a copy of the License at
     6  #
     7  #       http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  #   Unless required by applicable law or agreed to in writing, software
    10  #   distributed under the License is distributed on an "AS IS" BASIS,
    11  #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  #   See the License for the specific language governing permissions and
    13  #   limitations under the License.
    14  
    15  ##################################################################################################
    16  # Notsleep service - based on the sleep service but has its own identity and affinity rule
    17  ##################################################################################################
    18  apiVersion: v1
    19  kind: ServiceAccount
    20  metadata:
    21    name: notsleep
    22  ---
    23  apiVersion: v1
    24  kind: Service
    25  metadata:
    26    name: notsleep
    27    labels:
    28      app: notsleep
    29      service: notsleep
    30  spec:
    31    ports:
    32    - port: 80
    33      name: http
    34    selector:
    35      app: notsleep
    36  ---
    37  apiVersion: apps/v1
    38  kind: Deployment
    39  metadata:
    40    name: notsleep
    41  spec:
    42    replicas: 1
    43    selector:
    44      matchLabels:
    45        app: notsleep
    46    template:
    47      metadata:
    48        labels:
    49          app: notsleep
    50      spec:
    51        affinity:
    52          podAntiAffinity:
    53            preferredDuringSchedulingIgnoredDuringExecution:
    54            - weight: 100
    55              podAffinityTerm:
    56                labelSelector:
    57                  matchExpressions:
    58                  - key: app
    59                    operator: In
    60                    values:
    61                    - productpage
    62                topologyKey: kubernetes.io/hostname 
    63        terminationGracePeriodSeconds: 0
    64        serviceAccountName: notsleep
    65        containers:
    66        - name: notsleep
    67          image: curlimages/curl
    68          command: ["/bin/sleep", "3650d"]
    69          imagePullPolicy: IfNotPresent
    70          volumeMounts:
    71          - mountPath: /etc/sleep/tls
    72            name: secret-volume
    73        volumes:
    74        - name: secret-volume
    75          secret:
    76            secretName: notsleep-secret
    77            optional: true
    78  ---