-
Notifications
You must be signed in to change notification settings - Fork 250
/
constant.go
104 lines (79 loc) · 4.05 KB
/
constant.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package api
import (
"fmt"
"k8s.io/apimachinery/pkg/util/sets"
)
const (
RegistryPullCredentialsSecret = "registry-pull-credentials"
RegistryPushCredentialsCICentralSecret = "registry-push-credentials-ci-central"
RegistryPushCredentialsCICentralSecretMountPath = "/etc/push-secret"
GCSUploadCredentialsSecret = "gce-sa-credentials-gcs-publisher"
GCSUploadCredentialsSecretMountPath = "/secrets/gcs"
ManifestToolLocalPusherSecret = "manifest-tool-local-pusher"
ManifestToolLocalPusherSecretMountPath = "/secrets/manifest-tool"
ReleaseAnnotationSoftDelete = "release.openshift.io/soft-delete"
// DPTPRequesterLabel is the label on a Kubernates CR whose value indicates the automated tool that requests the CR
DPTPRequesterLabel = "dptp.openshift.io/requester"
KVMDeviceLabel = "devices.kubevirt.io/kvm"
ClusterLabel = "ci-operator.openshift.io/cluster"
CloudLabel = "ci-operator.openshift.io/cloud"
CloudClusterProfileLabel = "ci-operator.openshift.io/cloud-cluster-profile"
NoBuildsLabel = "ci.openshift.io/no-builds"
NoBuildsValue = "true"
// HiveCluster is the cluster where Hive is deployed
HiveCluster = ClusterHive
// HiveAdminKubeconfigSecret is the name of the secret in ci-op-<hash> namespace that stores the Admin's kubeconfig for the ephemeral cluster provisioned by Hive.
HiveAdminKubeconfigSecret = "hive-admin-kubeconfig"
// HiveAdminKubeconfigSecretKey is the key to the kubeconfig in the secret HiveAdminKubeconfigSecret
HiveAdminKubeconfigSecretKey = "kubeconfig"
// HiveAdminPasswordSecret the name of the secret in ci-op-<hash> namespace that stores the password for the user "kubeadmin" for the ephemeral cluster provisioned by Hive.
HiveAdminPasswordSecret = "hive-admin-password"
// HiveAdminPasswordSecretKey is the key to the password in the secret HiveAdminKubeconfigSecret
HiveAdminPasswordSecretKey = "password"
// HiveControlPlaneKubeconfigSecret is the name of the secret that stores kubeconfig to contact the cluster where Hive is deployed
HiveControlPlaneKubeconfigSecret = "hive-hive-credentials"
// HiveControlPlaneKubeconfigSecretArg is the flag to ci-operator
HiveControlPlaneKubeconfigSecretArg = "--hive-kubeconfig=/secrets/hive-hive-credentials/kubeconfig"
AutoScalePodsLabel = "ci.openshift.io/scale-pods"
NamespaceDir = "build-resources"
APPCIKubeAPIURL = "https://api.ci.l2s4.p1.openshiftapps.com:6443"
// ReasonPending is the error reason for pods not scheduled in time.
// It is generated when pods are for whatever reason not scheduled before
// `podStartTimeout`.
ReasonPending = "pod_pending"
// CliEnv if the env we use to expose the path to the cli
CliEnv = "CLI_DIR"
DefaultLeaseEnv = "LEASED_RESOURCE"
DefaultIPPoolLeaseEnv = "IP_POOL_AVAILABLE"
// SkipCensoringLabel is the label we use to mark a secret as not needing to be censored
SkipCensoringLabel = "ci.openshift.io/skip-censoring"
OauthTokenSecretKey = "oauth"
OauthTokenSecretName = "github-credentials-openshift-ci-robot-private-git-cloner"
CIAdminsGroupName = "test-platform-ci-admins"
ShmResource = "ci-operator.openshift.io/shm"
NvidiaGPUResource = "nvidia.com/gpu"
// ReleaseConfigAnnotation is the name of annotation created by the release controller.
// ci-operator uses the release controller configuration to determine
// the version of OpenShift we create from the ImageStream, so we need
// to copy the annotation if it exists
ReleaseConfigAnnotation = "release.openshift.io/config"
ImageStreamImportRetries = 6
)
var (
clusterNames = sets.New[string](
string(ClusterAPPCI),
string(ClusterARM01),
string(ClusterBuild01),
string(ClusterBuild02),
string(ClusterBuild03),
string(ClusterVSphere02),
)
)
// GitHubUserGroup returns the group name for a GitHub user
func GitHubUserGroup(username string) string {
return fmt.Sprintf("%s-group", username)
}
// ValidClusterName checks if a cluster name is valid
func ValidClusterName(clusterName string) bool {
return clusterNames.Has(clusterName) || buildClusterRegEx.MatchString(clusterName)
}