mirror of
https://github.com/actions/actions-runner-controller.git
synced 2026-01-16 16:59:15 +08:00
Rename Id and Url fields to ID and URL per convention
This commit is contained in:
@@ -24,13 +24,13 @@ import (
|
|||||||
// AutoscalingListenerSpec defines the desired state of AutoscalingListener
|
// AutoscalingListenerSpec defines the desired state of AutoscalingListener
|
||||||
type AutoscalingListenerSpec struct {
|
type AutoscalingListenerSpec struct {
|
||||||
// Required
|
// Required
|
||||||
GitHubConfigUrl string `json:"githubConfigUrl,omitempty"`
|
GitHubConfigURL string `json:"githubConfigUrl,omitempty"`
|
||||||
|
|
||||||
// Required
|
// Required
|
||||||
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
||||||
|
|
||||||
// Required
|
// Required
|
||||||
RunnerScaleSetId int `json:"runnerScaleSetId,omitempty"`
|
RunnerScaleSetID int `json:"runnerScaleSetId,omitempty"`
|
||||||
|
|
||||||
// Required
|
// Required
|
||||||
AutoscalingRunnerSetNamespace string `json:"autoscalingRunnerSetNamespace,omitempty"`
|
AutoscalingRunnerSetNamespace string `json:"autoscalingRunnerSetNamespace,omitempty"`
|
||||||
|
|||||||
@@ -46,16 +46,16 @@ import (
|
|||||||
// AutoscalingRunnerSet is the Schema for the autoscalingrunnersets API
|
// AutoscalingRunnerSet is the Schema for the autoscalingrunnersets API
|
||||||
type AutoscalingRunnerSet struct {
|
type AutoscalingRunnerSet struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
metav1.ObjectMeta `json:"metadata"`
|
||||||
|
|
||||||
Spec AutoscalingRunnerSetSpec `json:"spec,omitempty"`
|
Spec AutoscalingRunnerSetSpec `json:"spec"`
|
||||||
Status AutoscalingRunnerSetStatus `json:"status,omitempty"`
|
Status AutoscalingRunnerSetStatus `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AutoscalingRunnerSetSpec defines the desired state of AutoscalingRunnerSet
|
// AutoscalingRunnerSetSpec defines the desired state of AutoscalingRunnerSet
|
||||||
type AutoscalingRunnerSetSpec struct {
|
type AutoscalingRunnerSetSpec struct {
|
||||||
// Required
|
// Required
|
||||||
GitHubConfigUrl string `json:"githubConfigUrl,omitempty"`
|
GitHubConfigURL string `json:"githubConfigUrl,omitempty"`
|
||||||
|
|
||||||
// Required
|
// Required
|
||||||
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
||||||
@@ -76,7 +76,7 @@ type AutoscalingRunnerSetSpec struct {
|
|||||||
VaultConfig *VaultConfig `json:"vaultConfig,omitempty"`
|
VaultConfig *VaultConfig `json:"vaultConfig,omitempty"`
|
||||||
|
|
||||||
// Required
|
// Required
|
||||||
Template corev1.PodTemplateSpec `json:"template,omitempty"`
|
Template corev1.PodTemplateSpec `json:"template"`
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
ListenerMetrics *MetricsConfig `json:"listenerMetrics,omitempty"`
|
ListenerMetrics *MetricsConfig `json:"listenerMetrics,omitempty"`
|
||||||
@@ -152,9 +152,9 @@ func (c *ProxyConfig) ToHTTPProxyConfig(secretFetcher func(string) (*corev1.Secr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if c.HTTP != nil {
|
if c.HTTP != nil {
|
||||||
u, err := url.Parse(c.HTTP.Url)
|
u, err := url.Parse(c.HTTP.URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to parse proxy http url %q: %w", c.HTTP.Url, err)
|
return nil, fmt.Errorf("failed to parse proxy http url %q: %w", c.HTTP.URL, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.HTTP.CredentialSecretRef != "" {
|
if c.HTTP.CredentialSecretRef != "" {
|
||||||
@@ -177,9 +177,9 @@ func (c *ProxyConfig) ToHTTPProxyConfig(secretFetcher func(string) (*corev1.Secr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if c.HTTPS != nil {
|
if c.HTTPS != nil {
|
||||||
u, err := url.Parse(c.HTTPS.Url)
|
u, err := url.Parse(c.HTTPS.URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to parse proxy https url %q: %w", c.HTTPS.Url, err)
|
return nil, fmt.Errorf("failed to parse proxy https url %q: %w", c.HTTPS.URL, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.HTTPS.CredentialSecretRef != "" {
|
if c.HTTPS.CredentialSecretRef != "" {
|
||||||
@@ -233,7 +233,7 @@ func (c *ProxyConfig) ProxyFunc(secretFetcher func(string) (*corev1.Secret, erro
|
|||||||
|
|
||||||
type ProxyServerConfig struct {
|
type ProxyServerConfig struct {
|
||||||
// Required
|
// Required
|
||||||
Url string `json:"url,omitempty"`
|
URL string `json:"url,omitempty"`
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
CredentialSecretRef string `json:"credentialSecretRef,omitempty"`
|
CredentialSecretRef string `json:"credentialSecretRef,omitempty"`
|
||||||
@@ -313,8 +313,8 @@ func (ars *AutoscalingRunnerSet) GitHubConfigSecret() string {
|
|||||||
return ars.Spec.GitHubConfigSecret
|
return ars.Spec.GitHubConfigSecret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ars *AutoscalingRunnerSet) GitHubConfigUrl() string {
|
func (ars *AutoscalingRunnerSet) GitHubConfigURL() string {
|
||||||
return ars.Spec.GitHubConfigUrl
|
return ars.Spec.GitHubConfigURL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ars *AutoscalingRunnerSet) GitHubProxy() *ProxyConfig {
|
func (ars *AutoscalingRunnerSet) GitHubProxy() *ProxyConfig {
|
||||||
@@ -338,7 +338,7 @@ func (ars *AutoscalingRunnerSet) VaultProxy() *ProxyConfig {
|
|||||||
|
|
||||||
func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string {
|
func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string {
|
||||||
type runnerSetSpec struct {
|
type runnerSetSpec struct {
|
||||||
GitHubConfigUrl string
|
GitHubConfigURL string
|
||||||
GitHubConfigSecret string
|
GitHubConfigSecret string
|
||||||
RunnerGroup string
|
RunnerGroup string
|
||||||
RunnerScaleSetName string
|
RunnerScaleSetName string
|
||||||
@@ -347,7 +347,7 @@ func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string {
|
|||||||
Template corev1.PodTemplateSpec
|
Template corev1.PodTemplateSpec
|
||||||
}
|
}
|
||||||
spec := &runnerSetSpec{
|
spec := &runnerSetSpec{
|
||||||
GitHubConfigUrl: ars.Spec.GitHubConfigUrl,
|
GitHubConfigURL: ars.Spec.GitHubConfigURL,
|
||||||
GitHubConfigSecret: ars.Spec.GitHubConfigSecret,
|
GitHubConfigSecret: ars.Spec.GitHubConfigSecret,
|
||||||
RunnerGroup: ars.Spec.RunnerGroup,
|
RunnerGroup: ars.Spec.RunnerGroup,
|
||||||
RunnerScaleSetName: ars.Spec.RunnerScaleSetName,
|
RunnerScaleSetName: ars.Spec.RunnerScaleSetName,
|
||||||
@@ -363,7 +363,7 @@ func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string {
|
|||||||
// AutoscalingRunnerSetList contains a list of AutoscalingRunnerSet
|
// AutoscalingRunnerSetList contains a list of AutoscalingRunnerSet
|
||||||
type AutoscalingRunnerSetList struct {
|
type AutoscalingRunnerSetList struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ListMeta `json:"metadata,omitempty"`
|
metav1.ListMeta `json:"metadata"`
|
||||||
Items []AutoscalingRunnerSet `json:"items"`
|
Items []AutoscalingRunnerSet `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ const EphemeralRunnerContainerName = "runner"
|
|||||||
// EphemeralRunner is the Schema for the ephemeralrunners API
|
// EphemeralRunner is the Schema for the ephemeralrunners API
|
||||||
type EphemeralRunner struct {
|
type EphemeralRunner struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
metav1.ObjectMeta `json:"metadata"`
|
||||||
|
|
||||||
Spec EphemeralRunnerSpec `json:"spec,omitempty"`
|
Spec EphemeralRunnerSpec `json:"spec"`
|
||||||
Status EphemeralRunnerStatus `json:"status,omitempty"`
|
Status EphemeralRunnerStatus `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (er *EphemeralRunner) IsDone() bool {
|
func (er *EphemeralRunner) IsDone() bool {
|
||||||
@@ -76,8 +76,8 @@ func (er *EphemeralRunner) GitHubConfigSecret() string {
|
|||||||
return er.Spec.GitHubConfigSecret
|
return er.Spec.GitHubConfigSecret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (er *EphemeralRunner) GitHubConfigUrl() string {
|
func (er *EphemeralRunner) GitHubConfigURL() string {
|
||||||
return er.Spec.GitHubConfigUrl
|
return er.Spec.GitHubConfigURL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (er *EphemeralRunner) GitHubProxy() *ProxyConfig {
|
func (er *EphemeralRunner) GitHubProxy() *ProxyConfig {
|
||||||
@@ -102,7 +102,7 @@ func (er *EphemeralRunner) VaultProxy() *ProxyConfig {
|
|||||||
// EphemeralRunnerSpec defines the desired state of EphemeralRunner
|
// EphemeralRunnerSpec defines the desired state of EphemeralRunner
|
||||||
type EphemeralRunnerSpec struct {
|
type EphemeralRunnerSpec struct {
|
||||||
// +required
|
// +required
|
||||||
GitHubConfigUrl string `json:"githubConfigUrl,omitempty"`
|
GitHubConfigURL string `json:"githubConfigUrl,omitempty"`
|
||||||
|
|
||||||
// +required
|
// +required
|
||||||
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
||||||
@@ -111,7 +111,7 @@ type EphemeralRunnerSpec struct {
|
|||||||
GitHubServerTLS *TLSConfig `json:"githubServerTLS,omitempty"`
|
GitHubServerTLS *TLSConfig `json:"githubServerTLS,omitempty"`
|
||||||
|
|
||||||
// +required
|
// +required
|
||||||
RunnerScaleSetId int `json:"runnerScaleSetId,omitempty"`
|
RunnerScaleSetID int `json:"runnerScaleSetId,omitempty"`
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
Proxy *ProxyConfig `json:"proxy,omitempty"`
|
Proxy *ProxyConfig `json:"proxy,omitempty"`
|
||||||
@@ -147,7 +147,7 @@ type EphemeralRunnerStatus struct {
|
|||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
RunnerId int `json:"runnerId,omitempty"`
|
RunnerID int `json:"runnerId,omitempty"`
|
||||||
// +optional
|
// +optional
|
||||||
RunnerName string `json:"runnerName,omitempty"`
|
RunnerName string `json:"runnerName,omitempty"`
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ type EphemeralRunnerStatus struct {
|
|||||||
Failures map[string]metav1.Time `json:"failures,omitempty"`
|
Failures map[string]metav1.Time `json:"failures,omitempty"`
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
JobRequestId int64 `json:"jobRequestId,omitempty"`
|
JobRequestID int64 `json:"jobRequestId,omitempty"`
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
JobID string `json:"jobId,omitempty"`
|
JobID string `json:"jobId,omitempty"`
|
||||||
@@ -167,7 +167,7 @@ type EphemeralRunnerStatus struct {
|
|||||||
JobWorkflowRef string `json:"jobWorkflowRef,omitempty"`
|
JobWorkflowRef string `json:"jobWorkflowRef,omitempty"`
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
WorkflowRunId int64 `json:"workflowRunId,omitempty"`
|
WorkflowRunID int64 `json:"workflowRunId,omitempty"`
|
||||||
|
|
||||||
// +optional
|
// +optional
|
||||||
JobDisplayName string `json:"jobDisplayName,omitempty"`
|
JobDisplayName string `json:"jobDisplayName,omitempty"`
|
||||||
@@ -192,7 +192,7 @@ func (s *EphemeralRunnerStatus) LastFailure() metav1.Time {
|
|||||||
// EphemeralRunnerList contains a list of EphemeralRunner
|
// EphemeralRunnerList contains a list of EphemeralRunner
|
||||||
type EphemeralRunnerList struct {
|
type EphemeralRunnerList struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ListMeta `json:"metadata,omitempty"`
|
metav1.ListMeta `json:"metadata"`
|
||||||
Items []EphemeralRunner `json:"items"`
|
Items []EphemeralRunner `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type EphemeralRunnerSetSpec struct {
|
|||||||
// PatchID is the unique identifier for the patch issued by the listener app
|
// PatchID is the unique identifier for the patch issued by the listener app
|
||||||
PatchID int `json:"patchID"`
|
PatchID int `json:"patchID"`
|
||||||
// EphemeralRunnerSpec is the spec of the ephemeral runner
|
// EphemeralRunnerSpec is the spec of the ephemeral runner
|
||||||
EphemeralRunnerSpec EphemeralRunnerSpec `json:"ephemeralRunnerSpec,omitempty"`
|
EphemeralRunnerSpec EphemeralRunnerSpec `json:"ephemeralRunnerSpec"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EphemeralRunnerSetStatus defines the observed state of EphemeralRunnerSet
|
// EphemeralRunnerSetStatus defines the observed state of EphemeralRunnerSet
|
||||||
@@ -54,18 +54,18 @@ type EphemeralRunnerSetStatus struct {
|
|||||||
// EphemeralRunnerSet is the Schema for the ephemeralrunnersets API
|
// EphemeralRunnerSet is the Schema for the ephemeralrunnersets API
|
||||||
type EphemeralRunnerSet struct {
|
type EphemeralRunnerSet struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
metav1.ObjectMeta `json:"metadata"`
|
||||||
|
|
||||||
Spec EphemeralRunnerSetSpec `json:"spec,omitempty"`
|
Spec EphemeralRunnerSetSpec `json:"spec"`
|
||||||
Status EphemeralRunnerSetStatus `json:"status,omitempty"`
|
Status EphemeralRunnerSetStatus `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ers *EphemeralRunnerSet) GitHubConfigSecret() string {
|
func (ers *EphemeralRunnerSet) GitHubConfigSecret() string {
|
||||||
return ers.Spec.EphemeralRunnerSpec.GitHubConfigSecret
|
return ers.Spec.EphemeralRunnerSpec.GitHubConfigSecret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ers *EphemeralRunnerSet) GitHubConfigUrl() string {
|
func (ers *EphemeralRunnerSet) GitHubConfigURL() string {
|
||||||
return ers.Spec.EphemeralRunnerSpec.GitHubConfigUrl
|
return ers.Spec.EphemeralRunnerSpec.GitHubConfigURL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ers *EphemeralRunnerSet) GitHubProxy() *ProxyConfig {
|
func (ers *EphemeralRunnerSet) GitHubProxy() *ProxyConfig {
|
||||||
@@ -91,7 +91,7 @@ func (ers *EphemeralRunnerSet) VaultProxy() *ProxyConfig {
|
|||||||
// +kubebuilder:object:root=true
|
// +kubebuilder:object:root=true
|
||||||
type EphemeralRunnerSetList struct {
|
type EphemeralRunnerSetList struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
metav1.ListMeta `json:"metadata,omitempty"`
|
metav1.ListMeta `json:"metadata"`
|
||||||
Items []EphemeralRunnerSet `json:"items"`
|
Items []EphemeralRunnerSet `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Package v1 contains API Schema definitions for the batch v1 API group
|
// Package v1alpha1 contains API Schema definitions for the batch v1 API group
|
||||||
// +kubebuilder:object:generate=true
|
// +kubebuilder:object:generate=true
|
||||||
// +groupName=actions.github.com
|
// +groupName=actions.github.com
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import (
|
|||||||
func TestProxyConfig_ToSecret(t *testing.T) {
|
func TestProxyConfig_ToSecret(t *testing.T) {
|
||||||
config := &v1alpha1.ProxyConfig{
|
config := &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "http://proxy.example.com:8080",
|
URL: "http://proxy.example.com:8080",
|
||||||
CredentialSecretRef: "my-secret",
|
CredentialSecretRef: "my-secret",
|
||||||
},
|
},
|
||||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "https://proxy.example.com:8080",
|
URL: "https://proxy.example.com:8080",
|
||||||
CredentialSecretRef: "my-secret",
|
CredentialSecretRef: "my-secret",
|
||||||
},
|
},
|
||||||
NoProxy: []string{
|
NoProxy: []string{
|
||||||
@@ -48,11 +48,11 @@ func TestProxyConfig_ToSecret(t *testing.T) {
|
|||||||
func TestProxyConfig_ProxyFunc(t *testing.T) {
|
func TestProxyConfig_ProxyFunc(t *testing.T) {
|
||||||
config := &v1alpha1.ProxyConfig{
|
config := &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "http://proxy.example.com:8080",
|
URL: "http://proxy.example.com:8080",
|
||||||
CredentialSecretRef: "my-secret",
|
CredentialSecretRef: "my-secret",
|
||||||
},
|
},
|
||||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "https://proxy.example.com:8080",
|
URL: "https://proxy.example.com:8080",
|
||||||
CredentialSecretRef: "my-secret",
|
CredentialSecretRef: "my-secret",
|
||||||
},
|
},
|
||||||
NoProxy: []string{
|
NoProxy: []string{
|
||||||
|
|||||||
@@ -16323,6 +16323,8 @@ spec:
|
|||||||
It is used to identify which vault integration should be used to resolve secrets.
|
It is used to identify which vault integration should be used to resolve secrets.
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- template
|
||||||
type: object
|
type: object
|
||||||
status:
|
status:
|
||||||
description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet
|
description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet
|
||||||
@@ -16338,6 +16340,10 @@ spec:
|
|||||||
state:
|
state:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- metadata
|
||||||
|
- spec
|
||||||
|
- status
|
||||||
type: object
|
type: object
|
||||||
served: true
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
|
|||||||
@@ -8271,6 +8271,10 @@ spec:
|
|||||||
format: int64
|
format: int64
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- metadata
|
||||||
|
- spec
|
||||||
|
- status
|
||||||
type: object
|
type: object
|
||||||
served: true
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
|
|||||||
@@ -8223,6 +8223,7 @@ spec:
|
|||||||
description: Replicas is the number of desired EphemeralRunner resources in the k8s namespace.
|
description: Replicas is the number of desired EphemeralRunner resources in the k8s namespace.
|
||||||
type: integer
|
type: integer
|
||||||
required:
|
required:
|
||||||
|
- ephemeralRunnerSpec
|
||||||
- patchID
|
- patchID
|
||||||
type: object
|
type: object
|
||||||
status:
|
status:
|
||||||
@@ -8240,6 +8241,10 @@ spec:
|
|||||||
required:
|
required:
|
||||||
- currentReplicas
|
- currentReplicas
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- metadata
|
||||||
|
- spec
|
||||||
|
- status
|
||||||
type: object
|
type: object
|
||||||
served: true
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ metadata:
|
|||||||
namespace: {{ include "autoscaling-runner-set.namespace" . | quote }}
|
namespace: {{ include "autoscaling-runner-set.namespace" . | quote }}
|
||||||
labels:
|
labels:
|
||||||
{{- include "autoscaling-runner-set.labels" . | nindent 4 }}
|
{{- include "autoscaling-runner-set.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
{{- $globalAnnotations := (default (dict) .Values.resource.all.metadata.annotations) }}
|
||||||
|
{{- $resourceAnnotations := (default (dict) .Values.resource.autoscalingRunnerSet.metadata.annotations) }}
|
||||||
|
{{- $annotations := mergeOverwrite $globalAnnotations $resourceAnnotations }}
|
||||||
|
{{- range $k, $v := $annotations }}
|
||||||
|
{{ $k }}: {{ $v | quote }}
|
||||||
|
{{- end }}
|
||||||
|
actions.github.com/values-hash: {{ toJson .Values | sha256sum | trunc 63 }}
|
||||||
|
|
||||||
spec:
|
spec:
|
||||||
githubConfigUrl: {{ required ".Values.auth.url is required" (trimSuffix "/" .Values.auth.url) | quote }}
|
githubConfigUrl: {{ required ".Values.auth.url is required" (trimSuffix "/" .Values.auth.url) | quote }}
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ func TestTemplateRenderedAutoScalingRunnerSet(t *testing.T) {
|
|||||||
assert.Equal(t, "autoscaling-runner-set", ars.Labels["app.kubernetes.io/component"])
|
assert.Equal(t, "autoscaling-runner-set", ars.Labels["app.kubernetes.io/component"])
|
||||||
assert.NotEmpty(t, ars.Labels["app.kubernetes.io/version"])
|
assert.NotEmpty(t, ars.Labels["app.kubernetes.io/version"])
|
||||||
|
|
||||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||||
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||||
|
|
||||||
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
||||||
@@ -456,7 +456,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_RunnerScaleSetName(t *testing.T) {
|
|||||||
assert.Equal(t, nameOverride, ars.Labels["actions.github.com/scale-set-name"])
|
assert.Equal(t, nameOverride, ars.Labels["actions.github.com/scale-set-name"])
|
||||||
assert.Equal(t, namespaceName, ars.Labels["actions.github.com/scale-set-namespace"])
|
assert.Equal(t, namespaceName, ars.Labels["actions.github.com/scale-set-namespace"])
|
||||||
assert.Equal(t, "gha-rs", ars.Labels["app.kubernetes.io/part-of"])
|
assert.Equal(t, "gha-rs", ars.Labels["app.kubernetes.io/part-of"])
|
||||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||||
assert.Equal(t, nameOverride+"-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
assert.Equal(t, nameOverride+"-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||||
assert.Equal(t, "test-runner-scale-set-name", ars.Spec.RunnerScaleSetName)
|
assert.Equal(t, "test-runner-scale-set-name", ars.Spec.RunnerScaleSetName)
|
||||||
|
|
||||||
@@ -913,7 +913,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableDinD(t *testing.T) {
|
|||||||
|
|
||||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
||||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
||||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||||
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||||
|
|
||||||
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
||||||
@@ -1000,7 +1000,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesMode(t *testing.T)
|
|||||||
|
|
||||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
||||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
||||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||||
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||||
|
|
||||||
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
||||||
@@ -1058,7 +1058,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesModeNoVolume(t *te
|
|||||||
|
|
||||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
||||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
||||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||||
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||||
|
|
||||||
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
||||||
@@ -1160,7 +1160,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_UsePredefinedSecret(t *testing.T)
|
|||||||
|
|
||||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
||||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
||||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||||
assert.Equal(t, "pre-defined-secrets", ars.Spec.GitHubConfigSecret)
|
assert.Equal(t, "pre-defined-secrets", ars.Spec.GitHubConfigSecret)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1224,11 +1224,11 @@ func TestTemplateRenderedWithProxy(t *testing.T) {
|
|||||||
|
|
||||||
require.NotNil(t, ars.Spec.Proxy)
|
require.NotNil(t, ars.Spec.Proxy)
|
||||||
require.NotNil(t, ars.Spec.Proxy.HTTP)
|
require.NotNil(t, ars.Spec.Proxy.HTTP)
|
||||||
assert.Equal(t, "http://proxy.example.com", ars.Spec.Proxy.HTTP.Url)
|
assert.Equal(t, "http://proxy.example.com", ars.Spec.Proxy.HTTP.URL)
|
||||||
assert.Equal(t, "http-secret", ars.Spec.Proxy.HTTP.CredentialSecretRef)
|
assert.Equal(t, "http-secret", ars.Spec.Proxy.HTTP.CredentialSecretRef)
|
||||||
|
|
||||||
require.NotNil(t, ars.Spec.Proxy.HTTPS)
|
require.NotNil(t, ars.Spec.Proxy.HTTPS)
|
||||||
assert.Equal(t, "https://proxy.example.com", ars.Spec.Proxy.HTTPS.Url)
|
assert.Equal(t, "https://proxy.example.com", ars.Spec.Proxy.HTTPS.URL)
|
||||||
assert.Equal(t, "https-secret", ars.Spec.Proxy.HTTPS.CredentialSecretRef)
|
assert.Equal(t, "https-secret", ars.Spec.Proxy.HTTPS.CredentialSecretRef)
|
||||||
|
|
||||||
require.NotNil(t, ars.Spec.Proxy.NoProxy)
|
require.NotNil(t, ars.Spec.Proxy.NoProxy)
|
||||||
@@ -1803,7 +1803,7 @@ func TestTemplateRenderedGitHubConfigUrlEndsWIthSlash(t *testing.T) {
|
|||||||
|
|
||||||
assert.Equal(t, namespaceName, ars.Namespace)
|
assert.Equal(t, namespaceName, ars.Namespace)
|
||||||
assert.Equal(t, "test-runners", ars.Name)
|
assert.Equal(t, "test-runners", ars.Name)
|
||||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTemplate_CreateManagerRole(t *testing.T) {
|
func TestTemplate_CreateManagerRole(t *testing.T) {
|
||||||
|
|||||||
@@ -114,10 +114,10 @@ func (w *Worker) HandleJobStarted(ctx context.Context, jobInfo *actions.JobStart
|
|||||||
patch, err := json.Marshal(
|
patch, err := json.Marshal(
|
||||||
&v1alpha1.EphemeralRunner{
|
&v1alpha1.EphemeralRunner{
|
||||||
Status: v1alpha1.EphemeralRunnerStatus{
|
Status: v1alpha1.EphemeralRunnerStatus{
|
||||||
JobRequestId: jobInfo.RunnerRequestID,
|
JobRequestID: jobInfo.RunnerRequestID,
|
||||||
JobRepositoryName: fmt.Sprintf("%s/%s", jobInfo.OwnerName, jobInfo.RepositoryName),
|
JobRepositoryName: fmt.Sprintf("%s/%s", jobInfo.OwnerName, jobInfo.RepositoryName),
|
||||||
JobID: jobInfo.JobID,
|
JobID: jobInfo.JobID,
|
||||||
WorkflowRunId: jobInfo.WorkflowRunID,
|
WorkflowRunID: jobInfo.WorkflowRunID,
|
||||||
JobWorkflowRef: jobInfo.JobWorkflowRef,
|
JobWorkflowRef: jobInfo.JobWorkflowRef,
|
||||||
JobDisplayName: jobInfo.JobDisplayName,
|
JobDisplayName: jobInfo.JobDisplayName,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16323,6 +16323,8 @@ spec:
|
|||||||
It is used to identify which vault integration should be used to resolve secrets.
|
It is used to identify which vault integration should be used to resolve secrets.
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- template
|
||||||
type: object
|
type: object
|
||||||
status:
|
status:
|
||||||
description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet
|
description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet
|
||||||
@@ -16338,6 +16340,10 @@ spec:
|
|||||||
state:
|
state:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- metadata
|
||||||
|
- spec
|
||||||
|
- status
|
||||||
type: object
|
type: object
|
||||||
served: true
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
|
|||||||
@@ -8271,6 +8271,10 @@ spec:
|
|||||||
format: int64
|
format: int64
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- metadata
|
||||||
|
- spec
|
||||||
|
- status
|
||||||
type: object
|
type: object
|
||||||
served: true
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
|
|||||||
@@ -8223,6 +8223,7 @@ spec:
|
|||||||
description: Replicas is the number of desired EphemeralRunner resources in the k8s namespace.
|
description: Replicas is the number of desired EphemeralRunner resources in the k8s namespace.
|
||||||
type: integer
|
type: integer
|
||||||
required:
|
required:
|
||||||
|
- ephemeralRunnerSpec
|
||||||
- patchID
|
- patchID
|
||||||
type: object
|
type: object
|
||||||
status:
|
status:
|
||||||
@@ -8240,6 +8241,10 @@ spec:
|
|||||||
required:
|
required:
|
||||||
- currentReplicas
|
- currentReplicas
|
||||||
type: object
|
type: object
|
||||||
|
required:
|
||||||
|
- metadata
|
||||||
|
- spec
|
||||||
|
- status
|
||||||
type: object
|
type: object
|
||||||
served: true
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
|
|||||||
@@ -668,7 +668,7 @@ func (r *AutoscalingListenerReconciler) createRoleBindingForListener(ctx context
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *AutoscalingListenerReconciler) publishRunningListener(autoscalingListener *v1alpha1.AutoscalingListener, isUp bool) error {
|
func (r *AutoscalingListenerReconciler) publishRunningListener(autoscalingListener *v1alpha1.AutoscalingListener, isUp bool) error {
|
||||||
githubConfigURL := autoscalingListener.Spec.GitHubConfigUrl
|
githubConfigURL := autoscalingListener.Spec.GitHubConfigURL
|
||||||
parsedURL, err := actions.ParseGitHubConfigFromURL(githubConfigURL)
|
parsedURL, err := actions.ParseGitHubConfigFromURL(githubConfigURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ var _ = Describe("Test AutoScalingListener controller", func() {
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
@@ -92,9 +92,9 @@ var _ = Describe("Test AutoScalingListener controller", func() {
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
RunnerScaleSetId: 1,
|
RunnerScaleSetID: 1,
|
||||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||||
EphemeralRunnerSetName: "test-ers",
|
EphemeralRunnerSetName: "test-ers",
|
||||||
@@ -482,7 +482,7 @@ var _ = Describe("Test AutoScalingListener customization", func() {
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
@@ -508,9 +508,9 @@ var _ = Describe("Test AutoScalingListener customization", func() {
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
RunnerScaleSetId: 1,
|
RunnerScaleSetID: 1,
|
||||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||||
EphemeralRunnerSetName: "test-ers",
|
EphemeralRunnerSetName: "test-ers",
|
||||||
@@ -740,7 +740,7 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() {
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
@@ -767,9 +767,9 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() {
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
RunnerScaleSetId: 1,
|
RunnerScaleSetID: 1,
|
||||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||||
EphemeralRunnerSetName: "test-ers",
|
EphemeralRunnerSetName: "test-ers",
|
||||||
@@ -823,11 +823,11 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() {
|
|||||||
|
|
||||||
proxy := &v1alpha1.ProxyConfig{
|
proxy := &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "http://localhost:8080",
|
URL: "http://localhost:8080",
|
||||||
CredentialSecretRef: "proxy-credentials",
|
CredentialSecretRef: "proxy-credentials",
|
||||||
},
|
},
|
||||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "https://localhost:8443",
|
URL: "https://localhost:8443",
|
||||||
CredentialSecretRef: "proxy-credentials",
|
CredentialSecretRef: "proxy-credentials",
|
||||||
},
|
},
|
||||||
NoProxy: []string{
|
NoProxy: []string{
|
||||||
@@ -942,7 +942,7 @@ var _ = Describe("Test AutoScalingListener controller with template modification
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
@@ -969,9 +969,9 @@ var _ = Describe("Test AutoScalingListener controller with template modification
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
RunnerScaleSetId: 1,
|
RunnerScaleSetID: 1,
|
||||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||||
EphemeralRunnerSetName: "test-ers",
|
EphemeralRunnerSetName: "test-ers",
|
||||||
@@ -1137,7 +1137,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||||
@@ -1173,7 +1173,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
|
|||||||
Namespace: autoscalingNS.Name,
|
Namespace: autoscalingNS.Name,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||||
@@ -1185,7 +1185,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RunnerScaleSetId: 1,
|
RunnerScaleSetID: 1,
|
||||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||||
EphemeralRunnerSetName: "test-ers",
|
EphemeralRunnerSetName: "test-ers",
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ func (r *AutoscalingRunnerSetReconciler) createRunnerScaleSet(ctx context.Contex
|
|||||||
obj.Annotations[AnnotationKeyGitHubRunnerScaleSetName] = runnerScaleSet.Name
|
obj.Annotations[AnnotationKeyGitHubRunnerScaleSetName] = runnerScaleSet.Name
|
||||||
obj.Annotations[runnerScaleSetIDAnnotationKey] = strconv.Itoa(runnerScaleSet.Id)
|
obj.Annotations[runnerScaleSetIDAnnotationKey] = strconv.Itoa(runnerScaleSet.Id)
|
||||||
obj.Annotations[AnnotationKeyGitHubRunnerGroupName] = runnerScaleSet.RunnerGroupName
|
obj.Annotations[AnnotationKeyGitHubRunnerGroupName] = runnerScaleSet.RunnerGroupName
|
||||||
if err := applyGitHubURLLabels(obj.Spec.GitHubConfigUrl, obj.Labels); err != nil { // should never happen
|
if err := applyGitHubURLLabels(obj.Spec.GitHubConfigURL, obj.Labels); err != nil { // should never happen
|
||||||
logger.Error(err, "Failed to apply GitHub URL labels")
|
logger.Error(err, "Failed to apply GitHub URL labels")
|
||||||
}
|
}
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ var _ = Describe("Test AutoScalingRunnerSet controller", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
@@ -734,7 +734,7 @@ var _ = Describe("Test AutoScalingController updates", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
@@ -854,7 +854,7 @@ var _ = Describe("Test AutoscalingController creation failures", Ordered, func()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
RunnerGroup: "testgroup",
|
RunnerGroup: "testgroup",
|
||||||
@@ -992,14 +992,14 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "http://example.com/org/repo",
|
GitHubConfigURL: "http://example.com/org/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
RunnerGroup: "testgroup",
|
RunnerGroup: "testgroup",
|
||||||
Proxy: &v1alpha1.ProxyConfig{
|
Proxy: &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: proxy.URL,
|
URL: proxy.URL,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Template: corev1.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
@@ -1071,14 +1071,14 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "http://example.com/org/repo",
|
GitHubConfigURL: "http://example.com/org/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
RunnerGroup: "testgroup",
|
RunnerGroup: "testgroup",
|
||||||
Proxy: &v1alpha1.ProxyConfig{
|
Proxy: &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: proxy.URL,
|
URL: proxy.URL,
|
||||||
CredentialSecretRef: "proxy-credentials",
|
CredentialSecretRef: "proxy-credentials",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1198,7 +1198,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: server.ConfigURLForOrg("my-org"),
|
GitHubConfigURL: server.ConfigURLForOrg("my-org"),
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||||
@@ -1251,7 +1251,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||||
@@ -1315,7 +1315,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||||
@@ -1419,7 +1419,7 @@ var _ = Describe("Test external permissions cleanup", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
@@ -1583,7 +1583,7 @@ var _ = Describe("Test external permissions cleanup", Ordered, func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
RunnerGroup: "testgroup",
|
RunnerGroup: "testgroup",
|
||||||
@@ -1799,7 +1799,7 @@ var _ = Describe("Test resource version and build version mismatch", func() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
MaxRunners: &max,
|
MaxRunners: &max,
|
||||||
MinRunners: &min,
|
MinRunners: &min,
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ephemeralRunner.Status.RunnerId == 0 {
|
if ephemeralRunner.Status.RunnerID == 0 {
|
||||||
log.Info("Updating ephemeral runner status with runnerId and runnerName")
|
log.Info("Updating ephemeral runner status with runnerId and runnerName")
|
||||||
runnerID, err := strconv.Atoi(string(secret.Data["runnerId"]))
|
runnerID, err := strconv.Atoi(string(secret.Data["runnerId"]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -217,12 +217,12 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
|
|||||||
|
|
||||||
runnerName := string(secret.Data["runnerName"])
|
runnerName := string(secret.Data["runnerName"])
|
||||||
if err := patchSubResource(ctx, r.Status(), ephemeralRunner, func(obj *v1alpha1.EphemeralRunner) {
|
if err := patchSubResource(ctx, r.Status(), ephemeralRunner, func(obj *v1alpha1.EphemeralRunner) {
|
||||||
obj.Status.RunnerId = runnerID
|
obj.Status.RunnerID = runnerID
|
||||||
obj.Status.RunnerName = runnerName
|
obj.Status.RunnerName = runnerName
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return ctrl.Result{}, fmt.Errorf("failed to update runner status for RunnerId/RunnerName/RunnerJITConfig: %w", err)
|
return ctrl.Result{}, fmt.Errorf("failed to update runner status for RunnerId/RunnerName/RunnerJITConfig: %w", err)
|
||||||
}
|
}
|
||||||
ephemeralRunner.Status.RunnerId = runnerID
|
ephemeralRunner.Status.RunnerID = runnerID
|
||||||
ephemeralRunner.Status.RunnerName = runnerName
|
ephemeralRunner.Status.RunnerName = runnerName
|
||||||
log.Info("Updated ephemeral runner status with runnerId and runnerName")
|
log.Info("Updated ephemeral runner status with runnerId and runnerName")
|
||||||
}
|
}
|
||||||
@@ -391,7 +391,7 @@ func (r *EphemeralRunnerReconciler) deleteEphemeralRunnerOrPod(ctx context.Conte
|
|||||||
log.Error(err, "Failed to get actions client for removing the runner from the service")
|
log.Error(err, "Failed to get actions client for removing the runner from the service")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerId)); err != nil {
|
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerID)); err != nil {
|
||||||
log.Error(err, "Failed to remove the runner from the service")
|
log.Error(err, "Failed to remove the runner from the service")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -618,7 +618,7 @@ func (r *EphemeralRunnerReconciler) createRunnerJitConfig(ctx context.Context, e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jitConfig, err := actionsClient.GenerateJitRunnerConfig(ctx, jitSettings, ephemeralRunner.Spec.RunnerScaleSetId)
|
jitConfig, err := actionsClient.GenerateJitRunnerConfig(ctx, jitSettings, ephemeralRunner.Spec.RunnerScaleSetID)
|
||||||
if err == nil { // if NO error
|
if err == nil { // if NO error
|
||||||
log.Info("Created ephemeral runner JIT config", "runnerId", jitConfig.Runner.Id)
|
log.Info("Created ephemeral runner JIT config", "runnerId", jitConfig.Runner.Id)
|
||||||
return jitConfig, nil
|
return jitConfig, nil
|
||||||
@@ -653,7 +653,7 @@ func (r *EphemeralRunnerReconciler) createRunnerJitConfig(ctx context.Context, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Found the runner with the same name", "runnerId", existingRunner.Id, "runnerScaleSetId", existingRunner.RunnerScaleSetId)
|
log.Info("Found the runner with the same name", "runnerId", existingRunner.Id, "runnerScaleSetId", existingRunner.RunnerScaleSetId)
|
||||||
if existingRunner.RunnerScaleSetId == ephemeralRunner.Spec.RunnerScaleSetId {
|
if existingRunner.RunnerScaleSetId == ephemeralRunner.Spec.RunnerScaleSetID {
|
||||||
log.Info("Removing the runner with the same name")
|
log.Info("Removing the runner with the same name")
|
||||||
err := actionsClient.RemoveRunner(ctx, int64(existingRunner.Id))
|
err := actionsClient.RemoveRunner(ctx, int64(existingRunner.Id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -731,10 +731,10 @@ func (r *EphemeralRunnerReconciler) createPod(ctx context.Context, runner *v1alp
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Created ephemeral runner pod",
|
log.Info("Created ephemeral runner pod",
|
||||||
"runnerScaleSetId", runner.Spec.RunnerScaleSetId,
|
"runnerScaleSetId", runner.Spec.RunnerScaleSetID,
|
||||||
"runnerName", runner.Status.RunnerName,
|
"runnerName", runner.Status.RunnerName,
|
||||||
"runnerId", runner.Status.RunnerId,
|
"runnerId", runner.Status.RunnerID,
|
||||||
"configUrl", runner.Spec.GitHubConfigUrl,
|
"configUrl", runner.Spec.GitHubConfigURL,
|
||||||
"podName", newPod.Name)
|
"podName", newPod.Name)
|
||||||
|
|
||||||
return ctrl.Result{}, nil
|
return ctrl.Result{}, nil
|
||||||
@@ -810,13 +810,13 @@ func (r *EphemeralRunnerReconciler) deleteRunnerFromService(ctx context.Context,
|
|||||||
return fmt.Errorf("failed to get actions client for runner: %w", err)
|
return fmt.Errorf("failed to get actions client for runner: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Removing runner from the service", "runnerId", ephemeralRunner.Status.RunnerId)
|
log.Info("Removing runner from the service", "runnerId", ephemeralRunner.Status.RunnerID)
|
||||||
err = client.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerId))
|
err = client.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to remove runner from the service: %w", err)
|
return fmt.Errorf("failed to remove runner from the service: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Removed runner from the service", "runnerId", ephemeralRunner.Status.RunnerId)
|
log.Info("Removed runner from the service", "runnerId", ephemeralRunner.Status.RunnerID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ func newExampleRunner(name, namespace, configSecretName string) *v1alpha1.Epheme
|
|||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.EphemeralRunnerSpec{
|
Spec: v1alpha1.EphemeralRunnerSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecretName,
|
GitHubConfigSecret: configSecretName,
|
||||||
RunnerScaleSetId: 1,
|
RunnerScaleSetID: 1,
|
||||||
PodTemplateSpec: corev1.PodTemplateSpec{
|
PodTemplateSpec: corev1.PodTemplateSpec{
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []corev1.Container{
|
Containers: []corev1.Container{
|
||||||
@@ -667,7 +667,7 @@ var _ = Describe("EphemeralRunner", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
return updatedEphemeralRunner.Status.RunnerId, nil
|
return updatedEphemeralRunner.Status.RunnerID, nil
|
||||||
},
|
},
|
||||||
ephemeralRunnerTimeout,
|
ephemeralRunnerTimeout,
|
||||||
ephemeralRunnerInterval,
|
ephemeralRunnerInterval,
|
||||||
@@ -1234,10 +1234,10 @@ var _ = Describe("EphemeralRunner", func() {
|
|||||||
Expect(err).NotTo(HaveOccurred(), "failed to create secret credentials")
|
Expect(err).NotTo(HaveOccurred(), "failed to create secret credentials")
|
||||||
|
|
||||||
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
||||||
ephemeralRunner.Spec.GitHubConfigUrl = "http://example.com/org/repo"
|
ephemeralRunner.Spec.GitHubConfigURL = "http://example.com/org/repo"
|
||||||
ephemeralRunner.Spec.Proxy = &v1alpha1.ProxyConfig{
|
ephemeralRunner.Spec.Proxy = &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: proxy.URL,
|
URL: proxy.URL,
|
||||||
CredentialSecretRef: "proxy-credentials",
|
CredentialSecretRef: "proxy-credentials",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1258,10 +1258,10 @@ var _ = Describe("EphemeralRunner", func() {
|
|||||||
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
||||||
ephemeralRunner.Spec.Proxy = &v1alpha1.ProxyConfig{
|
ephemeralRunner.Spec.Proxy = &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "http://proxy.example.com:8080",
|
URL: "http://proxy.example.com:8080",
|
||||||
},
|
},
|
||||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "http://proxy.example.com:8080",
|
URL: "http://proxy.example.com:8080",
|
||||||
},
|
},
|
||||||
NoProxy: []string{"example.com"},
|
NoProxy: []string{"example.com"},
|
||||||
}
|
}
|
||||||
@@ -1398,7 +1398,7 @@ var _ = Describe("EphemeralRunner", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
||||||
ephemeralRunner.Spec.GitHubConfigUrl = server.ConfigURLForOrg("my-org")
|
ephemeralRunner.Spec.GitHubConfigURL = server.ConfigURLForOrg("my-org")
|
||||||
ephemeralRunner.Spec.GitHubServerTLS = &v1alpha1.TLSConfig{
|
ephemeralRunner.Spec.GitHubServerTLS = &v1alpha1.TLSConfig{
|
||||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||||
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
|
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ func (r *EphemeralRunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.R
|
|||||||
)
|
)
|
||||||
|
|
||||||
if r.PublishMetrics {
|
if r.PublishMetrics {
|
||||||
githubConfigURL := ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubConfigUrl
|
githubConfigURL := ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubConfigURL
|
||||||
parsedURL, err := actions.ParseGitHubConfigFromURL(githubConfigURL)
|
parsedURL, err := actions.ParseGitHubConfigFromURL(githubConfigURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err, "Github Config URL is invalid", "URL", githubConfigURL)
|
log.Error(err, "Github Config URL is invalid", "URL", githubConfigURL)
|
||||||
@@ -448,7 +448,7 @@ func (r *EphemeralRunnerSetReconciler) deleteIdleEphemeralRunners(ctx context.Co
|
|||||||
for runners.next() {
|
for runners.next() {
|
||||||
ephemeralRunner := runners.object()
|
ephemeralRunner := runners.object()
|
||||||
isDone := ephemeralRunner.IsDone()
|
isDone := ephemeralRunner.IsDone()
|
||||||
if !isDone && ephemeralRunner.Status.RunnerId == 0 {
|
if !isDone && ephemeralRunner.Status.RunnerID == 0 {
|
||||||
log.Info("Skipping ephemeral runner since it is not registered yet", "name", ephemeralRunner.Name)
|
log.Info("Skipping ephemeral runner since it is not registered yet", "name", ephemeralRunner.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ func (r *EphemeralRunnerSetReconciler) deleteIdleEphemeralRunners(ctx context.Co
|
|||||||
log.Info(
|
log.Info(
|
||||||
"Skipping ephemeral runner since it is running a job",
|
"Skipping ephemeral runner since it is running a job",
|
||||||
"name", ephemeralRunner.Name,
|
"name", ephemeralRunner.Name,
|
||||||
"workflowRunId", ephemeralRunner.Status.WorkflowRunId,
|
"workflowRunId", ephemeralRunner.Status.WorkflowRunID,
|
||||||
"jobId", ephemeralRunner.Status.JobID,
|
"jobId", ephemeralRunner.Status.JobID,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
@@ -482,28 +482,28 @@ func (r *EphemeralRunnerSetReconciler) deleteIdleEphemeralRunners(ctx context.Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *EphemeralRunnerSetReconciler) deleteEphemeralRunnerWithActionsClient(ctx context.Context, ephemeralRunner *v1alpha1.EphemeralRunner, actionsClient actions.ActionsService, log logr.Logger) (bool, error) {
|
func (r *EphemeralRunnerSetReconciler) deleteEphemeralRunnerWithActionsClient(ctx context.Context, ephemeralRunner *v1alpha1.EphemeralRunner, actionsClient actions.ActionsService, log logr.Logger) (bool, error) {
|
||||||
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerId)); err != nil {
|
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerID)); err != nil {
|
||||||
actionsError := &actions.ActionsError{}
|
actionsError := &actions.ActionsError{}
|
||||||
if !errors.As(err, &actionsError) {
|
if !errors.As(err, &actionsError) {
|
||||||
log.Error(err, "failed to remove runner from the service", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerId)
|
log.Error(err, "failed to remove runner from the service", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerID)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if actionsError.StatusCode == http.StatusBadRequest &&
|
if actionsError.StatusCode == http.StatusBadRequest &&
|
||||||
actionsError.IsException("JobStillRunningException") {
|
actionsError.IsException("JobStillRunningException") {
|
||||||
log.Info("Runner is still running a job, skipping deletion", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerId)
|
log.Info("Runner is still running a job, skipping deletion", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerID)
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Deleting ephemeral runner after removing from the service", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerId)
|
log.Info("Deleting ephemeral runner after removing from the service", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerID)
|
||||||
if err := r.Delete(ctx, ephemeralRunner); err != nil && !kerrors.IsNotFound(err) {
|
if err := r.Delete(ctx, ephemeralRunner); err != nil && !kerrors.IsNotFound(err) {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Deleted ephemeral runner", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerId)
|
log.Info("Deleted ephemeral runner", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerID)
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
|||||||
},
|
},
|
||||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
GitHubConfigURL: "https://github.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
RunnerScaleSetId: 100,
|
RunnerScaleSetID: 100,
|
||||||
PodTemplateSpec: corev1.PodTemplateSpec{
|
PodTemplateSpec: corev1.PodTemplateSpec{
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []corev1.Container{
|
Containers: []corev1.Container{
|
||||||
@@ -158,10 +158,10 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
|||||||
// Set status to simulate a configured EphemeralRunner
|
// Set status to simulate a configured EphemeralRunner
|
||||||
refetch := false
|
refetch := false
|
||||||
for i, runner := range runnerList.Items {
|
for i, runner := range runnerList.Items {
|
||||||
if runner.Status.RunnerId == 0 {
|
if runner.Status.RunnerID == 0 {
|
||||||
updatedRunner := runner.DeepCopy()
|
updatedRunner := runner.DeepCopy()
|
||||||
updatedRunner.Status.Phase = corev1.PodRunning
|
updatedRunner.Status.Phase = corev1.PodRunning
|
||||||
updatedRunner.Status.RunnerId = i + 100
|
updatedRunner.Status.RunnerID = i + 100
|
||||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||||
refetch = true
|
refetch = true
|
||||||
@@ -218,10 +218,10 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
|||||||
// Set status to simulate a configured EphemeralRunner
|
// Set status to simulate a configured EphemeralRunner
|
||||||
refetch := false
|
refetch := false
|
||||||
for i, runner := range runnerList.Items {
|
for i, runner := range runnerList.Items {
|
||||||
if runner.Status.RunnerId == 0 {
|
if runner.Status.RunnerID == 0 {
|
||||||
updatedRunner := runner.DeepCopy()
|
updatedRunner := runner.DeepCopy()
|
||||||
updatedRunner.Status.Phase = corev1.PodRunning
|
updatedRunner.Status.Phase = corev1.PodRunning
|
||||||
updatedRunner.Status.RunnerId = i + 100
|
updatedRunner.Status.RunnerID = i + 100
|
||||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||||
refetch = true
|
refetch = true
|
||||||
@@ -776,12 +776,12 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
|||||||
// Now, let's say ephemeral runner controller patched these ephemeral runners with the registration.
|
// Now, let's say ephemeral runner controller patched these ephemeral runners with the registration.
|
||||||
|
|
||||||
updatedRunner = runnerList.Items[0].DeepCopy()
|
updatedRunner = runnerList.Items[0].DeepCopy()
|
||||||
updatedRunner.Status.RunnerId = 1
|
updatedRunner.Status.RunnerID = 1
|
||||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[0]))
|
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[0]))
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||||
|
|
||||||
updatedRunner = runnerList.Items[1].DeepCopy()
|
updatedRunner = runnerList.Items[1].DeepCopy()
|
||||||
updatedRunner.Status.RunnerId = 2
|
updatedRunner.Status.RunnerID = 2
|
||||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[1]))
|
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[1]))
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||||
|
|
||||||
@@ -942,7 +942,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
|||||||
var failedOriginal *v1alpha1.EphemeralRunner
|
var failedOriginal *v1alpha1.EphemeralRunner
|
||||||
var empty []*v1alpha1.EphemeralRunner
|
var empty []*v1alpha1.EphemeralRunner
|
||||||
for _, runner := range runnerList.Items {
|
for _, runner := range runnerList.Items {
|
||||||
switch runner.Status.RunnerId {
|
switch runner.Status.RunnerID {
|
||||||
case 101:
|
case 101:
|
||||||
pendingOriginal = runner.DeepCopy()
|
pendingOriginal = runner.DeepCopy()
|
||||||
case 102:
|
case 102:
|
||||||
@@ -961,7 +961,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
|||||||
empty = empty[1:]
|
empty = empty[1:]
|
||||||
|
|
||||||
pending := pendingOriginal.DeepCopy()
|
pending := pendingOriginal.DeepCopy()
|
||||||
pending.Status.RunnerId = 101
|
pending.Status.RunnerID = 101
|
||||||
pending.Status.Phase = corev1.PodPending
|
pending.Status.Phase = corev1.PodPending
|
||||||
|
|
||||||
err = k8sClient.Status().Patch(ctx, pending, client.MergeFrom(pendingOriginal))
|
err = k8sClient.Status().Patch(ctx, pending, client.MergeFrom(pendingOriginal))
|
||||||
@@ -975,7 +975,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
|||||||
runningOriginal = empty[0]
|
runningOriginal = empty[0]
|
||||||
empty = empty[1:]
|
empty = empty[1:]
|
||||||
running := runningOriginal.DeepCopy()
|
running := runningOriginal.DeepCopy()
|
||||||
running.Status.RunnerId = 102
|
running.Status.RunnerID = 102
|
||||||
running.Status.Phase = corev1.PodRunning
|
running.Status.Phase = corev1.PodRunning
|
||||||
|
|
||||||
err = k8sClient.Status().Patch(ctx, running, client.MergeFrom(runningOriginal))
|
err = k8sClient.Status().Patch(ctx, running, client.MergeFrom(runningOriginal))
|
||||||
@@ -989,7 +989,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
|||||||
failedOriginal = empty[0]
|
failedOriginal = empty[0]
|
||||||
|
|
||||||
failed := pendingOriginal.DeepCopy()
|
failed := pendingOriginal.DeepCopy()
|
||||||
failed.Status.RunnerId = 103
|
failed.Status.RunnerID = 103
|
||||||
failed.Status.Phase = corev1.PodFailed
|
failed.Status.Phase = corev1.PodFailed
|
||||||
|
|
||||||
err = k8sClient.Status().Patch(ctx, failed, client.MergeFrom(failedOriginal))
|
err = k8sClient.Status().Patch(ctx, failed, client.MergeFrom(failedOriginal))
|
||||||
@@ -1138,16 +1138,16 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
|
|||||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||||
Replicas: 1,
|
Replicas: 1,
|
||||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||||
GitHubConfigUrl: "http://example.com/owner/repo",
|
GitHubConfigURL: "http://example.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
RunnerScaleSetId: 100,
|
RunnerScaleSetID: 100,
|
||||||
Proxy: &v1alpha1.ProxyConfig{
|
Proxy: &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "http://proxy.example.com",
|
URL: "http://proxy.example.com",
|
||||||
CredentialSecretRef: secretCredentials.Name,
|
CredentialSecretRef: secretCredentials.Name,
|
||||||
},
|
},
|
||||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||||
Url: "https://proxy.example.com",
|
URL: "https://proxy.example.com",
|
||||||
CredentialSecretRef: secretCredentials.Name,
|
CredentialSecretRef: secretCredentials.Name,
|
||||||
},
|
},
|
||||||
NoProxy: []string{"example.com", "example.org"},
|
NoProxy: []string{"example.com", "example.org"},
|
||||||
@@ -1224,10 +1224,10 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
|
|||||||
// Set status to simulate a configured EphemeralRunner
|
// Set status to simulate a configured EphemeralRunner
|
||||||
refetch := false
|
refetch := false
|
||||||
for i, runner := range runnerList.Items {
|
for i, runner := range runnerList.Items {
|
||||||
if runner.Status.RunnerId == 0 {
|
if runner.Status.RunnerID == 0 {
|
||||||
updatedRunner := runner.DeepCopy()
|
updatedRunner := runner.DeepCopy()
|
||||||
updatedRunner.Status.Phase = corev1.PodSucceeded
|
updatedRunner.Status.Phase = corev1.PodSucceeded
|
||||||
updatedRunner.Status.RunnerId = i + 100
|
updatedRunner.Status.RunnerID = i + 100
|
||||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||||
refetch = true
|
refetch = true
|
||||||
@@ -1317,12 +1317,12 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
|
|||||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||||
Replicas: 1,
|
Replicas: 1,
|
||||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||||
GitHubConfigUrl: "http://example.com/owner/repo",
|
GitHubConfigURL: "http://example.com/owner/repo",
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
RunnerScaleSetId: 100,
|
RunnerScaleSetID: 100,
|
||||||
Proxy: &v1alpha1.ProxyConfig{
|
Proxy: &v1alpha1.ProxyConfig{
|
||||||
HTTP: &v1alpha1.ProxyServerConfig{
|
HTTP: &v1alpha1.ProxyServerConfig{
|
||||||
Url: proxy.URL,
|
URL: proxy.URL,
|
||||||
CredentialSecretRef: "proxy-credentials",
|
CredentialSecretRef: "proxy-credentials",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1358,7 +1358,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
|
|||||||
|
|
||||||
runner := runnerList.Items[0].DeepCopy()
|
runner := runnerList.Items[0].DeepCopy()
|
||||||
runner.Status.Phase = corev1.PodRunning
|
runner.Status.Phase = corev1.PodRunning
|
||||||
runner.Status.RunnerId = 100
|
runner.Status.RunnerID = 100
|
||||||
err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0]))
|
err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0]))
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status")
|
Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status")
|
||||||
|
|
||||||
@@ -1460,7 +1460,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func(
|
|||||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||||
Replicas: 1,
|
Replicas: 1,
|
||||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||||
GitHubConfigUrl: server.ConfigURLForOrg("my-org"),
|
GitHubConfigURL: server.ConfigURLForOrg("my-org"),
|
||||||
GitHubConfigSecret: configSecret.Name,
|
GitHubConfigSecret: configSecret.Name,
|
||||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||||
@@ -1472,7 +1472,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RunnerScaleSetId: 100,
|
RunnerScaleSetID: 100,
|
||||||
PodTemplateSpec: corev1.PodTemplateSpec{
|
PodTemplateSpec: corev1.PodTemplateSpec{
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
Containers: []corev1.Container{
|
Containers: []corev1.Container{
|
||||||
@@ -1508,7 +1508,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func(
|
|||||||
Expect(runner.Spec.GitHubServerTLS).To(BeEquivalentTo(ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubServerTLS), "runner tls config should be correct")
|
Expect(runner.Spec.GitHubServerTLS).To(BeEquivalentTo(ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubServerTLS), "runner tls config should be correct")
|
||||||
|
|
||||||
runner.Status.Phase = corev1.PodRunning
|
runner.Status.Phase = corev1.PodRunning
|
||||||
runner.Status.RunnerId = 100
|
runner.Status.RunnerID = 100
|
||||||
err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0]))
|
err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0]))
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status")
|
Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status")
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ func (b *ResourceBuilder) newAutoScalingListener(autoscalingRunnerSet *v1alpha1.
|
|||||||
annotationKeyValuesHash: autoscalingRunnerSet.Annotations[annotationKeyValuesHash],
|
annotationKeyValuesHash: autoscalingRunnerSet.Annotations[annotationKeyValuesHash],
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := applyGitHubURLLabels(autoscalingRunnerSet.Spec.GitHubConfigUrl, labels); err != nil {
|
if err := applyGitHubURLLabels(autoscalingRunnerSet.Spec.GitHubConfigURL, labels); err != nil {
|
||||||
return nil, fmt.Errorf("failed to apply GitHub URL labels: %v", err)
|
return nil, fmt.Errorf("failed to apply GitHub URL labels: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,10 +121,10 @@ func (b *ResourceBuilder) newAutoScalingListener(autoscalingRunnerSet *v1alpha1.
|
|||||||
Annotations: annotations,
|
Annotations: annotations,
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||||
GitHubConfigUrl: autoscalingRunnerSet.Spec.GitHubConfigUrl,
|
GitHubConfigURL: autoscalingRunnerSet.Spec.GitHubConfigURL,
|
||||||
GitHubConfigSecret: autoscalingRunnerSet.Spec.GitHubConfigSecret,
|
GitHubConfigSecret: autoscalingRunnerSet.Spec.GitHubConfigSecret,
|
||||||
VaultConfig: autoscalingRunnerSet.VaultConfig(),
|
VaultConfig: autoscalingRunnerSet.VaultConfig(),
|
||||||
RunnerScaleSetId: runnerScaleSetID,
|
RunnerScaleSetID: runnerScaleSetID,
|
||||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||||
EphemeralRunnerSetName: ephemeralRunnerSet.Name,
|
EphemeralRunnerSetName: ephemeralRunnerSet.Name,
|
||||||
@@ -174,12 +174,12 @@ func (b *ResourceBuilder) newScaleSetListenerConfig(autoscalingListener *v1alpha
|
|||||||
}
|
}
|
||||||
|
|
||||||
config := ghalistenerconfig.Config{
|
config := ghalistenerconfig.Config{
|
||||||
ConfigureUrl: autoscalingListener.Spec.GitHubConfigUrl,
|
ConfigureUrl: autoscalingListener.Spec.GitHubConfigURL,
|
||||||
EphemeralRunnerSetNamespace: autoscalingListener.Spec.AutoscalingRunnerSetNamespace,
|
EphemeralRunnerSetNamespace: autoscalingListener.Spec.AutoscalingRunnerSetNamespace,
|
||||||
EphemeralRunnerSetName: autoscalingListener.Spec.EphemeralRunnerSetName,
|
EphemeralRunnerSetName: autoscalingListener.Spec.EphemeralRunnerSetName,
|
||||||
MaxRunners: autoscalingListener.Spec.MaxRunners,
|
MaxRunners: autoscalingListener.Spec.MaxRunners,
|
||||||
MinRunners: autoscalingListener.Spec.MinRunners,
|
MinRunners: autoscalingListener.Spec.MinRunners,
|
||||||
RunnerScaleSetId: autoscalingListener.Spec.RunnerScaleSetId,
|
RunnerScaleSetId: autoscalingListener.Spec.RunnerScaleSetID,
|
||||||
RunnerScaleSetName: autoscalingListener.Spec.AutoscalingRunnerSetName,
|
RunnerScaleSetName: autoscalingListener.Spec.AutoscalingRunnerSetName,
|
||||||
ServerRootCA: cert,
|
ServerRootCA: cert,
|
||||||
LogLevel: scaleSetListenerLogLevel,
|
LogLevel: scaleSetListenerLogLevel,
|
||||||
@@ -509,7 +509,7 @@ func (b *ResourceBuilder) newEphemeralRunnerSet(autoscalingRunnerSet *v1alpha1.A
|
|||||||
LabelKeyGitHubScaleSetNamespace: autoscalingRunnerSet.Namespace,
|
LabelKeyGitHubScaleSetNamespace: autoscalingRunnerSet.Namespace,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := applyGitHubURLLabels(autoscalingRunnerSet.Spec.GitHubConfigUrl, labels); err != nil {
|
if err := applyGitHubURLLabels(autoscalingRunnerSet.Spec.GitHubConfigURL, labels); err != nil {
|
||||||
return nil, fmt.Errorf("failed to apply GitHub URL labels: %v", err)
|
return nil, fmt.Errorf("failed to apply GitHub URL labels: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,8 +540,8 @@ func (b *ResourceBuilder) newEphemeralRunnerSet(autoscalingRunnerSet *v1alpha1.A
|
|||||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||||
Replicas: 0,
|
Replicas: 0,
|
||||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||||
RunnerScaleSetId: runnerScaleSetID,
|
RunnerScaleSetID: runnerScaleSetID,
|
||||||
GitHubConfigUrl: autoscalingRunnerSet.Spec.GitHubConfigUrl,
|
GitHubConfigURL: autoscalingRunnerSet.Spec.GitHubConfigURL,
|
||||||
GitHubConfigSecret: autoscalingRunnerSet.Spec.GitHubConfigSecret,
|
GitHubConfigSecret: autoscalingRunnerSet.Spec.GitHubConfigSecret,
|
||||||
Proxy: autoscalingRunnerSet.Spec.Proxy,
|
Proxy: autoscalingRunnerSet.Spec.Proxy,
|
||||||
GitHubServerTLS: autoscalingRunnerSet.Spec.GitHubServerTLS,
|
GitHubServerTLS: autoscalingRunnerSet.Spec.GitHubServerTLS,
|
||||||
@@ -689,7 +689,7 @@ func scaleSetListenerName(autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet) s
|
|||||||
hashSuffix(
|
hashSuffix(
|
||||||
autoscalingRunnerSet.Namespace,
|
autoscalingRunnerSet.Namespace,
|
||||||
autoscalingRunnerSet.Spec.RunnerGroup,
|
autoscalingRunnerSet.Spec.RunnerGroup,
|
||||||
autoscalingRunnerSet.Spec.GitHubConfigUrl,
|
autoscalingRunnerSet.Spec.GitHubConfigURL,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ func TestLabelPropagation(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/org/repo",
|
GitHubConfigURL: "https://github.com/org/repo",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ func TestGitHubURLTrimLabelValues(t *testing.T) {
|
|||||||
t.Run("org/repo", func(t *testing.T) {
|
t.Run("org/repo", func(t *testing.T) {
|
||||||
autoscalingRunnerSet := autoscalingRunnerSet.DeepCopy()
|
autoscalingRunnerSet := autoscalingRunnerSet.DeepCopy()
|
||||||
autoscalingRunnerSet.Spec = v1alpha1.AutoscalingRunnerSetSpec{
|
autoscalingRunnerSet.Spec = v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: fmt.Sprintf("https://github.com/%s/%s", organization, repository),
|
GitHubConfigURL: fmt.Sprintf("https://github.com/%s/%s", organization, repository),
|
||||||
}
|
}
|
||||||
|
|
||||||
var b ResourceBuilder
|
var b ResourceBuilder
|
||||||
@@ -157,7 +157,7 @@ func TestGitHubURLTrimLabelValues(t *testing.T) {
|
|||||||
t.Run("enterprise", func(t *testing.T) {
|
t.Run("enterprise", func(t *testing.T) {
|
||||||
autoscalingRunnerSet := autoscalingRunnerSet.DeepCopy()
|
autoscalingRunnerSet := autoscalingRunnerSet.DeepCopy()
|
||||||
autoscalingRunnerSet.Spec = v1alpha1.AutoscalingRunnerSetSpec{
|
autoscalingRunnerSet.Spec = v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: fmt.Sprintf("https://github.com/enterprises/%s", enterprise),
|
GitHubConfigURL: fmt.Sprintf("https://github.com/enterprises/%s", enterprise),
|
||||||
}
|
}
|
||||||
|
|
||||||
var b ResourceBuilder
|
var b ResourceBuilder
|
||||||
@@ -196,7 +196,7 @@ func TestOwnershipRelationships(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||||
GitHubConfigUrl: "https://github.com/org/repo",
|
GitHubConfigURL: "https://github.com/org/repo",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func NewSecretResolver(k8sClient client.Client, multiClient actions.MultiClient,
|
|||||||
|
|
||||||
type ActionsGitHubObject interface {
|
type ActionsGitHubObject interface {
|
||||||
client.Object
|
client.Object
|
||||||
GitHubConfigUrl() string
|
GitHubConfigURL() string
|
||||||
GitHubConfigSecret() string
|
GitHubConfigSecret() string
|
||||||
GitHubProxy() *v1alpha1.ProxyConfig
|
GitHubProxy() *v1alpha1.ProxyConfig
|
||||||
GitHubServerTLS() *v1alpha1.TLSConfig
|
GitHubServerTLS() *v1alpha1.TLSConfig
|
||||||
@@ -85,9 +85,9 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH
|
|||||||
}
|
}
|
||||||
|
|
||||||
if proxy.HTTP != nil {
|
if proxy.HTTP != nil {
|
||||||
u, err := url.Parse(proxy.HTTP.Url)
|
u, err := url.Parse(proxy.HTTP.URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to parse proxy http url %q: %w", proxy.HTTP.Url, err)
|
return nil, fmt.Errorf("failed to parse proxy http url %q: %w", proxy.HTTP.URL, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ref := proxy.HTTP.CredentialSecretRef; ref != "" {
|
if ref := proxy.HTTP.CredentialSecretRef; ref != "" {
|
||||||
@@ -101,9 +101,9 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH
|
|||||||
}
|
}
|
||||||
|
|
||||||
if proxy.HTTPS != nil {
|
if proxy.HTTPS != nil {
|
||||||
u, err := url.Parse(proxy.HTTPS.Url)
|
u, err := url.Parse(proxy.HTTPS.URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to parse proxy https url %q: %w", proxy.HTTPS.Url, err)
|
return nil, fmt.Errorf("failed to parse proxy https url %q: %w", proxy.HTTPS.URL, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ref := proxy.HTTPS.CredentialSecretRef; ref != "" {
|
if ref := proxy.HTTPS.CredentialSecretRef; ref != "" {
|
||||||
@@ -150,7 +150,7 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH
|
|||||||
|
|
||||||
return sr.multiClient.GetClientFor(
|
return sr.multiClient.GetClientFor(
|
||||||
ctx,
|
ctx,
|
||||||
obj.GitHubConfigUrl(),
|
obj.GitHubConfigURL(),
|
||||||
appConfig,
|
appConfig,
|
||||||
obj.GetNamespace(),
|
obj.GetNamespace(),
|
||||||
clientOptions...,
|
clientOptions...,
|
||||||
|
|||||||
Reference in New Issue
Block a user