...

Source file src/github.com/fluxcd/helm-controller/api/v2beta1/reference_types.go

Documentation: github.com/fluxcd/helm-controller/api/v2beta1

     1  /*
     2  Copyright 2020 The Flux authors
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v2beta1
    18  
    19  // CrossNamespaceObjectReference contains enough information to let you locate
    20  // the typed referenced object at cluster level.
    21  type CrossNamespaceObjectReference struct {
    22  	// APIVersion of the referent.
    23  	// +optional
    24  	APIVersion string `json:"apiVersion,omitempty"`
    25  
    26  	// Kind of the referent.
    27  	// +kubebuilder:validation:Enum=HelmRepository;GitRepository;Bucket
    28  	// +required
    29  	Kind string `json:"kind,omitempty"`
    30  
    31  	// Name of the referent.
    32  	// +kubebuilder:validation:MinLength=1
    33  	// +kubebuilder:validation:MaxLength=253
    34  	// +required
    35  	Name string `json:"name"`
    36  
    37  	// Namespace of the referent.
    38  	// +kubebuilder:validation:MinLength=1
    39  	// +kubebuilder:validation:MaxLength=63
    40  	// +kubebuilder:validation:Optional
    41  	// +optional
    42  	Namespace string `json:"namespace,omitempty"`
    43  }
    44  
    45  // ValuesReference contains a reference to a resource containing Helm values,
    46  // and optionally the key they can be found at.
    47  type ValuesReference struct {
    48  	// Kind of the values referent, valid values are ('Secret', 'ConfigMap').
    49  	// +kubebuilder:validation:Enum=Secret;ConfigMap
    50  	// +required
    51  	Kind string `json:"kind"`
    52  
    53  	// Name of the values referent. Should reside in the same namespace as the
    54  	// referring resource.
    55  	// +kubebuilder:validation:MinLength=1
    56  	// +kubebuilder:validation:MaxLength=253
    57  	// +required
    58  	Name string `json:"name"`
    59  
    60  	// ValuesKey is the data key where the values.yaml or a specific value can be
    61  	// found at. Defaults to 'values.yaml'.
    62  	// When set, must be a valid Data Key, consisting of alphanumeric characters,
    63  	// '-', '_' or '.'.
    64  	// +kubebuilder:validation:MaxLength=253
    65  	// +kubebuilder:validation:Pattern=`^[\-._a-zA-Z0-9]+$`
    66  	// +optional
    67  	ValuesKey string `json:"valuesKey,omitempty"`
    68  
    69  	// TargetPath is the YAML dot notation path the value should be merged at. When
    70  	// set, the ValuesKey is expected to be a single flat value. Defaults to 'None',
    71  	// which results in the values getting merged at the root.
    72  	// +kubebuilder:validation:MaxLength=250
    73  	// +kubebuilder:validation:Pattern=`^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$`
    74  	// +optional
    75  	TargetPath string `json:"targetPath,omitempty"`
    76  
    77  	// Optional marks this ValuesReference as optional. When set, a not found error
    78  	// for the values reference is ignored, but any ValuesKey, TargetPath or
    79  	// transient error will still result in a reconciliation failure.
    80  	// +optional
    81  	Optional bool `json:"optional,omitempty"`
    82  }
    83  
    84  // GetValuesKey returns the defined ValuesKey, or the default ('values.yaml').
    85  func (in ValuesReference) GetValuesKey() string {
    86  	if in.ValuesKey == "" {
    87  		return "values.yaml"
    88  	}
    89  	return in.ValuesKey
    90  }
    91  

View as plain text