Rename Id and Url fields to ID and URL per convention

This commit is contained in:
Nikola Jokic
2026-01-15 19:16:07 +01:00
parent 0bb603edc8
commit ffcaa06b6a
26 changed files with 193 additions and 155 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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