github.com/banzaicloud/operator-tools@v0.28.10/pkg/secret/secret_types.go (about)

     1  // Copyright © 2020 Banzai Cloud
     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 secret
    16  
    17  import (
    18  	corev1 "k8s.io/api/core/v1"
    19  )
    20  
    21  //nolint:unused,deadcode
    22  // +docName:"Secret abstraction"
    23  // Provides an abstraction to refer to secrets from other types
    24  // SecretLoader facilitates loading the secrets from an operator.
    25  // Leverages core types from kubernetes/api/core/v1
    26  type _docSecret interface{}
    27  
    28  //nolint:unused,deadcode
    29  // +name:"Secret"
    30  // +description:"Secret referencing abstraction"
    31  type _metaSecret interface{}
    32  
    33  // +kubebuilder:object:generate=true
    34  
    35  type Secret struct {
    36  	// Refers to a non-secret value
    37  	Value     string     `json:"value,omitempty"`
    38  	// Refers to a secret value to be used directly
    39  	ValueFrom *ValueFrom `json:"valueFrom,omitempty"`
    40  	// Refers to a secret value to be used through a volume mount
    41  	MountFrom *ValueFrom `json:"mountFrom,omitempty"`
    42  }
    43  
    44  // +kubebuilder:object:generate=true
    45  
    46  type ValueFrom struct {
    47  	SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
    48  }