github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/pkg/live/helpers_test.go (about)

     1  // Copyright 2021 Google LLC
     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  package live
    16  
    17  var (
    18  	kptFile = `
    19  apiVersion: kpt.dev/v1
    20  kind: Kptfile
    21  metadata:
    22    name: test1
    23  upstreamLock:
    24    type: git
    25    git:
    26      commit: 786b898857bd7e9647c229d5f39b0be4de86c915
    27      repo: git@github.com:seans3/blueprint-helloworld
    28      directory: /
    29      ref: master
    30  inventory:
    31    namespace: test-namespace
    32    name: inventory-obj-name
    33    inventoryID: XXXXXXXXXX-FOOOOOO
    34  `
    35  	kptFileWithPipeline = `
    36  apiVersion: kpt.dev/v1
    37  kind: Kptfile
    38  metadata:
    39    name: kptfileWithPipeline
    40  pipeline:
    41    mutators:
    42    - image: k8s.gcr.io/pause:latest
    43      configPath: cm.yaml
    44  `
    45  	podA = `
    46  apiVersion: v1
    47  kind: Pod
    48  metadata:
    49    name: pod-a
    50    namespace: test-namespace
    51    labels:
    52      name: test-pod-label
    53  spec:
    54    containers:
    55    - name: kubernetes-pause
    56      image: k8s.gcr.io/pause:2.0
    57  `
    58  	deploymentA = `
    59  kind: Deployment
    60  apiVersion: apps/v1
    61  metadata:
    62    name: test-deployment
    63  spec:
    64    replicas: 1
    65  `
    66  	configMap = `
    67  apiVersion: v1
    68  kind: ConfigMap
    69  metadata:
    70    name: cm
    71  data: {}
    72  `
    73  	crd = `
    74  apiVersion: apiextensions.k8s.io/v1
    75  kind: CustomResourceDefinition
    76  metadata:
    77    name: custom.io
    78  spec:
    79    conversion:
    80      strategy: None
    81    group: custom.io
    82    names:
    83      kind: Custom
    84      listKind: CustomList
    85      plural: customs
    86      singular: custom
    87    scope: Cluster
    88    versions:
    89    - name: v1
    90      schema:
    91        openAPIV3Schema:
    92          description: This is for testing
    93          type: object
    94      served: true
    95      storage: true
    96      subresources: {}
    97  `
    98  	cr = `
    99  apiVersion: custom.io/v1
   100  kind: Custom
   101  metadata:
   102    name: cr
   103  `
   104  	localConfig = `
   105  apiVersion: v1
   106  kind: ConfigMap
   107  metadata:
   108    name: cm
   109    annotations:
   110      config.kubernetes.io/local-config: "true"
   111  data: {}
   112  `
   113  	notLocalConfig = `
   114  apiVersion: v1
   115  kind: ConfigMap
   116  metadata:
   117    name: cm
   118    annotations:
   119      config.kubernetes.io/local-config: "false"
   120  data: {}
   121  `
   122  )