Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
liamfallon committed Dec 16, 2024
1 parent e915857 commit ffb078f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 432 deletions.
94 changes: 0 additions & 94 deletions api/porch/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,97 +530,3 @@ type PackageStatus struct {
// published package revision belonging to this package
LatestRevision string `json:"latestRevision,omitempty"`
}

// Function represents a kpt function discovered in a repository
// Function resources are created automatically by discovery in a registered Repository.
// Function resource names will be computed as <Repository Name>:<Function Name>
// to ensure uniqueness of names, and will follow formatting of
// [DNS Subdomain Names](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names).
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:openapi-gen=true
type Function struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec FunctionSpec `json:"spec,omitempty"`
Status FunctionStatus `json:"status,omitempty"`
}

// FunctionList
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type FunctionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []Function `json:"items"`
}

type FunctionType string

const (
FunctionTypeValidator FunctionType = "validator"
FunctionTypeMutator FunctionType = "mutator"
)

// FunctionSpec defines the desired state of a Function
type FunctionSpec struct {
// Image specifies the function image, such as 'gcr.io/kpt-fn/gatekeeper:v0.2'.
Image string `json:"image"`

// RepositoryRef references the repository in which the function is located.
RepositoryRef RepositoryRef `json:"repositoryRef"`

// FunctionType specifies the function types (mutator, validator or/and others).
FunctionTypes []FunctionType `json:"functionTypes,omitempty"`

FunctionConfigs []FunctionConfig `json:"functionConfigs,omitempty"`

// Keywords are used as filters to provide correlation in function discovery.
Keywords []string `json:"keywords,omitempty"`

// Description is a short description of the function.
Description string `json:"description"`

// `DocumentationUrl specifies the URL of comprehensive function documentation`
DocumentationUrl string `json:"documentationUrl,omitempty"`

// InputTypes specifies to which input KRM types the function applies. Specified as Group Version Kind.
// For example:
//
// inputTypes:
// - kind: RoleBinding
// # If version is unspecified, applies to all versions
// apiVersion: rbac.authorization.k8s.io
// - kind: ClusterRoleBinding
// apiVersion: rbac.authorization.k8s.io/v1
// InputTypes []metav1.TypeMeta

// OutputTypes specifies types of any KRM resources the function creates
// For example:
//
// outputTypes:
// - kind: ConfigMap
// apiVersion: v1
// OutputTypes []metav1.TypeMeta

}

// FunctionConfig specifies all the valid types of the function config for this function.
// If unspecified, defaults to v1/ConfigMap. For example, function `set-namespace` accepts both `ConfigMap` and `SetNamespace`
type FunctionConfig struct {
metav1.TypeMeta `json:",inline"`
// Experimental: requiredFields tells necessary fields and is aimed to help users write the FunctionConfig.
// Otherwise, users can get the required fields info from the function evaluation error message.
RequiredFields []string `json:"requiredFields,omitempty"`
}

// FunctionRef is a reference to a Function resource.
type FunctionRef struct {
// Name is the name of the Function resource referenced. The resource is expected to be within the same namespace.
Name string `json:"name"`
}

// FunctionStatus defines the observed state of Function
type FunctionStatus struct {
}
Loading

0 comments on commit ffb078f

Please sign in to comment.