k8c.io/api/v3@v3.0.0-20230904060738-b0a93889c0b6/pkg/apis/open-policy-agent/types.go (about)

     1  /*
     2  Copyright 2023 The Kubermatic Kubernetes Platform contributors.
     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 openpolicyagent
    18  
    19  import (
    20  	apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
    21  )
    22  
    23  type CRD struct {
    24  	Spec CRDSpec `json:"spec,omitempty"`
    25  }
    26  
    27  type CRDSpec struct {
    28  	Names Names `json:"names,omitempty"`
    29  	// +kubebuilder:default={legacySchema: false}
    30  	Validation *Validation `json:"validation,omitempty"`
    31  }
    32  
    33  type Names struct {
    34  	Kind       string   `json:"kind,omitempty"`
    35  	ShortNames []string `json:"shortNames,omitempty"`
    36  }
    37  
    38  type Validation struct {
    39  	// +kubebuilder:validation:Schemaless
    40  	// +kubebuilder:validation:Type=object
    41  	// +kubebuilder:pruning:PreserveUnknownFields
    42  	OpenAPIV3Schema *apiextensionsv1.JSONSchemaProps `json:"openAPIV3Schema,omitempty"`
    43  	// +kubebuilder:default=false
    44  	LegacySchema *bool `json:"legacySchema,omitempty"` // *bool allows for "unset" state which we need to apply appropriate defaults
    45  }
    46  
    47  type Target struct {
    48  	Target string   `json:"target,omitempty"`
    49  	Rego   string   `json:"rego,omitempty"`
    50  	Libs   []string `json:"libs,omitempty"`
    51  }