From ffcaa06b6ac95d02e45a7c74665cad2ab9c80d04 Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Thu, 15 Jan 2026 19:16:07 +0100 Subject: [PATCH] Rename Id and Url fields to ID and URL per convention --- .../v1alpha1/autoscalinglistener_types.go | 4 +- .../v1alpha1/autoscalingrunnerset_types.go | 30 +++++------ .../v1alpha1/ephemeralrunner_types.go | 22 ++++---- .../v1alpha1/ephemeralrunnerset_types.go | 14 +++--- .../v1alpha1/groupversion_info.go | 2 +- .../v1alpha1/proxy_config_test.go | 8 +-- ...ions.github.com_autoscalingrunnersets.yaml | 6 +++ .../actions.github.com_ephemeralrunners.yaml | 4 ++ ...ctions.github.com_ephemeralrunnersets.yaml | 5 ++ .../templates/autoscalingrunnserset.yaml | 8 +++ .../tests/template_test.go | 18 +++---- cmd/ghalistener/worker/worker.go | 4 +- ...ions.github.com_autoscalingrunnersets.yaml | 6 +++ .../actions.github.com_ephemeralrunners.yaml | 4 ++ ...ctions.github.com_ephemeralrunnersets.yaml | 5 ++ .../autoscalinglistener_controller.go | 2 +- .../autoscalinglistener_controller_test.go | 34 ++++++------- .../autoscalingrunnerset_controller.go | 2 +- .../autoscalingrunnerset_controller_test.go | 26 +++++----- .../ephemeralrunner_controller.go | 24 ++++----- .../ephemeralrunner_controller_test.go | 16 +++--- .../ephemeralrunnerset_controller.go | 16 +++--- .../ephemeralrunnerset_controller_test.go | 50 +++++++++---------- .../actions.github.com/resourcebuilder.go | 18 +++---- .../resourcebuilder_test.go | 8 +-- .../actions.github.com/secret_resolver.go | 12 ++--- 26 files changed, 193 insertions(+), 155 deletions(-) diff --git a/apis/actions.github.com/v1alpha1/autoscalinglistener_types.go b/apis/actions.github.com/v1alpha1/autoscalinglistener_types.go index 3943c6f6..70f203b5 100644 --- a/apis/actions.github.com/v1alpha1/autoscalinglistener_types.go +++ b/apis/actions.github.com/v1alpha1/autoscalinglistener_types.go @@ -24,13 +24,13 @@ import ( // AutoscalingListenerSpec defines the desired state of AutoscalingListener type AutoscalingListenerSpec struct { // Required - GitHubConfigUrl string `json:"githubConfigUrl,omitempty"` + GitHubConfigURL string `json:"githubConfigUrl,omitempty"` // Required GitHubConfigSecret string `json:"githubConfigSecret,omitempty"` // Required - RunnerScaleSetId int `json:"runnerScaleSetId,omitempty"` + RunnerScaleSetID int `json:"runnerScaleSetId,omitempty"` // Required AutoscalingRunnerSetNamespace string `json:"autoscalingRunnerSetNamespace,omitempty"` diff --git a/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go b/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go index ecb01b58..1d29b61b 100644 --- a/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go +++ b/apis/actions.github.com/v1alpha1/autoscalingrunnerset_types.go @@ -46,16 +46,16 @@ import ( // AutoscalingRunnerSet is the Schema for the autoscalingrunnersets API type AutoscalingRunnerSet struct { metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` + metav1.ObjectMeta `json:"metadata"` - Spec AutoscalingRunnerSetSpec `json:"spec,omitempty"` - Status AutoscalingRunnerSetStatus `json:"status,omitempty"` + Spec AutoscalingRunnerSetSpec `json:"spec"` + Status AutoscalingRunnerSetStatus `json:"status"` } // AutoscalingRunnerSetSpec defines the desired state of AutoscalingRunnerSet type AutoscalingRunnerSetSpec struct { // Required - GitHubConfigUrl string `json:"githubConfigUrl,omitempty"` + GitHubConfigURL string `json:"githubConfigUrl,omitempty"` // Required GitHubConfigSecret string `json:"githubConfigSecret,omitempty"` @@ -76,7 +76,7 @@ type AutoscalingRunnerSetSpec struct { VaultConfig *VaultConfig `json:"vaultConfig,omitempty"` // Required - Template corev1.PodTemplateSpec `json:"template,omitempty"` + Template corev1.PodTemplateSpec `json:"template"` // +optional ListenerMetrics *MetricsConfig `json:"listenerMetrics,omitempty"` @@ -152,9 +152,9 @@ func (c *ProxyConfig) ToHTTPProxyConfig(secretFetcher func(string) (*corev1.Secr } if c.HTTP != nil { - u, err := url.Parse(c.HTTP.Url) + u, err := url.Parse(c.HTTP.URL) 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 != "" { @@ -177,9 +177,9 @@ func (c *ProxyConfig) ToHTTPProxyConfig(secretFetcher func(string) (*corev1.Secr } if c.HTTPS != nil { - u, err := url.Parse(c.HTTPS.Url) + u, err := url.Parse(c.HTTPS.URL) 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 != "" { @@ -233,7 +233,7 @@ func (c *ProxyConfig) ProxyFunc(secretFetcher func(string) (*corev1.Secret, erro type ProxyServerConfig struct { // Required - Url string `json:"url,omitempty"` + URL string `json:"url,omitempty"` // +optional CredentialSecretRef string `json:"credentialSecretRef,omitempty"` @@ -313,8 +313,8 @@ func (ars *AutoscalingRunnerSet) GitHubConfigSecret() string { return ars.Spec.GitHubConfigSecret } -func (ars *AutoscalingRunnerSet) GitHubConfigUrl() string { - return ars.Spec.GitHubConfigUrl +func (ars *AutoscalingRunnerSet) GitHubConfigURL() string { + return ars.Spec.GitHubConfigURL } func (ars *AutoscalingRunnerSet) GitHubProxy() *ProxyConfig { @@ -338,7 +338,7 @@ func (ars *AutoscalingRunnerSet) VaultProxy() *ProxyConfig { func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string { type runnerSetSpec struct { - GitHubConfigUrl string + GitHubConfigURL string GitHubConfigSecret string RunnerGroup string RunnerScaleSetName string @@ -347,7 +347,7 @@ func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string { Template corev1.PodTemplateSpec } spec := &runnerSetSpec{ - GitHubConfigUrl: ars.Spec.GitHubConfigUrl, + GitHubConfigURL: ars.Spec.GitHubConfigURL, GitHubConfigSecret: ars.Spec.GitHubConfigSecret, RunnerGroup: ars.Spec.RunnerGroup, RunnerScaleSetName: ars.Spec.RunnerScaleSetName, @@ -363,7 +363,7 @@ func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string { // AutoscalingRunnerSetList contains a list of AutoscalingRunnerSet type AutoscalingRunnerSetList struct { metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` + metav1.ListMeta `json:"metadata"` Items []AutoscalingRunnerSet `json:"items"` } diff --git a/apis/actions.github.com/v1alpha1/ephemeralrunner_types.go b/apis/actions.github.com/v1alpha1/ephemeralrunner_types.go index 28d6545c..dc177068 100644 --- a/apis/actions.github.com/v1alpha1/ephemeralrunner_types.go +++ b/apis/actions.github.com/v1alpha1/ephemeralrunner_types.go @@ -41,10 +41,10 @@ const EphemeralRunnerContainerName = "runner" // EphemeralRunner is the Schema for the ephemeralrunners API type EphemeralRunner struct { metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` + metav1.ObjectMeta `json:"metadata"` - Spec EphemeralRunnerSpec `json:"spec,omitempty"` - Status EphemeralRunnerStatus `json:"status,omitempty"` + Spec EphemeralRunnerSpec `json:"spec"` + Status EphemeralRunnerStatus `json:"status"` } func (er *EphemeralRunner) IsDone() bool { @@ -76,8 +76,8 @@ func (er *EphemeralRunner) GitHubConfigSecret() string { return er.Spec.GitHubConfigSecret } -func (er *EphemeralRunner) GitHubConfigUrl() string { - return er.Spec.GitHubConfigUrl +func (er *EphemeralRunner) GitHubConfigURL() string { + return er.Spec.GitHubConfigURL } func (er *EphemeralRunner) GitHubProxy() *ProxyConfig { @@ -102,7 +102,7 @@ func (er *EphemeralRunner) VaultProxy() *ProxyConfig { // EphemeralRunnerSpec defines the desired state of EphemeralRunner type EphemeralRunnerSpec struct { // +required - GitHubConfigUrl string `json:"githubConfigUrl,omitempty"` + GitHubConfigURL string `json:"githubConfigUrl,omitempty"` // +required GitHubConfigSecret string `json:"githubConfigSecret,omitempty"` @@ -111,7 +111,7 @@ type EphemeralRunnerSpec struct { GitHubServerTLS *TLSConfig `json:"githubServerTLS,omitempty"` // +required - RunnerScaleSetId int `json:"runnerScaleSetId,omitempty"` + RunnerScaleSetID int `json:"runnerScaleSetId,omitempty"` // +optional Proxy *ProxyConfig `json:"proxy,omitempty"` @@ -147,7 +147,7 @@ type EphemeralRunnerStatus struct { Message string `json:"message,omitempty"` // +optional - RunnerId int `json:"runnerId,omitempty"` + RunnerID int `json:"runnerId,omitempty"` // +optional RunnerName string `json:"runnerName,omitempty"` @@ -155,7 +155,7 @@ type EphemeralRunnerStatus struct { Failures map[string]metav1.Time `json:"failures,omitempty"` // +optional - JobRequestId int64 `json:"jobRequestId,omitempty"` + JobRequestID int64 `json:"jobRequestId,omitempty"` // +optional JobID string `json:"jobId,omitempty"` @@ -167,7 +167,7 @@ type EphemeralRunnerStatus struct { JobWorkflowRef string `json:"jobWorkflowRef,omitempty"` // +optional - WorkflowRunId int64 `json:"workflowRunId,omitempty"` + WorkflowRunID int64 `json:"workflowRunId,omitempty"` // +optional JobDisplayName string `json:"jobDisplayName,omitempty"` @@ -192,7 +192,7 @@ func (s *EphemeralRunnerStatus) LastFailure() metav1.Time { // EphemeralRunnerList contains a list of EphemeralRunner type EphemeralRunnerList struct { metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` + metav1.ListMeta `json:"metadata"` Items []EphemeralRunner `json:"items"` } diff --git a/apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go b/apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go index fc9ef2d7..ed5f2240 100644 --- a/apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go +++ b/apis/actions.github.com/v1alpha1/ephemeralrunnerset_types.go @@ -27,7 +27,7 @@ type EphemeralRunnerSetSpec struct { // PatchID is the unique identifier for the patch issued by the listener app PatchID int `json:"patchID"` // EphemeralRunnerSpec is the spec of the ephemeral runner - EphemeralRunnerSpec EphemeralRunnerSpec `json:"ephemeralRunnerSpec,omitempty"` + EphemeralRunnerSpec EphemeralRunnerSpec `json:"ephemeralRunnerSpec"` } // EphemeralRunnerSetStatus defines the observed state of EphemeralRunnerSet @@ -54,18 +54,18 @@ type EphemeralRunnerSetStatus struct { // EphemeralRunnerSet is the Schema for the ephemeralrunnersets API type EphemeralRunnerSet struct { metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` + metav1.ObjectMeta `json:"metadata"` - Spec EphemeralRunnerSetSpec `json:"spec,omitempty"` - Status EphemeralRunnerSetStatus `json:"status,omitempty"` + Spec EphemeralRunnerSetSpec `json:"spec"` + Status EphemeralRunnerSetStatus `json:"status"` } func (ers *EphemeralRunnerSet) GitHubConfigSecret() string { return ers.Spec.EphemeralRunnerSpec.GitHubConfigSecret } -func (ers *EphemeralRunnerSet) GitHubConfigUrl() string { - return ers.Spec.EphemeralRunnerSpec.GitHubConfigUrl +func (ers *EphemeralRunnerSet) GitHubConfigURL() string { + return ers.Spec.EphemeralRunnerSpec.GitHubConfigURL } func (ers *EphemeralRunnerSet) GitHubProxy() *ProxyConfig { @@ -91,7 +91,7 @@ func (ers *EphemeralRunnerSet) VaultProxy() *ProxyConfig { // +kubebuilder:object:root=true type EphemeralRunnerSetList struct { metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` + metav1.ListMeta `json:"metadata"` Items []EphemeralRunnerSet `json:"items"` } diff --git a/apis/actions.github.com/v1alpha1/groupversion_info.go b/apis/actions.github.com/v1alpha1/groupversion_info.go index e4256706..1b4da8fc 100644 --- a/apis/actions.github.com/v1alpha1/groupversion_info.go +++ b/apis/actions.github.com/v1alpha1/groupversion_info.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and 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 // +groupName=actions.github.com package v1alpha1 diff --git a/apis/actions.github.com/v1alpha1/proxy_config_test.go b/apis/actions.github.com/v1alpha1/proxy_config_test.go index 9291cde4..0357e5e2 100644 --- a/apis/actions.github.com/v1alpha1/proxy_config_test.go +++ b/apis/actions.github.com/v1alpha1/proxy_config_test.go @@ -14,11 +14,11 @@ import ( func TestProxyConfig_ToSecret(t *testing.T) { config := &v1alpha1.ProxyConfig{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: "http://proxy.example.com:8080", + URL: "http://proxy.example.com:8080", CredentialSecretRef: "my-secret", }, HTTPS: &v1alpha1.ProxyServerConfig{ - Url: "https://proxy.example.com:8080", + URL: "https://proxy.example.com:8080", CredentialSecretRef: "my-secret", }, NoProxy: []string{ @@ -48,11 +48,11 @@ func TestProxyConfig_ToSecret(t *testing.T) { func TestProxyConfig_ProxyFunc(t *testing.T) { config := &v1alpha1.ProxyConfig{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: "http://proxy.example.com:8080", + URL: "http://proxy.example.com:8080", CredentialSecretRef: "my-secret", }, HTTPS: &v1alpha1.ProxyServerConfig{ - Url: "https://proxy.example.com:8080", + URL: "https://proxy.example.com:8080", CredentialSecretRef: "my-secret", }, NoProxy: []string{ diff --git a/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml index 55b44f1e..69272ac5 100644 --- a/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml +++ b/charts/gha-runner-scale-set-controller/crds/actions.github.com_autoscalingrunnersets.yaml @@ -16323,6 +16323,8 @@ spec: It is used to identify which vault integration should be used to resolve secrets. type: string type: object + required: + - template type: object status: description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet @@ -16338,6 +16340,10 @@ spec: state: type: string type: object + required: + - metadata + - spec + - status type: object served: true storage: true diff --git a/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunners.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunners.yaml index f40bc35b..f08a8eb5 100644 --- a/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunners.yaml +++ b/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunners.yaml @@ -8271,6 +8271,10 @@ spec: format: int64 type: integer type: object + required: + - metadata + - spec + - status type: object served: true storage: true diff --git a/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml b/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml index b9ad3581..66341956 100644 --- a/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml +++ b/charts/gha-runner-scale-set-controller/crds/actions.github.com_ephemeralrunnersets.yaml @@ -8223,6 +8223,7 @@ spec: description: Replicas is the number of desired EphemeralRunner resources in the k8s namespace. type: integer required: + - ephemeralRunnerSpec - patchID type: object status: @@ -8240,6 +8241,10 @@ spec: required: - currentReplicas type: object + required: + - metadata + - spec + - status type: object served: true storage: true diff --git a/charts/gha-runner-scale-set-dev/templates/autoscalingrunnserset.yaml b/charts/gha-runner-scale-set-dev/templates/autoscalingrunnserset.yaml index 6dd601d2..78eee89d 100644 --- a/charts/gha-runner-scale-set-dev/templates/autoscalingrunnserset.yaml +++ b/charts/gha-runner-scale-set-dev/templates/autoscalingrunnserset.yaml @@ -5,6 +5,14 @@ metadata: namespace: {{ include "autoscaling-runner-set.namespace" . | quote }} labels: {{- 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: githubConfigUrl: {{ required ".Values.auth.url is required" (trimSuffix "/" .Values.auth.url) | quote }} diff --git a/charts/gha-runner-scale-set/tests/template_test.go b/charts/gha-runner-scale-set/tests/template_test.go index 7a657475..da1bed48 100644 --- a/charts/gha-runner-scale-set/tests/template_test.go +++ b/charts/gha-runner-scale-set/tests/template_test.go @@ -403,7 +403,7 @@ func TestTemplateRenderedAutoScalingRunnerSet(t *testing.T) { assert.Equal(t, "autoscaling-runner-set", ars.Labels["app.kubernetes.io/component"]) 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.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, namespaceName, ars.Labels["actions.github.com/scale-set-namespace"]) 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, "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/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.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/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.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/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.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/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) } @@ -1224,11 +1224,11 @@ func TestTemplateRenderedWithProxy(t *testing.T) { require.NotNil(t, ars.Spec.Proxy) 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) 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) 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, "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) { diff --git a/cmd/ghalistener/worker/worker.go b/cmd/ghalistener/worker/worker.go index 1f2322f9..42b21dbe 100644 --- a/cmd/ghalistener/worker/worker.go +++ b/cmd/ghalistener/worker/worker.go @@ -114,10 +114,10 @@ func (w *Worker) HandleJobStarted(ctx context.Context, jobInfo *actions.JobStart patch, err := json.Marshal( &v1alpha1.EphemeralRunner{ Status: v1alpha1.EphemeralRunnerStatus{ - JobRequestId: jobInfo.RunnerRequestID, + JobRequestID: jobInfo.RunnerRequestID, JobRepositoryName: fmt.Sprintf("%s/%s", jobInfo.OwnerName, jobInfo.RepositoryName), JobID: jobInfo.JobID, - WorkflowRunId: jobInfo.WorkflowRunID, + WorkflowRunID: jobInfo.WorkflowRunID, JobWorkflowRef: jobInfo.JobWorkflowRef, JobDisplayName: jobInfo.JobDisplayName, }, diff --git a/config/crd/bases/actions.github.com_autoscalingrunnersets.yaml b/config/crd/bases/actions.github.com_autoscalingrunnersets.yaml index 55b44f1e..69272ac5 100644 --- a/config/crd/bases/actions.github.com_autoscalingrunnersets.yaml +++ b/config/crd/bases/actions.github.com_autoscalingrunnersets.yaml @@ -16323,6 +16323,8 @@ spec: It is used to identify which vault integration should be used to resolve secrets. type: string type: object + required: + - template type: object status: description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet @@ -16338,6 +16340,10 @@ spec: state: type: string type: object + required: + - metadata + - spec + - status type: object served: true storage: true diff --git a/config/crd/bases/actions.github.com_ephemeralrunners.yaml b/config/crd/bases/actions.github.com_ephemeralrunners.yaml index f40bc35b..f08a8eb5 100644 --- a/config/crd/bases/actions.github.com_ephemeralrunners.yaml +++ b/config/crd/bases/actions.github.com_ephemeralrunners.yaml @@ -8271,6 +8271,10 @@ spec: format: int64 type: integer type: object + required: + - metadata + - spec + - status type: object served: true storage: true diff --git a/config/crd/bases/actions.github.com_ephemeralrunnersets.yaml b/config/crd/bases/actions.github.com_ephemeralrunnersets.yaml index b9ad3581..66341956 100644 --- a/config/crd/bases/actions.github.com_ephemeralrunnersets.yaml +++ b/config/crd/bases/actions.github.com_ephemeralrunnersets.yaml @@ -8223,6 +8223,7 @@ spec: description: Replicas is the number of desired EphemeralRunner resources in the k8s namespace. type: integer required: + - ephemeralRunnerSpec - patchID type: object status: @@ -8240,6 +8241,10 @@ spec: required: - currentReplicas type: object + required: + - metadata + - spec + - status type: object served: true storage: true diff --git a/controllers/actions.github.com/autoscalinglistener_controller.go b/controllers/actions.github.com/autoscalinglistener_controller.go index 4c8ed34a..beb4dabf 100644 --- a/controllers/actions.github.com/autoscalinglistener_controller.go +++ b/controllers/actions.github.com/autoscalinglistener_controller.go @@ -668,7 +668,7 @@ func (r *AutoscalingListenerReconciler) createRoleBindingForListener(ctx context } func (r *AutoscalingListenerReconciler) publishRunningListener(autoscalingListener *v1alpha1.AutoscalingListener, isUp bool) error { - githubConfigURL := autoscalingListener.Spec.GitHubConfigUrl + githubConfigURL := autoscalingListener.Spec.GitHubConfigURL parsedURL, err := actions.ParseGitHubConfigFromURL(githubConfigURL) if err != nil { return err diff --git a/controllers/actions.github.com/autoscalinglistener_controller_test.go b/controllers/actions.github.com/autoscalinglistener_controller_test.go index 7bc8ce50..0aa6adf2 100644 --- a/controllers/actions.github.com/autoscalinglistener_controller_test.go +++ b/controllers/actions.github.com/autoscalinglistener_controller_test.go @@ -66,7 +66,7 @@ var _ = Describe("Test AutoScalingListener controller", func() { Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, @@ -92,9 +92,9 @@ var _ = Describe("Test AutoScalingListener controller", func() { Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingListenerSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, - RunnerScaleSetId: 1, + RunnerScaleSetID: 1, AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace, AutoscalingRunnerSetName: autoscalingRunnerSet.Name, EphemeralRunnerSetName: "test-ers", @@ -482,7 +482,7 @@ var _ = Describe("Test AutoScalingListener customization", func() { Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, @@ -508,9 +508,9 @@ var _ = Describe("Test AutoScalingListener customization", func() { Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingListenerSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, - RunnerScaleSetId: 1, + RunnerScaleSetID: 1, AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace, AutoscalingRunnerSetName: autoscalingRunnerSet.Name, EphemeralRunnerSetName: "test-ers", @@ -740,7 +740,7 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() { Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, @@ -767,9 +767,9 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() { Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingListenerSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, - RunnerScaleSetId: 1, + RunnerScaleSetID: 1, AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace, AutoscalingRunnerSetName: autoscalingRunnerSet.Name, EphemeralRunnerSetName: "test-ers", @@ -823,11 +823,11 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() { proxy := &v1alpha1.ProxyConfig{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: "http://localhost:8080", + URL: "http://localhost:8080", CredentialSecretRef: "proxy-credentials", }, HTTPS: &v1alpha1.ProxyServerConfig{ - Url: "https://localhost:8443", + URL: "https://localhost:8443", CredentialSecretRef: "proxy-credentials", }, NoProxy: []string{ @@ -942,7 +942,7 @@ var _ = Describe("Test AutoScalingListener controller with template modification Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, @@ -969,9 +969,9 @@ var _ = Describe("Test AutoScalingListener controller with template modification Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingListenerSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, - RunnerScaleSetId: 1, + RunnerScaleSetID: 1, AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace, AutoscalingRunnerSetName: autoscalingRunnerSet.Name, EphemeralRunnerSetName: "test-ers", @@ -1137,7 +1137,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() { Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, GitHubServerTLS: &v1alpha1.TLSConfig{ CertificateFrom: &v1alpha1.TLSCertificateSource{ @@ -1173,7 +1173,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() { Namespace: autoscalingNS.Name, }, Spec: v1alpha1.AutoscalingListenerSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, GitHubServerTLS: &v1alpha1.TLSConfig{ CertificateFrom: &v1alpha1.TLSCertificateSource{ @@ -1185,7 +1185,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() { }, }, }, - RunnerScaleSetId: 1, + RunnerScaleSetID: 1, AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace, AutoscalingRunnerSetName: autoscalingRunnerSet.Name, EphemeralRunnerSetName: "test-ers", diff --git a/controllers/actions.github.com/autoscalingrunnerset_controller.go b/controllers/actions.github.com/autoscalingrunnerset_controller.go index bcab0c01..90267e33 100644 --- a/controllers/actions.github.com/autoscalingrunnerset_controller.go +++ b/controllers/actions.github.com/autoscalingrunnerset_controller.go @@ -468,7 +468,7 @@ func (r *AutoscalingRunnerSetReconciler) createRunnerScaleSet(ctx context.Contex obj.Annotations[AnnotationKeyGitHubRunnerScaleSetName] = runnerScaleSet.Name obj.Annotations[runnerScaleSetIDAnnotationKey] = strconv.Itoa(runnerScaleSet.Id) 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") } }); err != nil { diff --git a/controllers/actions.github.com/autoscalingrunnerset_controller_test.go b/controllers/actions.github.com/autoscalingrunnerset_controller_test.go index 620f3ab5..7e869354 100644 --- a/controllers/actions.github.com/autoscalingrunnerset_controller_test.go +++ b/controllers/actions.github.com/autoscalingrunnerset_controller_test.go @@ -90,7 +90,7 @@ var _ = Describe("Test AutoScalingRunnerSet controller", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, @@ -734,7 +734,7 @@ var _ = Describe("Test AutoScalingController updates", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, @@ -854,7 +854,7 @@ var _ = Describe("Test AutoscalingController creation failures", Ordered, func() }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", MaxRunners: &max, MinRunners: &min, RunnerGroup: "testgroup", @@ -992,14 +992,14 @@ var _ = Describe("Test client optional configuration", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "http://example.com/org/repo", + GitHubConfigURL: "http://example.com/org/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, RunnerGroup: "testgroup", Proxy: &v1alpha1.ProxyConfig{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: proxy.URL, + URL: proxy.URL, }, }, Template: corev1.PodTemplateSpec{ @@ -1071,14 +1071,14 @@ var _ = Describe("Test client optional configuration", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "http://example.com/org/repo", + GitHubConfigURL: "http://example.com/org/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, RunnerGroup: "testgroup", Proxy: &v1alpha1.ProxyConfig{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: proxy.URL, + URL: proxy.URL, CredentialSecretRef: "proxy-credentials", }, }, @@ -1198,7 +1198,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: server.ConfigURLForOrg("my-org"), + GitHubConfigURL: server.ConfigURLForOrg("my-org"), GitHubConfigSecret: configSecret.Name, GitHubServerTLS: &v1alpha1.TLSConfig{ CertificateFrom: &v1alpha1.TLSCertificateSource{ @@ -1251,7 +1251,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, GitHubServerTLS: &v1alpha1.TLSConfig{ CertificateFrom: &v1alpha1.TLSCertificateSource{ @@ -1315,7 +1315,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, GitHubServerTLS: &v1alpha1.TLSConfig{ CertificateFrom: &v1alpha1.TLSCertificateSource{ @@ -1419,7 +1419,7 @@ var _ = Describe("Test external permissions cleanup", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, @@ -1583,7 +1583,7 @@ var _ = Describe("Test external permissions cleanup", Ordered, func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", MaxRunners: &max, MinRunners: &min, RunnerGroup: "testgroup", @@ -1799,7 +1799,7 @@ var _ = Describe("Test resource version and build version mismatch", func() { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, MaxRunners: &max, MinRunners: &min, diff --git a/controllers/actions.github.com/ephemeralrunner_controller.go b/controllers/actions.github.com/ephemeralrunner_controller.go index 4d0d978f..921679e7 100644 --- a/controllers/actions.github.com/ephemeralrunner_controller.go +++ b/controllers/actions.github.com/ephemeralrunner_controller.go @@ -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") runnerID, err := strconv.Atoi(string(secret.Data["runnerId"])) if err != nil { @@ -217,12 +217,12 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ runnerName := string(secret.Data["runnerName"]) if err := patchSubResource(ctx, r.Status(), ephemeralRunner, func(obj *v1alpha1.EphemeralRunner) { - obj.Status.RunnerId = runnerID + obj.Status.RunnerID = runnerID obj.Status.RunnerName = runnerName }); err != nil { 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 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") 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") 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 log.Info("Created ephemeral runner JIT config", "runnerId", jitConfig.Runner.Id) 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) - if existingRunner.RunnerScaleSetId == ephemeralRunner.Spec.RunnerScaleSetId { + if existingRunner.RunnerScaleSetId == ephemeralRunner.Spec.RunnerScaleSetID { log.Info("Removing the runner with the same name") err := actionsClient.RemoveRunner(ctx, int64(existingRunner.Id)) if err != nil { @@ -731,10 +731,10 @@ func (r *EphemeralRunnerReconciler) createPod(ctx context.Context, runner *v1alp } log.Info("Created ephemeral runner pod", - "runnerScaleSetId", runner.Spec.RunnerScaleSetId, + "runnerScaleSetId", runner.Spec.RunnerScaleSetID, "runnerName", runner.Status.RunnerName, - "runnerId", runner.Status.RunnerId, - "configUrl", runner.Spec.GitHubConfigUrl, + "runnerId", runner.Status.RunnerID, + "configUrl", runner.Spec.GitHubConfigURL, "podName", newPod.Name) 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) } - log.Info("Removing runner from the service", "runnerId", ephemeralRunner.Status.RunnerId) - err = client.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerId)) + log.Info("Removing runner from the service", "runnerId", ephemeralRunner.Status.RunnerID) + err = client.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerID)) if err != nil { 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 } diff --git a/controllers/actions.github.com/ephemeralrunner_controller_test.go b/controllers/actions.github.com/ephemeralrunner_controller_test.go index 5ee0df03..8f67e103 100644 --- a/controllers/actions.github.com/ephemeralrunner_controller_test.go +++ b/controllers/actions.github.com/ephemeralrunner_controller_test.go @@ -41,9 +41,9 @@ func newExampleRunner(name, namespace, configSecretName string) *v1alpha1.Epheme Namespace: namespace, }, Spec: v1alpha1.EphemeralRunnerSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecretName, - RunnerScaleSetId: 1, + RunnerScaleSetID: 1, PodTemplateSpec: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{ Containers: []corev1.Container{ @@ -667,7 +667,7 @@ var _ = Describe("EphemeralRunner", func() { if err != nil { return 0, err } - return updatedEphemeralRunner.Status.RunnerId, nil + return updatedEphemeralRunner.Status.RunnerID, nil }, ephemeralRunnerTimeout, ephemeralRunnerInterval, @@ -1234,10 +1234,10 @@ var _ = Describe("EphemeralRunner", func() { Expect(err).NotTo(HaveOccurred(), "failed to create secret credentials") 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{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: proxy.URL, + URL: proxy.URL, CredentialSecretRef: "proxy-credentials", }, } @@ -1258,10 +1258,10 @@ var _ = Describe("EphemeralRunner", func() { ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name) ephemeralRunner.Spec.Proxy = &v1alpha1.ProxyConfig{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: "http://proxy.example.com:8080", + URL: "http://proxy.example.com:8080", }, HTTPS: &v1alpha1.ProxyServerConfig{ - Url: "http://proxy.example.com:8080", + URL: "http://proxy.example.com:8080", }, NoProxy: []string{"example.com"}, } @@ -1398,7 +1398,7 @@ var _ = Describe("EphemeralRunner", func() { } 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{ CertificateFrom: &v1alpha1.TLSCertificateSource{ ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ diff --git a/controllers/actions.github.com/ephemeralrunnerset_controller.go b/controllers/actions.github.com/ephemeralrunnerset_controller.go index 22730c96..11b818b5 100644 --- a/controllers/actions.github.com/ephemeralrunnerset_controller.go +++ b/controllers/actions.github.com/ephemeralrunnerset_controller.go @@ -167,7 +167,7 @@ func (r *EphemeralRunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.R ) if r.PublishMetrics { - githubConfigURL := ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubConfigUrl + githubConfigURL := ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubConfigURL parsedURL, err := actions.ParseGitHubConfigFromURL(githubConfigURL) if err != nil { log.Error(err, "Github Config URL is invalid", "URL", githubConfigURL) @@ -448,7 +448,7 @@ func (r *EphemeralRunnerSetReconciler) deleteIdleEphemeralRunners(ctx context.Co for runners.next() { ephemeralRunner := runners.object() 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) continue } @@ -457,7 +457,7 @@ func (r *EphemeralRunnerSetReconciler) deleteIdleEphemeralRunners(ctx context.Co log.Info( "Skipping ephemeral runner since it is running a job", "name", ephemeralRunner.Name, - "workflowRunId", ephemeralRunner.Status.WorkflowRunId, + "workflowRunId", ephemeralRunner.Status.WorkflowRunID, "jobId", ephemeralRunner.Status.JobID, ) 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) { - 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{} 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 } if actionsError.StatusCode == http.StatusBadRequest && 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, 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) { 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 } diff --git a/controllers/actions.github.com/ephemeralrunnerset_controller_test.go b/controllers/actions.github.com/ephemeralrunnerset_controller_test.go index 443863eb..d0dadee8 100644 --- a/controllers/actions.github.com/ephemeralrunnerset_controller_test.go +++ b/controllers/actions.github.com/ephemeralrunnerset_controller_test.go @@ -73,9 +73,9 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { }, Spec: v1alpha1.EphemeralRunnerSetSpec{ EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ - GitHubConfigUrl: "https://github.com/owner/repo", + GitHubConfigURL: "https://github.com/owner/repo", GitHubConfigSecret: configSecret.Name, - RunnerScaleSetId: 100, + RunnerScaleSetID: 100, PodTemplateSpec: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{ Containers: []corev1.Container{ @@ -158,10 +158,10 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { // Set status to simulate a configured EphemeralRunner refetch := false for i, runner := range runnerList.Items { - if runner.Status.RunnerId == 0 { + if runner.Status.RunnerID == 0 { updatedRunner := runner.DeepCopy() updatedRunner.Status.Phase = corev1.PodRunning - updatedRunner.Status.RunnerId = i + 100 + updatedRunner.Status.RunnerID = i + 100 err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner)) Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") refetch = true @@ -218,10 +218,10 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { // Set status to simulate a configured EphemeralRunner refetch := false for i, runner := range runnerList.Items { - if runner.Status.RunnerId == 0 { + if runner.Status.RunnerID == 0 { updatedRunner := runner.DeepCopy() updatedRunner.Status.Phase = corev1.PodRunning - updatedRunner.Status.RunnerId = i + 100 + updatedRunner.Status.RunnerID = i + 100 err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner)) Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") 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. updatedRunner = runnerList.Items[0].DeepCopy() - updatedRunner.Status.RunnerId = 1 + updatedRunner.Status.RunnerID = 1 err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[0])) Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") updatedRunner = runnerList.Items[1].DeepCopy() - updatedRunner.Status.RunnerId = 2 + updatedRunner.Status.RunnerID = 2 err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[1])) Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") @@ -942,7 +942,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { var failedOriginal *v1alpha1.EphemeralRunner var empty []*v1alpha1.EphemeralRunner for _, runner := range runnerList.Items { - switch runner.Status.RunnerId { + switch runner.Status.RunnerID { case 101: pendingOriginal = runner.DeepCopy() case 102: @@ -961,7 +961,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { empty = empty[1:] pending := pendingOriginal.DeepCopy() - pending.Status.RunnerId = 101 + pending.Status.RunnerID = 101 pending.Status.Phase = corev1.PodPending err = k8sClient.Status().Patch(ctx, pending, client.MergeFrom(pendingOriginal)) @@ -975,7 +975,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { runningOriginal = empty[0] empty = empty[1:] running := runningOriginal.DeepCopy() - running.Status.RunnerId = 102 + running.Status.RunnerID = 102 running.Status.Phase = corev1.PodRunning err = k8sClient.Status().Patch(ctx, running, client.MergeFrom(runningOriginal)) @@ -989,7 +989,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() { failedOriginal = empty[0] failed := pendingOriginal.DeepCopy() - failed.Status.RunnerId = 103 + failed.Status.RunnerID = 103 failed.Status.Phase = corev1.PodFailed 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{ Replicas: 1, EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ - GitHubConfigUrl: "http://example.com/owner/repo", + GitHubConfigURL: "http://example.com/owner/repo", GitHubConfigSecret: configSecret.Name, - RunnerScaleSetId: 100, + RunnerScaleSetID: 100, Proxy: &v1alpha1.ProxyConfig{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: "http://proxy.example.com", + URL: "http://proxy.example.com", CredentialSecretRef: secretCredentials.Name, }, HTTPS: &v1alpha1.ProxyServerConfig{ - Url: "https://proxy.example.com", + URL: "https://proxy.example.com", CredentialSecretRef: secretCredentials.Name, }, 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 refetch := false for i, runner := range runnerList.Items { - if runner.Status.RunnerId == 0 { + if runner.Status.RunnerID == 0 { updatedRunner := runner.DeepCopy() updatedRunner.Status.Phase = corev1.PodSucceeded - updatedRunner.Status.RunnerId = i + 100 + updatedRunner.Status.RunnerID = i + 100 err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner)) Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner") refetch = true @@ -1317,12 +1317,12 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( Spec: v1alpha1.EphemeralRunnerSetSpec{ Replicas: 1, EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ - GitHubConfigUrl: "http://example.com/owner/repo", + GitHubConfigURL: "http://example.com/owner/repo", GitHubConfigSecret: configSecret.Name, - RunnerScaleSetId: 100, + RunnerScaleSetID: 100, Proxy: &v1alpha1.ProxyConfig{ HTTP: &v1alpha1.ProxyServerConfig{ - Url: proxy.URL, + URL: proxy.URL, CredentialSecretRef: "proxy-credentials", }, }, @@ -1358,7 +1358,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( runner := runnerList.Items[0].DeepCopy() runner.Status.Phase = corev1.PodRunning - runner.Status.RunnerId = 100 + runner.Status.RunnerID = 100 err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0])) 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{ Replicas: 1, EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ - GitHubConfigUrl: server.ConfigURLForOrg("my-org"), + GitHubConfigURL: server.ConfigURLForOrg("my-org"), GitHubConfigSecret: configSecret.Name, GitHubServerTLS: &v1alpha1.TLSConfig{ CertificateFrom: &v1alpha1.TLSCertificateSource{ @@ -1472,7 +1472,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func( }, }, }, - RunnerScaleSetId: 100, + RunnerScaleSetID: 100, PodTemplateSpec: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{ 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") runner.Status.Phase = corev1.PodRunning - runner.Status.RunnerId = 100 + runner.Status.RunnerID = 100 err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0])) Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status") diff --git a/controllers/actions.github.com/resourcebuilder.go b/controllers/actions.github.com/resourcebuilder.go index 98b894a6..7daf3253 100644 --- a/controllers/actions.github.com/resourcebuilder.go +++ b/controllers/actions.github.com/resourcebuilder.go @@ -109,7 +109,7 @@ func (b *ResourceBuilder) newAutoScalingListener(autoscalingRunnerSet *v1alpha1. 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) } @@ -121,10 +121,10 @@ func (b *ResourceBuilder) newAutoScalingListener(autoscalingRunnerSet *v1alpha1. Annotations: annotations, }, Spec: v1alpha1.AutoscalingListenerSpec{ - GitHubConfigUrl: autoscalingRunnerSet.Spec.GitHubConfigUrl, + GitHubConfigURL: autoscalingRunnerSet.Spec.GitHubConfigURL, GitHubConfigSecret: autoscalingRunnerSet.Spec.GitHubConfigSecret, VaultConfig: autoscalingRunnerSet.VaultConfig(), - RunnerScaleSetId: runnerScaleSetID, + RunnerScaleSetID: runnerScaleSetID, AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace, AutoscalingRunnerSetName: autoscalingRunnerSet.Name, EphemeralRunnerSetName: ephemeralRunnerSet.Name, @@ -174,12 +174,12 @@ func (b *ResourceBuilder) newScaleSetListenerConfig(autoscalingListener *v1alpha } config := ghalistenerconfig.Config{ - ConfigureUrl: autoscalingListener.Spec.GitHubConfigUrl, + ConfigureUrl: autoscalingListener.Spec.GitHubConfigURL, EphemeralRunnerSetNamespace: autoscalingListener.Spec.AutoscalingRunnerSetNamespace, EphemeralRunnerSetName: autoscalingListener.Spec.EphemeralRunnerSetName, MaxRunners: autoscalingListener.Spec.MaxRunners, MinRunners: autoscalingListener.Spec.MinRunners, - RunnerScaleSetId: autoscalingListener.Spec.RunnerScaleSetId, + RunnerScaleSetId: autoscalingListener.Spec.RunnerScaleSetID, RunnerScaleSetName: autoscalingListener.Spec.AutoscalingRunnerSetName, ServerRootCA: cert, LogLevel: scaleSetListenerLogLevel, @@ -509,7 +509,7 @@ func (b *ResourceBuilder) newEphemeralRunnerSet(autoscalingRunnerSet *v1alpha1.A 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) } @@ -540,8 +540,8 @@ func (b *ResourceBuilder) newEphemeralRunnerSet(autoscalingRunnerSet *v1alpha1.A Spec: v1alpha1.EphemeralRunnerSetSpec{ Replicas: 0, EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{ - RunnerScaleSetId: runnerScaleSetID, - GitHubConfigUrl: autoscalingRunnerSet.Spec.GitHubConfigUrl, + RunnerScaleSetID: runnerScaleSetID, + GitHubConfigURL: autoscalingRunnerSet.Spec.GitHubConfigURL, GitHubConfigSecret: autoscalingRunnerSet.Spec.GitHubConfigSecret, Proxy: autoscalingRunnerSet.Spec.Proxy, GitHubServerTLS: autoscalingRunnerSet.Spec.GitHubServerTLS, @@ -689,7 +689,7 @@ func scaleSetListenerName(autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet) s hashSuffix( autoscalingRunnerSet.Namespace, autoscalingRunnerSet.Spec.RunnerGroup, - autoscalingRunnerSet.Spec.GitHubConfigUrl, + autoscalingRunnerSet.Spec.GitHubConfigURL, ), ) } diff --git a/controllers/actions.github.com/resourcebuilder_test.go b/controllers/actions.github.com/resourcebuilder_test.go index b4c11466..2a5247e2 100644 --- a/controllers/actions.github.com/resourcebuilder_test.go +++ b/controllers/actions.github.com/resourcebuilder_test.go @@ -33,7 +33,7 @@ func TestLabelPropagation(t *testing.T) { }, }, 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) { autoscalingRunnerSet := autoscalingRunnerSet.DeepCopy() 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 @@ -157,7 +157,7 @@ func TestGitHubURLTrimLabelValues(t *testing.T) { t.Run("enterprise", func(t *testing.T) { autoscalingRunnerSet := autoscalingRunnerSet.DeepCopy() 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 @@ -196,7 +196,7 @@ func TestOwnershipRelationships(t *testing.T) { }, }, Spec: v1alpha1.AutoscalingRunnerSetSpec{ - GitHubConfigUrl: "https://github.com/org/repo", + GitHubConfigURL: "https://github.com/org/repo", }, } diff --git a/controllers/actions.github.com/secret_resolver.go b/controllers/actions.github.com/secret_resolver.go index d5a4af08..b59793dc 100644 --- a/controllers/actions.github.com/secret_resolver.go +++ b/controllers/actions.github.com/secret_resolver.go @@ -45,7 +45,7 @@ func NewSecretResolver(k8sClient client.Client, multiClient actions.MultiClient, type ActionsGitHubObject interface { client.Object - GitHubConfigUrl() string + GitHubConfigURL() string GitHubConfigSecret() string GitHubProxy() *v1alpha1.ProxyConfig GitHubServerTLS() *v1alpha1.TLSConfig @@ -85,9 +85,9 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH } if proxy.HTTP != nil { - u, err := url.Parse(proxy.HTTP.Url) + u, err := url.Parse(proxy.HTTP.URL) 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 != "" { @@ -101,9 +101,9 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH } if proxy.HTTPS != nil { - u, err := url.Parse(proxy.HTTPS.Url) + u, err := url.Parse(proxy.HTTPS.URL) 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 != "" { @@ -150,7 +150,7 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH return sr.multiClient.GetClientFor( ctx, - obj.GitHubConfigUrl(), + obj.GitHubConfigURL(), appConfig, obj.GetNamespace(), clientOptions...,