Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update channel API description #86

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions deploy/crds/apps.open-cluster-management.io_channels_crd.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: channels.apps.open-cluster-management.io
spec:
group: apps.open-cluster-management.io
Expand All @@ -26,7 +29,10 @@ spec:
name: v1
schema:
openAPIV3Schema:
description: Channel is the Schema for the channels API
description: 'Channel provides a repository containing application resources
which can be deployed to clusters by subscriptions. The following 3 types
of channels are supported: Git repository, Helm release registry, and Object
storage repository.'
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -82,15 +88,16 @@ spec:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
x-kubernetes-map-type: atomic
gates:
description: Criteria for promoting a Deployable from the sourceNamespaces
to Channel.
description: ChannelGate defines a criteria for promoting a Deployable
from the sourceNamespaces to Channel.
properties:
annotations:
additionalProperties:
type: string
description: The annotations which must present on a Deployable
for it to be eligible for promotion.
description: The annotations for selecting the Deployables to
be eligible for promotion.
type: object
labelSelector:
description: A label selector for selecting the Deployables.
Expand Down Expand Up @@ -136,6 +143,7 @@ spec:
"value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
name:
type: string
type: object
Expand All @@ -144,17 +152,16 @@ spec:
channel.
type: boolean
pathname:
description: For a `namespace` channel, pathname is the name of the
namespace; For a `helmrepo` or `github` channel, pathname is the
remote URL for the channel contents; For a `objectbucket` channel,
pathname is the URL and name of the bucket.
description: For a `helmrepo` or `github` channel, pathname is the
repo URL. For a `objectbucket` channel, pathname is the Object store
URL with the name of the bucket.
type: string
secretRef:
description: For a `github` channel or a `helmrepo` channel on github,
this can be used to reference a Secret which contains the credentials
for authentication, i.e. `user` and `accessToken`. For a `objectbucket`
channel, this can be used to reference a Secret which contains the
AWS credentials, i.e. `AccessKeyID` and `SecretAccessKey`.
description: 'For a `github` channel or a `helmrepo` channel on github,
use this to reference a secret which contains the credentials for
authentication, for example: `user` and `accessToken`. For a `objectbucket`
channel, use this to reference a secret which contains the AWS credentials,
for example: `AccessKeyID`,`SecretAccessKey` and `Region`.'
properties:
apiVersion:
description: API version of the referent.
Expand Down Expand Up @@ -189,14 +196,16 @@ spec:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
x-kubernetes-map-type: atomic
sourceNamespaces:
description: A list of namespace names from which Deployables can
be promoted.
items:
type: string
type: array
x-kubernetes-list-type: set
type:
description: ChannelType defines types of channel
description: ChannelType defines a type of channel
enum:
- Namespace
- HelmRepo
Expand Down
47 changes: 20 additions & 27 deletions pkg/apis/apps/v1/channel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ var (
ServingChannel = SchemeGroupVersion.Group + "/serving-channel"
)

// ChannelType defines types of channel
// ChannelType defines a type of channel
type ChannelType string

const (
// Type defines type name of namespace channel
// ChannelTypeNamespace represents the type of namespace channel
ChannelTypeNamespace = "namespace"

// Type defines type name of helm repository channel
// ChannelTypeHelmRepo represents the type of helm repository channel
ChannelTypeHelmRepo = "helmrepo"

// Type defines type name of bucket in object store
// ChannelTypeObjectBucket represents the type of object store channel
ChannelTypeObjectBucket = "objectbucket"

// Type defines type name of GitHub repository
// ChannelTypeGitHub represents the type of GitHub repository channel
ChannelTypeGitHub = "github"

// Type defines type name of Git repository
// ChannelTypeGit represents the type of GitHub repository channel
ChannelTypeGit = "git"

// TLS minimum version as integer
Expand All @@ -66,51 +66,43 @@ const (
TLSMinVersionString = "1.2"
)

// ChannelGate defines criteria for promoting a Deployable to Channel
// ChannelGate defines a criteria for promoting a Deployable from the sourceNamespaces to Channel.
type ChannelGate struct {
Name string `json:"name,omitempty"`

// A label selector for selecting the Deployables.
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`

// The annotations which must present on a Deployable for it to be
// eligible for promotion.
// The annotations for selecting the Deployables to be eligible for promotion.
Annotations map[string]string `json:"annotations,omitempty"`
}

// ChannelSpec defines the desired state of Channel
type ChannelSpec struct {
// A string representation of the channel type. Valid values include:
// `namespace`, `helmrepo`, `objectbucket` and `github`.
// `helmrepo`, `objectbucket` and `github`.

// +kubebuilder:validation:Enum={Namespace,HelmRepo,ObjectBucket,GitHub,Git,namespace,helmrepo,objectbucket,github,git}
Type ChannelType `json:"type"`

// For a `namespace` channel, pathname is the name of the namespace;
// For a `helmrepo` or `github` channel, pathname is the remote URL
// for the channel contents;
// For a `objectbucket` channel, pathname is the URL and name of the bucket.
// For a `helmrepo` or `github` channel, pathname is the repo URL.
// For a `objectbucket` channel, pathname is the Object store URL with the name of the bucket.
Pathname string `json:"pathname"`

// Skip server TLS certificate verification for Git or Helm channel.
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`

// For a `github` channel or a `helmrepo` channel on github, this
// can be used to reference a Secret which contains the credentials for
// authentication, i.e. `user` and `accessToken`.
// For a `objectbucket` channel, this can be used to reference a
// Secret which contains the AWS credentials, i.e. `AccessKeyID` and
// `SecretAccessKey`.
// For a `github` channel or a `helmrepo` channel on github,
xiangjingli marked this conversation as resolved.
Show resolved Hide resolved
// use this to reference a secret which contains the credentials for authentication, for example: `user` and `accessToken`.
// For a `objectbucket` channel,
// use this to reference a secret which contains the AWS credentials, for example: `AccessKeyID`,`SecretAccessKey` and `Region`.
// +optional
SecretRef *corev1.ObjectReference `json:"secretRef,omitempty"`

// Reference to a ConfigMap which contains additional settings for
// accessing the channel. For example, the `insecureSkipVerify` option
// for accessing HTTPS endpoints can be set in the ConfigMap to
// indicate a insecure connection.
// Reference to a ConfigMap which contains additional settings for accessing the channel.
// For example, the `insecureSkipVerify` option for accessing HTTPS endpoints can be set in the ConfigMap to indicate a insecure connection.
ConfigMapRef *corev1.ObjectReference `json:"configMapRef,omitempty"`

// Criteria for promoting a Deployable from the sourceNamespaces to Channel.
// +optional
Gates *ChannelGate `json:"gates,omitempty"`

Expand All @@ -127,7 +119,8 @@ type ChannelStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Channel is the Schema for the channels API
// Channel provides a repository containing application resources which can be deployed to clusters by subscriptions.
// The following 3 types of channels are supported: Git repository, Helm release registry, and Object storage repository.
// +k8s:openapi-gen=true
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type",description="type of the channel"
// +kubebuilder:printcolumn:name="Pathname",type="string",JSONPath=".spec.pathname",description="pathname of the channel"
Expand All @@ -147,7 +140,7 @@ type Channel struct {

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ChannelList contains a list of Channel
// ChannelList provides a list of channels
type ChannelList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
Loading