1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-03 16:04:26 +00:00

vendor types

This commit is contained in:
Sebastiaan van Steenis
2020-03-03 18:08:30 +01:00
parent 265553beb5
commit 8355b2ad68
26 changed files with 521 additions and 47 deletions

View File

@@ -26,7 +26,7 @@ import (
var (
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
MinClusterVersion = "3.0.0"
Version = "3.3.15"
Version = "3.3.17"
APIVersion = "unknown"
// Git SHA Value will be set during build

View File

@@ -113,7 +113,7 @@ func SplitProtoPort(rawPort string) (string, string) {
}
func validateProto(proto string) bool {
for _, availableProto := range []string{"tcp", "udp"} {
for _, availableProto := range []string{"tcp", "udp", "sctp"} {
if availableProto == proto {
return true
}

View File

@@ -4,7 +4,6 @@ package tlsconfig
import (
"crypto/x509"
)
// SystemCertPool returns an new empty cert pool,

View File

@@ -46,8 +46,6 @@ var acceptedCBCCiphers = []uint16{
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
}
// DefaultServerAcceptedCiphers should be uses by code which already has a crypto/tls
@@ -65,22 +63,34 @@ var allTLSVersions = map[uint16]struct{}{
}
// ServerDefault returns a secure-enough TLS configuration for the server TLS configuration.
func ServerDefault() *tls.Config {
return &tls.Config{
// Avoid fallback to SSL protocols < TLS1.0
MinVersion: tls.VersionTLS10,
func ServerDefault(ops ...func(*tls.Config)) *tls.Config {
tlsconfig := &tls.Config{
// Avoid fallback by default to SSL protocols < TLS1.2
MinVersion: tls.VersionTLS12,
PreferServerCipherSuites: true,
CipherSuites: DefaultServerAcceptedCiphers,
}
for _, op := range ops {
op(tlsconfig)
}
return tlsconfig
}
// ClientDefault returns a secure-enough TLS configuration for the client TLS configuration.
func ClientDefault() *tls.Config {
return &tls.Config{
func ClientDefault(ops ...func(*tls.Config)) *tls.Config {
tlsconfig := &tls.Config{
// Prefer TLS1.2 as the client minimum
MinVersion: tls.VersionTLS12,
CipherSuites: clientCipherSuites,
}
for _, op := range ops {
op(tlsconfig)
}
return tlsconfig
}
// certPool returns an X.509 certificate pool from `caFile`, the certificate file.

View File

@@ -26,6 +26,7 @@ The tool is sponsored by the [marvin + konsorten GmbH](http://www.konsorten.de).
We thank all the authors who provided code to this library:
* Felix Kollmann
* Nicolas Perraut
## License

View File

@@ -0,0 +1,11 @@
// +build linux darwin
package sequences
import (
"fmt"
)
func EnableVirtualTerminalProcessing(stream uintptr, enable bool) error {
return fmt.Errorf("windows only package")
}

View File

@@ -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"`

View File

@@ -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

View File

@@ -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]"`
}

View File

@@ -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

View File

@@ -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"`
}

View File

@@ -1,12 +1,10 @@
package v3
import "k8s.io/apimachinery/pkg/version"
//K3sConfig provides desired configuration for k3s clusters
type K3sConfig struct {
// k3s Kubernetes version
Version *version.Info `yaml:"kubernetes_version" json:"kubernetesVersion,omitempty"`
K3sUpgradeStrategy
// k3s Kubernetes version, unset the value indicates an unmanaged cluster
Version string `yaml:"kubernetes_version" json:"kubernetesVersion,omitempty"`
K3sUpgradeStrategy `yaml:"k3s_upgrade_strategy,omitempty" json:"k3supgradeStrategy,omitempty"`
}
//K3sUpgradeStrategy provides configuration to the downstream system-upgrade-controller

View File

@@ -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 ""
}

View File

@@ -65,6 +65,10 @@ type Node struct {
Status NodeStatus `json:"status"`
}
func (in *Node) ObjClusterName() string {
return in.Namespace
}
type MetadataUpdate struct {
Labels MapDelta `json:"labels,omitempty"`
Annotations MapDelta `json:"annotations,omitempty"`
@@ -152,6 +156,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 +178,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"`
}

View File

@@ -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 ""
}

View File

@@ -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]"`

View File

@@ -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 {
}

View File

@@ -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%"`
@@ -848,7 +852,12 @@ type DNSConfig struct {
}
type Nodelocal struct {
IPAddress string `yaml:"ipaddress" json:"ipAddress,omitempy"`
// link-local IP for nodelocal DNS
IPAddress string `yaml:"ip_address" json:"ipAddress,omitempy"`
// Nodelocal DNS daemonset upgrade strategy
UpdateStrategy *appsv1.DaemonSetUpdateStrategy `yaml:"update_strategy" json:"updateStrategy,omitempty"`
// NodeSelector key pair
NodeSelector map[string]string `yaml:"node_selector" json:"nodeSelector,omitempty"`
}
// LinearAutoscalerParams contains fields expected by the cluster-proportional-autoscaler https://github.com/kubernetes-incubator/cluster-proportional-autoscaler/blob/0c61e63fc81449abdd52315aa27179a17e5d1580/pkg/autoscaler/controller/linearcontroller/linear_controller.go#L50

View File

@@ -13,11 +13,11 @@ var (
AuthSystemImages AuthSystemImages
}{
PipelineSystemImages: projectv3.PipelineSystemImages{
Jenkins: m("rancher/pipeline-jenkins-server:v0.1.5"),
JenkinsJnlp: m("jenkins/jnlp-slave:3.40-1"),
Jenkins: m("rancher/pipeline-jenkins-server:v0.1.4"),
JenkinsJnlp: m("jenkins/jnlp-slave:3.35-4"),
AlpineGit: m("rancher/pipeline-tools:v0.1.14"),
PluginsDocker: m("plugins/docker:18.09"),
Minio: m("minio/minio:RELEASE.2020-02-07T23-28-16Z"),
Minio: m("minio/minio:RELEASE.2019-09-25T18-25-51Z"),
Registry: m("registry:2"),
RegistryProxy: m("rancher/pipeline-tools:v0.1.14"),
KubeApply: m("rancher/pipeline-tools:v0.1.14"),

View File

@@ -2227,7 +2227,7 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) {
if in.K3sConfig != nil {
in, out := &in.K3sConfig, &out.K3sConfig
*out = new(K3sConfig)
(*in).DeepCopyInto(*out)
**out = **in
}
if in.ImportedConfig != nil {
in, out := &in.ImportedConfig, &out.ImportedConfig
@@ -2962,7 +2962,7 @@ func (in *DNSConfig) DeepCopyInto(out *DNSConfig) {
if in.Nodelocal != nil {
in, out := &in.Nodelocal, &out.Nodelocal
*out = new(Nodelocal)
**out = **in
(*in).DeepCopyInto(*out)
}
if in.UpdateStrategy != nil {
in, out := &in.UpdateStrategy, &out.UpdateStrategy
@@ -4524,11 +4524,6 @@ func (in *IngressConfig) DeepCopy() *IngressConfig {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *K3sConfig) DeepCopyInto(out *K3sConfig) {
*out = *in
if in.Version != nil {
in, out := &in.Version, &out.Version
*out = new(version.Info)
**out = **in
}
out.K3sUpgradeStrategy = in.K3sUpgradeStrategy
return
}
@@ -6468,6 +6463,18 @@ func (in *NodeUpgradeStrategy) DeepCopy() *NodeUpgradeStrategy {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Nodelocal) DeepCopyInto(out *Nodelocal) {
*out = *in
if in.UpdateStrategy != nil {
in, out := &in.UpdateStrategy, &out.UpdateStrategy
*out = new(appsv1.DaemonSetUpdateStrategy)
(*in).DeepCopyInto(*out)
}
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
return
}

View File

@@ -1,6 +1,8 @@
package v3
import (
"strings"
"github.com/rancher/norman/condition"
"github.com/rancher/norman/types"
v1 "k8s.io/api/core/v1"
@@ -16,6 +18,10 @@ type App struct {
Status AppStatus `json:"status,omitempty"`
}
func (a *App) ObjClusterName() string {
return a.Spec.ObjClusterName()
}
type AppSpec struct {
ProjectName string `json:"projectName,omitempty" norman:"type=reference[/v3/schemas/project]"`
Description string `json:"description,omitempty"`
@@ -31,6 +37,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 +89,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 +105,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"`

View File

@@ -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 {
}

View File

@@ -15,6 +15,7 @@ const (
KubeDNS = "kubeDNS"
MetricsServer = "metricsServer"
NginxIngress = "nginxIngress"
Nodelocal = "nodelocal"
TemplateKeys = "templateKeys"
)