Initial v1.0.0 commit

This commit is contained in:
Jakub Vavřík
2021-01-28 17:37:47 +01:00
commit 1481d27782
4164 changed files with 1264675 additions and 0 deletions

View File

@@ -0,0 +1,265 @@
package v1alpha1
import (
"fmt"
"strings"
"github.com/rancher/wrangler/pkg/genericcondition"
"github.com/rancher/wrangler/pkg/summary"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
)
var (
Ready BundleState = "Ready"
NotReady BundleState = "NotReady"
WaitApplied BundleState = "WaitApplied"
ErrApplied BundleState = "ErrApplied"
OutOfSync BundleState = "OutOfSync"
Pending BundleState = "Pending"
Modified BundleState = "Modified"
StateRank = map[BundleState]int{
ErrApplied: 7,
WaitApplied: 6,
Modified: 5,
OutOfSync: 4,
Pending: 3,
NotReady: 2,
Ready: 1,
}
)
type BundleState string
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Bundle struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BundleSpec `json:"spec"`
Status BundleStatus `json:"status"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type BundleNamespaceMapping struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
BundleSelector *metav1.LabelSelector `json:"bundleSelector,omitempty"`
NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"`
}
type BundleSpec struct {
BundleDeploymentOptions
Paused bool `json:"paused,omitempty"`
RolloutStrategy *RolloutStrategy `json:"rolloutStrategy,omitempty"`
Resources []BundleResource `json:"resources,omitempty"`
Overlays []BundleOverlay `json:"overlays,omitempty"`
Targets []BundleTarget `json:"targets,omitempty"`
TargetRestrictions []BundleTargetRestriction `json:"targetRestrictions,omitempty"`
}
type BundleResource struct {
Name string `json:"name,omitempty"`
Content string `json:"content,omitempty"`
Encoding string `json:"encoding,omitempty"`
}
type RolloutStrategy struct {
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
MaxUnavailablePartitions *intstr.IntOrString `json:"maxUnavailablePartitions,omitempty"`
AutoPartitionSize *intstr.IntOrString `json:"autoPartitionSize,omitempty"`
Partitions []Partition `json:"partitions,omitempty"`
}
type Partition struct {
Name string `json:"name,omitempty"`
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"`
ClusterGroup string `json:"clusterGroup,omitempty"`
ClusterGroupSelector *metav1.LabelSelector `json:"clusterGroupSelector,omitempty"`
}
type BundleOverlay struct {
BundleDeploymentOptions
Name string `json:"name,omitempty"`
Overlays []string `json:"overlays,omitempty"`
Resources []BundleResource `json:"resources,omitempty"`
}
type BundleTargetRestriction struct {
Name string `json:"name,omitempty"`
ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"`
ClusterGroup string `json:"clusterGroup,omitempty"`
ClusterGroupSelector *metav1.LabelSelector `json:"clusterGroupSelector,omitempty"`
}
type BundleTarget struct {
BundleDeploymentOptions
Name string `json:"name,omitempty"`
ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"`
ClusterGroup string `json:"clusterGroup,omitempty"`
ClusterGroupSelector *metav1.LabelSelector `json:"clusterGroupSelector,omitempty"`
Overlays []string `json:"overlays,omitempty"`
}
type BundleSummary struct {
NotReady int `json:"notReady,omitempty"`
WaitApplied int `json:"waitApplied,omitempty"`
ErrApplied int `json:"errApplied,omitempty"`
OutOfSync int `json:"outOfSync,omitempty"`
Modified int `json:"modified,omitempty"`
Ready int `json:"ready"`
Pending int `json:"pending,omitempty"`
DesiredReady int `json:"desiredReady"`
NonReadyResources []NonReadyResource `json:"nonReadyResources,omitempty"`
}
type NonReadyResource struct {
Name string `json:"name,omitempty"`
State BundleState `json:"bundleState,omitempty"`
Message string `json:"message,omitempty"`
}
var (
BundleConditionReady = "Ready"
BundleDeploymentConditionReady = "Ready"
BundleDeploymentConditionDeployed = "Deployed"
)
type BundleStatus struct {
Conditions []genericcondition.GenericCondition `json:"conditions,omitempty"`
Summary BundleSummary `json:"summary,omitempty"`
NewlyCreated int `json:"newlyCreated,omitempty"`
Unavailable int `json:"unavailable,omitempty"`
UnavailablePartitions int `json:"unavailablePartitions,omitempty"`
MaxUnavailable int `json:"maxUnavailable,omitempty"`
MaxUnavailablePartitions int `json:"maxUnavailablePartitions,omitempty"`
MaxNew int `json:"maxNew,omitempty"`
PartitionStatus []PartitionStatus `json:"partitions,omitempty"`
Display BundleDisplay `json:"display,omitempty"`
}
type BundleDisplay struct {
ReadyClusters string `json:"readyClusters,omitempty"`
State string `json:"state,omitempty"`
}
type PartitionStatus struct {
Name string `json:"name,omitempty"`
Count int `json:"count,omitempty"`
MaxUnavailable int `json:"maxUnavailable,omitempty"`
Unavailable int `json:"unavailable,omitempty"`
Summary BundleSummary `json:"summary,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type BundleDeployment struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BundleDeploymentSpec `json:"spec,omitempty"`
Status BundleDeploymentStatus `json:"status,omitempty"`
}
type BundleDeploymentOptions struct {
DefaultNamespace string `json:"namespace,omitempty"`
KustomizeDir string `json:"kustomizeDir,omitempty"`
TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
Values *GenericMap `json:"values,omitempty"`
ServiceAccount string `json:"serviceAccount,omitempty"`
Force bool `json:"force,omitempty"`
TakeOwnership bool `json:"takeOwnership,omitempty"`
}
type BundleDeploymentSpec struct {
StagedOptions BundleDeploymentOptions `json:"stagedOptions,omitempty"`
StagedDeploymentID string `json:"stagedDeploymentID,omitempty"`
Options BundleDeploymentOptions `json:"options,omitempty"`
DeploymentID string `json:"deploymentID,omitempty"`
}
type BundleDeploymentStatus struct {
Conditions []genericcondition.GenericCondition `json:"conditions,omitempty"`
AppliedDeploymentID string `json:"appliedDeploymentID,omitempty"`
Release string `json:"release,omitempty"`
Ready bool `json:"ready,omitempty"`
NonModified bool `json:"nonModified,omitempty"`
NonReadyStatus []NonReadyStatus `json:"nonReadyStatus,omitempty"`
ModifiedStatus []ModifiedStatus `json:"modifiedStatus,omitempty"`
Display BundleDeploymentDisplay `json:"display,omitempty"`
}
type BundleDeploymentDisplay struct {
Deployed string `json:"deployed,omitempty"`
Monitored string `json:"monitored,omitempty"`
State string `json:"state,omitempty"`
}
type NonReadyStatus struct {
UID types.UID `json:"uid,omitempty"`
Kind string `json:"kind,omitempty"`
APIVersion string `json:"apiVersion,omitempty"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
Summary summary.Summary `json:"summary,omitempty"`
}
func (in NonReadyStatus) String() string {
return name(in.APIVersion, in.Kind, in.Namespace, in.Name) + " " + in.Summary.String()
}
func name(apiVersion, kind, namespace, name string) string {
if apiVersion == "" {
if namespace == "" {
return fmt.Sprintf("%s %s", strings.ToLower(kind), name)
}
return fmt.Sprintf("%s %s/%s", strings.ToLower(kind), namespace, name)
}
if namespace == "" {
return fmt.Sprintf("%s.%s %s", strings.ToLower(kind), strings.SplitN(apiVersion, "/", 2)[0], name)
}
return fmt.Sprintf("%s.%s %s/%s", strings.ToLower(kind), strings.SplitN(apiVersion, "/", 2)[0], namespace, name)
}
type ModifiedStatus struct {
Kind string `json:"kind,omitempty"`
APIVersion string `json:"apiVersion,omitempty"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
Create bool `json:"missing,omitempty"`
Delete bool `json:"delete,omitempty"`
Patch string `json:"patch,omitempty"`
}
func (in ModifiedStatus) String() string {
msg := name(in.APIVersion, in.Kind, in.Namespace, in.Name)
if in.Create {
return msg + " missing"
} else if in.Delete {
return msg + " extra"
}
return msg + " modified"
}
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Content struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Content []byte `json:"content,omitempty"`
}

View File

@@ -0,0 +1,21 @@
/*
Copyright 2020 Rancher Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// +k8s:deepcopy-gen=package
// +groupName=fleet.cattle.io
package v1alpha1

View File

@@ -0,0 +1,78 @@
package v1alpha1
import (
"github.com/rancher/wrangler/pkg/genericcondition"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type GitRepo struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec GitRepoSpec `json:"spec,omitempty"`
Status GitRepoStatus `json:"status,omitempty"`
}
type GitRepoSpec struct {
// Repo is a URL to a git repo to clone and index
Repo string `json:"repo,omitempty"`
// Branch The git branch to follow
Branch string `json:"branch,omitempty"`
// Revision A specific commit or tag to operate on
Revision string `json:"revision,omitempty"`
// ClientSecretName is the client secret to be used to connect to the repo
// It is expected the secret be of type "kubernetes.io/basic-auth" or "kubernetes.io/ssh-auth".
ClientSecretName string `json:"clientSecretName,omitempty"`
// BundleDirs is the directories relative to the git repo root that contain bundles to be applied.
// Path globbing is support, for example ["bundles/*"] will match all folders as a subdirectory of bundles/
// If empty, "/" is the default
BundleDirs []string `json:"bundleDirs,omitempty"`
// ServiceAccount used in the downstream cluster for deployment
ServiceAccount string `json:"serviceAccount,omitempty"`
// Targets is a list of target this repo will deploy to
Targets []GitTarget `json:"targets,omitempty"`
}
type GitTarget struct {
Name string `json:"name,omitempty"`
ClusterSelector *metav1.LabelSelector `json:"clusterSelector,omitempty"`
ClusterGroup string `json:"clusterGroup,omitempty"`
ClusterGroupSelector *metav1.LabelSelector `json:"clusterGroupSelector,omitempty"`
}
type GitRepoStatus struct {
ObservedGeneration int64 `json:"observedGeneration"`
Commit string `json:"commit,omitempty"`
Summary BundleSummary `json:"summary,omitempty"`
Display GitRepoDisplay `json:"display,omitempty"`
Conditions []genericcondition.GenericCondition `json:"conditions,omitempty"`
}
type GitRepoDisplay struct {
ReadyBundleDeployments string `json:"readyBundleDeployments,omitempty"`
State string `json:"state,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type GitRepoRestriction struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
DefaultServiceAccount string `json:"defaultServiceAccount,omitempty"`
AllowedServiceAccounts []string `json:"allowedServiceAccounts,omitempty"`
AllowedRepoPatterns []string `json:"allowedRepoPatterns,omitempty"`
DefaultClientSecretName string `json:"defaultClientSecretName,omitempty"`
AllowedClientSecretNames []string `json:"allowedClientSecretNames,omitempty"`
}

View File

@@ -0,0 +1,136 @@
package v1alpha1
import (
"github.com/rancher/wrangler/pkg/genericcondition"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
var (
ClusterConditionReady = "Ready"
ClusterGroupAnnotation = "fleet.cattle.io/cluster-group"
ClusterGroupNamespaceAnnotation = "fleet.cattle.io/cluster-group-namespace"
ClusterNamespaceAnnotation = "fleet.cattle.io/cluster-namespace"
ClusterAnnotation = "fleet.cattle.io/cluster"
TTLSecondsAnnotation = "fleet.cattle.io/ttl-seconds"
ManagedAnnotation = "fleet.cattle.io/managed"
AnnotationGroup = "fleet.cattle.io/"
BootstrapToken = "fleet.cattle.io/bootstrap-token"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterGroup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ClusterGroupSpec `json:"spec"`
Status ClusterGroupStatus `json:"status"`
}
type ClusterGroupSpec struct {
Selector *metav1.LabelSelector `json:"selector,omitempty"`
}
type ClusterGroupStatus struct {
ClusterCount int `json:"clusterCount"`
NonReadyClusterCount int `json:"nonReadyClusterCount"`
NonReadyClusters []string `json:"nonReadyClusters,omitempty"`
Conditions []genericcondition.GenericCondition `json:"conditions,omitempty"`
Summary BundleSummary `json:"summary,omitempty"`
Display ClusterGroupDisplay `json:"display,omitempty"`
}
type ClusterGroupDisplay struct {
ReadyClusters string `json:"readyClusters,omitempty"`
ReadyBundles string `json:"readyBundles,omitempty"`
State string `json:"state,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Cluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ClusterSpec `json:"spec,omitempty"`
Status ClusterStatus `json:"status,omitempty"`
}
type ClusterSpec struct {
Paused bool `json:"paused,omitempty"`
ClientID string `json:"clientID,omitempty"`
KubeConfigSecret string `json:"kubeConfigSecret,omitempty"`
}
type ClusterStatus struct {
Conditions []genericcondition.GenericCondition `json:"conditions,omitempty"`
Namespace string `json:"namespace,omitempty"`
Summary BundleSummary `json:"summary,omitempty"`
AgentDeployed *bool `json:"agentDeployed,omitempty"`
Display ClusterDisplay `json:"display,omitempty"`
Agent AgentStatus `json:"agent,omitempty"`
}
type ClusterDisplay struct {
ReadyBundles string `json:"readyBundles,omitempty"`
ReadyNodes string `json:"readyNodes,omitempty"`
SampleNode string `json:"sampleNode,omitempty"`
State string `json:"state,omitempty"`
}
type AgentStatus struct {
LastSeen metav1.Time `json:"lastSeen,omitempty"`
Namespace string `json:"namespace,omitempty"`
NonReadyNodes int `json:"nonReadyNodes,omitempty"`
ReadyNodes int `json:"readyNodes,omitempty"`
// At most 3 nodes
NonReadyNodeNames []string `json:"nonReadyNodeNames,omitempty"`
// At most 3 nodes
ReadyNodeNames []string `json:"readyNodeNames,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterRegistration struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ClusterRegistrationSpec `json:"spec,omitempty"`
Status ClusterRegistrationStatus `json:"status,omitempty"`
}
type ClusterRegistrationSpec struct {
ClientID string `json:"clientID,omitempty"`
ClientRandom string `json:"clientRandom,omitempty"`
ClusterLabels map[string]string `json:"clusterLabels,omitempty"`
}
type ClusterRegistrationStatus struct {
ClusterName string `json:"clusterName,omitempty"`
Granted bool `json:"granted,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ClusterRegistrationToken struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ClusterRegistrationTokenSpec `json:"spec,omitempty"`
Status ClusterRegistrationTokenStatus `json:"status,omitempty"`
}
type ClusterRegistrationTokenSpec struct {
TTLSeconds int `json:"ttlSeconds,omitempty"`
}
type ClusterRegistrationTokenStatus struct {
Expires metav1.Time `json:"expires,omitempty"`
SecretName string `json:"secretName,omitempty"`
}

View File

@@ -0,0 +1,26 @@
package v1alpha1
import (
"encoding/json"
"github.com/rancher/wrangler/pkg/data/convert"
)
type GenericMap struct {
Data map[string]interface{} `json:"-"`
}
func (in GenericMap) MarshalJSON() ([]byte, error) {
return json.Marshal(in.Data)
}
func (in *GenericMap) UnmarshalJSON(data []byte) error {
in.Data = map[string]interface{}{}
return json.Unmarshal(data, &in.Data)
}
func (in *GenericMap) DeepCopyInto(out *GenericMap) {
if err := convert.ToObj(in.Data, &out.Data); err != nil {
panic(err)
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,195 @@
/*
Copyright 2020 Rancher Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// +k8s:deepcopy-gen=package
// +groupName=fleet.cattle.io
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// BundleList is a list of Bundle resources
type BundleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []Bundle `json:"items"`
}
func NewBundle(namespace, name string, obj Bundle) *Bundle {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("Bundle").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// BundleDeploymentList is a list of BundleDeployment resources
type BundleDeploymentList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []BundleDeployment `json:"items"`
}
func NewBundleDeployment(namespace, name string, obj BundleDeployment) *BundleDeployment {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("BundleDeployment").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// BundleNamespaceMappingList is a list of BundleNamespaceMapping resources
type BundleNamespaceMappingList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []BundleNamespaceMapping `json:"items"`
}
func NewBundleNamespaceMapping(namespace, name string, obj BundleNamespaceMapping) *BundleNamespaceMapping {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("BundleNamespaceMapping").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ClusterList is a list of Cluster resources
type ClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []Cluster `json:"items"`
}
func NewCluster(namespace, name string, obj Cluster) *Cluster {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("Cluster").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ClusterGroupList is a list of ClusterGroup resources
type ClusterGroupList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []ClusterGroup `json:"items"`
}
func NewClusterGroup(namespace, name string, obj ClusterGroup) *ClusterGroup {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("ClusterGroup").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ClusterRegistrationList is a list of ClusterRegistration resources
type ClusterRegistrationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []ClusterRegistration `json:"items"`
}
func NewClusterRegistration(namespace, name string, obj ClusterRegistration) *ClusterRegistration {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("ClusterRegistration").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ClusterRegistrationTokenList is a list of ClusterRegistrationToken resources
type ClusterRegistrationTokenList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []ClusterRegistrationToken `json:"items"`
}
func NewClusterRegistrationToken(namespace, name string, obj ClusterRegistrationToken) *ClusterRegistrationToken {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("ClusterRegistrationToken").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ContentList is a list of Content resources
type ContentList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []Content `json:"items"`
}
func NewContent(namespace, name string, obj Content) *Content {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("Content").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// GitRepoList is a list of GitRepo resources
type GitRepoList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []GitRepo `json:"items"`
}
func NewGitRepo(namespace, name string, obj GitRepo) *GitRepo {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("GitRepo").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// GitRepoRestrictionList is a list of GitRepoRestriction resources
type GitRepoRestrictionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []GitRepoRestriction `json:"items"`
}
func NewGitRepoRestriction(namespace, name string, obj GitRepoRestriction) *GitRepoRestriction {
obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("GitRepoRestriction").ToAPIVersionAndKind()
obj.Name = name
obj.Namespace = namespace
return &obj
}

View File

@@ -0,0 +1,87 @@
/*
Copyright 2020 Rancher Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
// +k8s:deepcopy-gen=package
// +groupName=fleet.cattle.io
package v1alpha1
import (
fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
BundleResourceName = "bundles"
BundleDeploymentResourceName = "bundledeployments"
BundleNamespaceMappingResourceName = "bundlenamespacemappings"
ClusterResourceName = "clusters"
ClusterGroupResourceName = "clustergroups"
ClusterRegistrationResourceName = "clusterregistrations"
ClusterRegistrationTokenResourceName = "clusterregistrationtokens"
ContentResourceName = "contents"
GitRepoResourceName = "gitrepos"
GitRepoRestrictionResourceName = "gitreporestrictions"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: fleet.GroupName, Version: "v1alpha1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&Bundle{},
&BundleList{},
&BundleDeployment{},
&BundleDeploymentList{},
&BundleNamespaceMapping{},
&BundleNamespaceMappingList{},
&Cluster{},
&ClusterList{},
&ClusterGroup{},
&ClusterGroupList{},
&ClusterRegistration{},
&ClusterRegistrationList{},
&ClusterRegistrationToken{},
&ClusterRegistrationTokenList{},
&Content{},
&ContentList{},
&GitRepo{},
&GitRepoList{},
&GitRepoRestriction{},
&GitRepoRestrictionList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@@ -0,0 +1,24 @@
/*
Copyright 2020 Rancher Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by main. DO NOT EDIT.
package fleet
const (
// Package-wide consts from generator "zz_generated_register".
GroupName = "fleet.cattle.io"
)