mirror of
https://github.com/rancher/types.git
synced 2025-08-01 04:57:05 +00:00
Merge pull request #1112 from dramich/clusternaming
Add ObjClusterName to objects
This commit is contained in:
commit
106cadd1c6
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/types"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@ -19,6 +21,10 @@ type ClusterAlert struct {
|
||||
Status AlertStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (c *ClusterAlert) ObjClusterName() string {
|
||||
return c.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ProjectAlert struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -33,6 +39,10 @@ type ProjectAlert struct {
|
||||
Status AlertStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (p *ProjectAlert) ObjClusterName() string {
|
||||
return p.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type AlertCommonSpec struct {
|
||||
DisplayName string `json:"displayName,omitempty" norman:"required"`
|
||||
Description string `json:"description,omitempty"`
|
||||
@ -51,6 +61,10 @@ type ClusterAlertSpec struct {
|
||||
TargetEvent *TargetEvent `json:"targetEvent,omitempty"`
|
||||
}
|
||||
|
||||
func (c *ClusterAlertSpec) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type ProjectAlertSpec struct {
|
||||
AlertCommonSpec
|
||||
|
||||
@ -59,6 +73,13 @@ type ProjectAlertSpec struct {
|
||||
TargetPod *TargetPod `json:"targetPod,omitempty"`
|
||||
}
|
||||
|
||||
func (p *ProjectAlertSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Recipient struct {
|
||||
Recipient string `json:"recipient,omitempty"`
|
||||
NotifierName string `json:"notifierName,omitempty" norman:"required,type=reference[notifier]"`
|
||||
@ -113,6 +134,10 @@ type ClusterAlertGroup struct {
|
||||
Status AlertStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (c *ClusterAlertGroup) ObjClusterName() string {
|
||||
return c.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ProjectAlertGroup struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -127,18 +152,33 @@ type ProjectAlertGroup struct {
|
||||
Status AlertStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (p *ProjectAlertGroup) ObjClusterName() string {
|
||||
return p.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ClusterGroupSpec struct {
|
||||
ClusterName string `json:"clusterName" norman:"type=reference[cluster]"`
|
||||
Recipients []Recipient `json:"recipients,omitempty"`
|
||||
CommonGroupField
|
||||
}
|
||||
|
||||
func (c *ClusterGroupSpec) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type ProjectGroupSpec struct {
|
||||
ProjectName string `json:"projectName" norman:"type=reference[project]"`
|
||||
Recipients []Recipient `json:"recipients,omitempty"`
|
||||
CommonGroupField
|
||||
}
|
||||
|
||||
func (p *ProjectGroupSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ClusterAlertRule struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -153,6 +193,10 @@ type ClusterAlertRule struct {
|
||||
Status AlertStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (c *ClusterAlertRule) ObjClusterName() string {
|
||||
return c.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ClusterAlertRuleSpec struct {
|
||||
CommonRuleField
|
||||
ClusterName string `json:"clusterName" norman:"type=reference[cluster]"`
|
||||
@ -164,6 +208,10 @@ type ClusterAlertRuleSpec struct {
|
||||
ClusterScanRule *ClusterScanRule `json:"clusterScanRule,omitempty"`
|
||||
}
|
||||
|
||||
func (c *ClusterAlertRuleSpec) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type ProjectAlertRule struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -178,6 +226,10 @@ type ProjectAlertRule struct {
|
||||
Status AlertStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (p *ProjectAlertRule) ObjClusterName() string {
|
||||
return p.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ProjectAlertRuleSpec struct {
|
||||
CommonRuleField
|
||||
ProjectName string `json:"projectName" norman:"type=reference[project]"`
|
||||
@ -187,6 +239,13 @@ type ProjectAlertRuleSpec struct {
|
||||
MetricRule *MetricRule `json:"metricRule,omitempty"`
|
||||
}
|
||||
|
||||
func (p *ProjectAlertRuleSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CommonGroupField struct {
|
||||
DisplayName string `json:"displayName,omitempty" norman:"required"`
|
||||
Description string `json:"description,omitempty"`
|
||||
@ -263,6 +322,10 @@ type Notifier struct {
|
||||
Status NotifierStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (n *Notifier) ObjClusterName() string {
|
||||
return n.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type NotifierSpec struct {
|
||||
ClusterName string `json:"clusterName" norman:"type=reference[cluster]"`
|
||||
|
||||
@ -276,6 +339,10 @@ type NotifierSpec struct {
|
||||
WechatConfig *WechatConfig `json:"wechatConfig,omitempty"`
|
||||
}
|
||||
|
||||
func (n *NotifierSpec) ObjClusterName() string {
|
||||
return n.ClusterName
|
||||
}
|
||||
|
||||
type Notification struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
SMTPConfig *SMTPConfig `json:"smtpConfig,omitempty"`
|
||||
|
@ -29,6 +29,10 @@ type Token struct {
|
||||
Enabled *bool `json:"enabled,omitempty" norman:"default=true"`
|
||||
}
|
||||
|
||||
func (t *Token) ObjClusterName() string {
|
||||
return t.ClusterName
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@ -28,6 +30,10 @@ type Project struct {
|
||||
Status ProjectStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (p *Project) ObjClusterName() string {
|
||||
return p.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ProjectStatus struct {
|
||||
Conditions []ProjectCondition `json:"conditions"`
|
||||
PodSecurityPolicyTemplateName string `json:"podSecurityPolicyTemplateId"`
|
||||
@ -59,6 +65,10 @@ type ProjectSpec struct {
|
||||
EnableProjectMonitoring bool `json:"enableProjectMonitoring" norman:"default=false"`
|
||||
}
|
||||
|
||||
func (p *ProjectSpec) ObjClusterName() string {
|
||||
return p.ClusterName
|
||||
}
|
||||
|
||||
type GlobalRole struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@ -128,6 +138,13 @@ type ProjectRoleTemplateBinding struct {
|
||||
ServiceAccount string `json:"serviceAccount,omitempty" norman:"nocreate,noupdate"`
|
||||
}
|
||||
|
||||
func (p *ProjectRoleTemplateBinding) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ClusterRoleTemplateBinding struct {
|
||||
types.Namespaced
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
@ -141,6 +158,10 @@ type ClusterRoleTemplateBinding struct {
|
||||
RoleTemplateName string `json:"roleTemplateName,omitempty" norman:"required,type=reference[roleTemplate]"`
|
||||
}
|
||||
|
||||
func (c *ClusterRoleTemplateBinding) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type SetPodSecurityPolicyTemplateInput struct {
|
||||
PodSecurityPolicyTemplateName string `json:"podSecurityPolicyTemplateId" norman:"required,type=reference[podSecurityPolicyTemplate]"`
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@ -230,6 +232,13 @@ type ProjectCatalog struct {
|
||||
ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"`
|
||||
}
|
||||
|
||||
func (p *ProjectCatalog) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ClusterCatalog struct {
|
||||
types.Namespaced
|
||||
|
||||
|
@ -3,6 +3,7 @@ package v3
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
@ -212,10 +213,18 @@ type ClusterRegistrationToken struct {
|
||||
Status ClusterRegistrationTokenStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (c *ClusterRegistrationToken) ObjClusterName() string {
|
||||
return c.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ClusterRegistrationTokenSpec struct {
|
||||
ClusterName string `json:"clusterName" norman:"required,type=reference[cluster]"`
|
||||
}
|
||||
|
||||
func (c *ClusterRegistrationTokenSpec) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type ClusterRegistrationTokenStatus struct {
|
||||
InsecureCommand string `json:"insecureCommand"`
|
||||
Command string `json:"command"`
|
||||
@ -240,6 +249,13 @@ type ImportClusterYamlInput struct {
|
||||
ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"`
|
||||
}
|
||||
|
||||
func (i *ImportClusterYamlInput) ObjClusterName() string {
|
||||
if parts := strings.SplitN(i.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ImportYamlOutput struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@ -22,6 +24,10 @@ type ClusterLogging struct {
|
||||
Status ClusterLoggingStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (c *ClusterLogging) ObjClusterName() string {
|
||||
return c.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ProjectLogging struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -37,6 +43,10 @@ type ProjectLogging struct {
|
||||
Status ProjectLoggingStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (p *ProjectLogging) ObjClusterName() string {
|
||||
return p.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type LoggingCommonField struct {
|
||||
DisplayName string `json:"displayName,omitempty"`
|
||||
OutputFlushInterval int `json:"outputFlushInterval,omitempty" norman:"default=60"`
|
||||
@ -60,12 +70,23 @@ type ClusterLoggingSpec struct {
|
||||
IncludeSystemComponent *bool `json:"includeSystemComponent,omitempty" norman:"default=true"`
|
||||
}
|
||||
|
||||
func (c *ClusterLoggingSpec) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type ProjectLoggingSpec struct {
|
||||
LoggingTargets
|
||||
LoggingCommonField
|
||||
ProjectName string `json:"projectName" norman:"type=reference[project]"`
|
||||
}
|
||||
|
||||
func (p *ProjectLoggingSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ClusterLoggingStatus struct {
|
||||
Conditions []LoggingCondition `json:"conditions,omitempty"`
|
||||
AppliedSpec ClusterLoggingSpec `json:"appliedSpec,omitempty"`
|
||||
@ -183,8 +204,19 @@ type ClusterTestInput struct {
|
||||
OutputTags map[string]string `json:"outputTags,omitempty"`
|
||||
}
|
||||
|
||||
func (c *ClusterTestInput) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type ProjectTestInput struct {
|
||||
ProjectName string `json:"projectId" norman:"required,type=reference[project]"`
|
||||
LoggingTargets
|
||||
OutputTags map[string]string `json:"outputTags,omitempty"`
|
||||
}
|
||||
|
||||
func (p *ProjectTestInput) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -152,6 +152,10 @@ type NodePool struct {
|
||||
Status NodePoolStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (n *NodePool) ObjClusterName() string {
|
||||
return n.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type NodePoolSpec struct {
|
||||
Etcd bool `json:"etcd"`
|
||||
ControlPlane bool `json:"controlPlane"`
|
||||
@ -170,6 +174,10 @@ type NodePoolSpec struct {
|
||||
DeleteNotReadyAfterSecs time.Duration `json:"deleteNotReadyAfterSecs" norman:"default=0,max=31540000,min=0"`
|
||||
}
|
||||
|
||||
func (n *NodePoolSpec) ObjClusterName() string {
|
||||
return n.ClusterName
|
||||
}
|
||||
|
||||
type NodePoolStatus struct {
|
||||
Conditions []Condition `json:"conditions"`
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@ -47,6 +49,10 @@ type ClusterMonitorGraph struct {
|
||||
Spec ClusterMonitorGraphSpec `json:"spec"`
|
||||
}
|
||||
|
||||
func (c *ClusterMonitorGraph) ObjClusterName() string {
|
||||
return c.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ProjectMonitorGraph struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -58,6 +64,10 @@ type ProjectMonitorGraph struct {
|
||||
Spec ProjectMonitorGraphSpec `json:"spec"`
|
||||
}
|
||||
|
||||
func (p *ProjectMonitorGraph) ObjClusterName() string {
|
||||
return p.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type ClusterMonitorGraphSpec struct {
|
||||
ClusterName string `json:"clusterName" norman:"type=reference[cluster]"`
|
||||
ResourceType string `json:"resourceType,omitempty" norman:"type=enum,options=node|cluster|etcd|apiserver|scheduler|controllermanager|fluentd|istiocluster|istioproject"`
|
||||
@ -65,6 +75,10 @@ type ClusterMonitorGraphSpec struct {
|
||||
CommonMonitorGraphSpec
|
||||
}
|
||||
|
||||
func (c *ClusterMonitorGraphSpec) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type ProjectMonitorGraphSpec struct {
|
||||
ProjectName string `json:"projectName" norman:"type=reference[project]"`
|
||||
ResourceType string `json:"resourceType,omitempty" norman:"type=enum,options=workload|pod|container"`
|
||||
@ -72,6 +86,13 @@ type ProjectMonitorGraphSpec struct {
|
||||
CommonMonitorGraphSpec
|
||||
}
|
||||
|
||||
func (p *ProjectMonitorGraphSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CommonMonitorGraphSpec struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
MetricsSelector map[string]string `json:"metricsSelector,omitempty"`
|
||||
@ -136,11 +157,22 @@ type QueryClusterMetricInput struct {
|
||||
CommonQueryMetricInput
|
||||
}
|
||||
|
||||
func (q *QueryClusterMetricInput) ObjClusterName() string {
|
||||
return q.ClusterName
|
||||
}
|
||||
|
||||
type QueryProjectMetricInput struct {
|
||||
ProjectName string `json:"projectId" norman:"type=reference[project]"`
|
||||
CommonQueryMetricInput
|
||||
}
|
||||
|
||||
func (q *QueryProjectMetricInput) ObjClusterName() string {
|
||||
if parts := strings.SplitN(q.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CommonQueryMetricInput struct {
|
||||
From string `json:"from,omitempty"`
|
||||
To string `json:"to,omitempty"`
|
||||
@ -167,6 +199,17 @@ type ClusterMetricNamesInput struct {
|
||||
ClusterName string `json:"clusterId" norman:"type=reference[cluster]"`
|
||||
}
|
||||
|
||||
func (c *ClusterMetricNamesInput) ObjClusterName() string {
|
||||
return c.ClusterName
|
||||
}
|
||||
|
||||
type ProjectMetricNamesInput struct {
|
||||
ProjectName string `json:"projectId" norman:"type=reference[project]"`
|
||||
}
|
||||
|
||||
func (p *ProjectMetricNamesInput) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
v3 "github.com/rancher/types/apis/project.cattle.io/v3"
|
||||
@ -50,12 +52,23 @@ type Target struct {
|
||||
Healthstate string `json:"healthState,omitempty"`
|
||||
}
|
||||
|
||||
func (t *Target) ObjClusterName() string {
|
||||
if parts := strings.SplitN(t.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Answer struct {
|
||||
ProjectName string `json:"projectName,omitempty" norman:"type=reference[project]"`
|
||||
ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster]"`
|
||||
Values map[string]string `json:"values,omitempty" norman:"required"`
|
||||
}
|
||||
|
||||
func (a *Answer) ObjClusterName() string {
|
||||
return a.ClusterName
|
||||
}
|
||||
|
||||
type Member struct {
|
||||
UserName string `json:"userName,omitempty" norman:"type=reference[user]"`
|
||||
UserPrincipalName string `json:"userPrincipalName,omitempty" norman:"type=reference[principal]"`
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/types"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
@ -10,6 +12,13 @@ type ProjectNetworkPolicySpec struct {
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
func (p *ProjectNetworkPolicySpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ProjectNetworkPolicyStatus struct {
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,10 @@ type RancherKubernetesEngineConfig struct {
|
||||
UpgradeStrategy *NodeUpgradeStrategy `yaml:"upgrade_strategy,omitempty" json:"upgradeStrategy,omitempty"`
|
||||
}
|
||||
|
||||
func (r *RancherKubernetesEngineConfig) ObjClusterName() string {
|
||||
return r.ClusterName
|
||||
}
|
||||
|
||||
type NodeUpgradeStrategy struct {
|
||||
// MaxUnavailableWorker input can be a number of nodes or a percentage of nodes (example, max_unavailable_worker: 2 OR max_unavailable_worker: 20%)
|
||||
MaxUnavailableWorker string `yaml:"max_unavailable_worker" json:"maxUnavailableWorker,omitempty" norman:"min=1,default=10%"`
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@ -31,6 +33,13 @@ type AppSpec struct {
|
||||
ValuesYaml string `json:"valuesYaml,omitempty"`
|
||||
}
|
||||
|
||||
func (a *AppSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(a.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var (
|
||||
AppConditionInstalled condition.Cond = "Installed"
|
||||
AppConditionMigrated condition.Cond = "Migrated"
|
||||
@ -76,6 +85,13 @@ type AppRevisionSpec struct {
|
||||
ProjectName string `json:"projectName,omitempty" norman:"type=reference[/v3/schemas/project]"`
|
||||
}
|
||||
|
||||
func (a *AppRevisionSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(a.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type AppRevisionStatus struct {
|
||||
ProjectName string `json:"projectName,omitempty" norman:"type=reference[/v3/schemas/project]"`
|
||||
ExternalID string `json:"externalId"`
|
||||
@ -85,6 +101,13 @@ type AppRevisionStatus struct {
|
||||
Files map[string]string `json:"files,omitempty"`
|
||||
}
|
||||
|
||||
func (a *AppRevisionStatus) ObjClusterName() string {
|
||||
if parts := strings.SplitN(a.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type AppUpgradeConfig struct {
|
||||
ExternalID string `json:"externalId,omitempty"`
|
||||
Answers map[string]string `json:"answers,omitempty"`
|
||||
|
@ -1,6 +1,8 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rancher/norman/condition"
|
||||
"github.com/rancher/norman/types"
|
||||
@ -26,6 +28,13 @@ type SourceCodeProvider struct {
|
||||
Type string `json:"type" norman:"options=github|gitlab|bitbucketcloud|bitbucketserver"`
|
||||
}
|
||||
|
||||
func (s *SourceCodeProvider) ObjClusterName() string {
|
||||
if parts := strings.SplitN(s.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type OauthProvider struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@ -61,6 +70,13 @@ type SourceCodeProviderConfig struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
}
|
||||
|
||||
func (s *SourceCodeProviderConfig) ObjClusterName() string {
|
||||
if parts := strings.SplitN(s.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GithubPipelineConfig struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@ -118,6 +134,10 @@ type Pipeline struct {
|
||||
Status PipelineStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (p *Pipeline) ObjClusterName() string {
|
||||
return p.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type PipelineExecution struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -128,6 +148,10 @@ type PipelineExecution struct {
|
||||
Status PipelineExecutionStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (p *PipelineExecution) ObjClusterName() string {
|
||||
return p.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type PipelineSetting struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -140,6 +164,13 @@ type PipelineSetting struct {
|
||||
Customized bool `json:"customized" norman:"nocreate,noupdate"`
|
||||
}
|
||||
|
||||
func (p *PipelineSetting) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SourceCodeCredential struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -150,6 +181,10 @@ type SourceCodeCredential struct {
|
||||
Status SourceCodeCredentialStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (s *SourceCodeCredential) ObjClusterName() string {
|
||||
return s.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type SourceCodeRepository struct {
|
||||
types.Namespaced
|
||||
|
||||
@ -160,6 +195,10 @@ type SourceCodeRepository struct {
|
||||
Status SourceCodeRepositoryStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (s *SourceCodeRepository) ObjClusterName() string {
|
||||
return s.Spec.ObjClusterName()
|
||||
}
|
||||
|
||||
type PipelineStatus struct {
|
||||
PipelineState string `json:"pipelineState,omitempty" norman:"required,options=active|inactive,default=active"`
|
||||
NextRun int `json:"nextRun" yaml:"nextRun,omitempty" norman:"default=1,min=1"`
|
||||
@ -184,6 +223,13 @@ type PipelineSpec struct {
|
||||
SourceCodeCredentialName string `json:"sourceCodeCredentialName,omitempty" yaml:"sourceCodeCredentialName,omitempty" norman:"type=reference[sourceCodeCredential],noupdate"`
|
||||
}
|
||||
|
||||
func (p *PipelineSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type PipelineConfig struct {
|
||||
Stages []Stage `json:"stages,omitempty" yaml:"stages,omitempty"`
|
||||
|
||||
@ -314,6 +360,13 @@ type PipelineExecutionSpec struct {
|
||||
Email string `json:"email,omitempty"`
|
||||
}
|
||||
|
||||
func (p *PipelineExecutionSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(p.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type PipelineExecutionStatus struct {
|
||||
Conditions []PipelineCondition `json:"conditions,omitempty"`
|
||||
|
||||
@ -351,6 +404,13 @@ type SourceCodeCredentialSpec struct {
|
||||
Expiry string `json:"expiry,omitempty"`
|
||||
}
|
||||
|
||||
func (s *SourceCodeCredentialSpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(s.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SourceCodeCredentialStatus struct {
|
||||
Logout bool `json:"logout,omitempty"`
|
||||
}
|
||||
@ -366,6 +426,13 @@ type SourceCodeRepositorySpec struct {
|
||||
DefaultBranch string `json:"defaultBranch,omitempty"`
|
||||
}
|
||||
|
||||
func (s *SourceCodeRepositorySpec) ObjClusterName() string {
|
||||
if parts := strings.SplitN(s.ProjectName, ":", 2); len(parts) == 2 {
|
||||
return parts[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SourceCodeRepositoryStatus struct {
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user