-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cli API for CLIPlugin and also changes to reflect the changes don…
…e related to k8s API dependency in tanzu-plugin-runtime module - Add cli API for CLIPlugin (migrate apis/cli module from tanzu-framework to tanzu-cli) - Changes to reflect the changes done related to removal of k8s API dependency in tanzu-plugin-runtime module Signed-off-by: Prem Kumar Kalle <pkalle@vmware.com>
- Loading branch information
Showing
57 changed files
with
878 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright 2021 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
configtypes "github.com/vmware-tanzu/tanzu-plugin-runtime/config/types" | ||
) | ||
|
||
// ArtifactList contains an Artifact object for every supported platform of a version. | ||
type ArtifactList []Artifact | ||
|
||
// Artifact points to an individual plugin binary specific to a version and platform. | ||
type Artifact struct { | ||
// Image is a fully qualified OCI image for the plugin binary. | ||
Image string `json:"image,omitempty"` | ||
// AssetURI is a URI of the plugin binary. This can be a fully qualified HTTP path or a local path. | ||
URI string `json:"uri,omitempty"` | ||
// SHA256 hash of the plugin binary. | ||
Digest string `json:"digest,omitempty"` | ||
// Type of the binary artifact. Valid values are S3, GCP, OCIImage. | ||
Type string `json:"type"` | ||
// OS of the plugin binary in `GOOS` format. | ||
OS string `json:"os"` | ||
// Arch is CPU architecture of the plugin binary in `GOARCH` format. | ||
Arch string `json:"arch"` | ||
} | ||
|
||
// CLIPluginSpec defines the desired state of CLIPlugin. | ||
type CLIPluginSpec struct { | ||
// Description is the plugin's description. | ||
Description string `json:"description"` | ||
// Recommended version that Tanzu CLI should use if available. | ||
// The value should be a valid semantic version as defined in | ||
// https://semver.org/. E.g., 2.0.1 | ||
RecommendedVersion string `json:"recommendedVersion"` | ||
// Artifacts contains an artifact list for every supported version. | ||
Artifacts map[string]ArtifactList `json:"artifacts"` | ||
// Optional specifies whether the plugin is mandatory or optional | ||
// If optional, the plugin will not get auto-downloaded as part of | ||
// `tanzu login` or `tanzu plugin sync` command | ||
// To view the list of plugin, user can use `tanzu plugin list` and | ||
// to download a specific plugin run, `tanzu plugin install <plugin-name>` | ||
Optional bool `json:"optional"` | ||
// Target specifies the target of the plugin. Only needed for standalone plugins | ||
Target configtypes.Target `json:"target,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// CLIPlugin denotes a Tanzu cli plugin. | ||
type CLIPlugin struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata"` | ||
Spec CLIPluginSpec `json:"spec"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// CLIPluginList contains a list of CLIPlugin | ||
type CLIPluginList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []CLIPlugin `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&CLIPlugin{}, &CLIPluginList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2021 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Package v1alpha1 contains API Schema definitions for the cli v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=cli.tanzu.vmware.com | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "cli.tanzu.vmware.com", Version: "v1alpha1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
|
||
// GroupVersionKindCLIPlugin has information about group, version and kind of CLIPlugin object. | ||
GroupVersionKindCLIPlugin = GroupVersion.WithKind("CLIPlugin") | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
107 changes: 107 additions & 0 deletions
107
apis/config/crd/bases/cli.tanzu.vmware.com_cliplugins.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.9.2 | ||
creationTimestamp: null | ||
name: cliplugins.cli.tanzu.vmware.com | ||
spec: | ||
group: cli.tanzu.vmware.com | ||
names: | ||
kind: CLIPlugin | ||
listKind: CLIPluginList | ||
plural: cliplugins | ||
singular: cliplugin | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: CLIPlugin denotes a Tanzu cli plugin. | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: CLIPluginSpec defines the desired state of CLIPlugin. | ||
properties: | ||
artifacts: | ||
additionalProperties: | ||
description: ArtifactList contains an Artifact object for every | ||
supported platform of a version. | ||
items: | ||
description: Artifact points to an individual plugin binary specific | ||
to a version and platform. | ||
properties: | ||
arch: | ||
description: Arch is CPU architecture of the plugin binary | ||
in `GOARCH` format. | ||
type: string | ||
digest: | ||
description: SHA256 hash of the plugin binary. | ||
type: string | ||
image: | ||
description: Image is a fully qualified OCI image for the | ||
plugin binary. | ||
type: string | ||
os: | ||
description: OS of the plugin binary in `GOOS` format. | ||
type: string | ||
type: | ||
description: Type of the binary artifact. Valid values are | ||
S3, GCP, OCIImage. | ||
type: string | ||
uri: | ||
description: AssetURI is a URI of the plugin binary. This | ||
can be a fully qualified HTTP path or a local path. | ||
type: string | ||
required: | ||
- arch | ||
- os | ||
- type | ||
type: object | ||
type: array | ||
description: Artifacts contains an artifact list for every supported | ||
version. | ||
type: object | ||
description: | ||
description: Description is the plugin's description. | ||
type: string | ||
optional: | ||
description: Optional specifies whether the plugin is mandatory or | ||
optional If optional, the plugin will not get auto-downloaded as | ||
part of `tanzu login` or `tanzu plugin sync` command To view the | ||
list of plugin, user can use `tanzu plugin list` and to download | ||
a specific plugin run, `tanzu plugin install <plugin-name>` | ||
type: boolean | ||
recommendedVersion: | ||
description: Recommended version that Tanzu CLI should use if available. | ||
The value should be a valid semantic version as defined in https://semver.org/. | ||
E.g., 2.0.1 | ||
type: string | ||
target: | ||
description: Target specifies the target of the plugin. Only needed | ||
for standalone plugins | ||
type: string | ||
required: | ||
- artifacts | ||
- description | ||
- optional | ||
- recommendedVersion | ||
type: object | ||
required: | ||
- metadata | ||
- spec | ||
type: object | ||
served: true | ||
storage: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.