diff --git a/api/v1/inline_types.go b/api/v1/inline_types.go index 8eb53405..a07b8ff9 100644 --- a/api/v1/inline_types.go +++ b/api/v1/inline_types.go @@ -164,6 +164,24 @@ type BaseAgentSpec struct { // Sets the INSTANA_MVN_REPOSITORY_SHARED_PATH environment variable // +kubebuilder:validation:Optional MvnRepoSharedPath string `json:"instanaMvnRepoSharedPath,omitempty"` + // Sets the INSTANA_FEATURES_REPOSITORY_MIRROR_URL environment variable + // +kubebuilder:validation:Optional + MirrorFeaturesRepoUrl string `json:"instanaFeaturesRepoMirrorUrl,omitempty"` + // Sets the INSTANA_FEATURES_REPOSITORY_MIRROR_USERNAME environment variable + // +kubebuilder:validation:Optional + MirrorFeaturesRepoUsername string `json:"instanaFeaturesRepoMirrorUsername,omitempty"` + // Sets the INSTANA_FEATURES_REPOSITORY_MIRROR_PASSWORD environment variable + // +kubebuilder:validation:Optional + MirrorFeaturesRepoPassword string `json:"instanaFeaturesRepoMirrorPassword,omitempty"` + // Sets the INSTANA_SHARED_REPOSITORY_MIRROR_URL environment variable + // +kubebuilder:validation:Optional + MirrorSharedRepoUrl string `json:"instanaSharedRepoMirrorUrl,omitempty"` + // Sets the INSTANA_SHARED_REPOSITORY_MIRROR_USERNAME environment variable + // +kubebuilder:validation:Optional + MirrorSharedRepoUsername string `json:"instanaSharedRepoMirrorUsername,omitempty"` + // Sets the INSTANA_SHARED_REPOSITORY_MIRROR_PASSWORD environment variable + // +kubebuilder:validation:Optional + MirrorSharedRepoPassword string `json:"instanaSharedRepoMirrorPassword,omitempty"` } type ResourceRequirements corev1.ResourceRequirements diff --git a/pkg/k8s/object/builders/agent/daemonset/daemonset.go b/pkg/k8s/object/builders/agent/daemonset/daemonset.go index d78755b3..7ae5091b 100644 --- a/pkg/k8s/object/builders/agent/daemonset/daemonset.go +++ b/pkg/k8s/object/builders/agent/daemonset/daemonset.go @@ -83,6 +83,12 @@ func (d *daemonSetBuilder) getEnvVars() []corev1.EnvVar { env.MavenRepoURLEnv, env.MavenRepoFeaturesPath, env.MavenRepoSharedPath, + env.MirrorFeaturesRepoUrlEnv, + env.MirrorFeaturesRepoUsernameEnv, + env.MirrorFeaturesRepoPasswordEnv, + env.MirrorSharedRepoUrlEnv, + env.MirrorSharedRepoUsernameEnv, + env.MirrorSharedRepoPasswordEnv, env.ProxyHostEnv, env.ProxyPortEnv, env.ProxyProtocolEnv, diff --git a/pkg/k8s/object/builders/agent/daemonset/daemonset_test.go b/pkg/k8s/object/builders/agent/daemonset/daemonset_test.go index e381710e..6cad4d9d 100644 --- a/pkg/k8s/object/builders/agent/daemonset/daemonset_test.go +++ b/pkg/k8s/object/builders/agent/daemonset/daemonset_test.go @@ -152,6 +152,12 @@ func TestDaemonSetBuilder_getEnvVars(t *testing.T) { env.MavenRepoURLEnv, env.MavenRepoFeaturesPath, env.MavenRepoSharedPath, + env.MirrorFeaturesRepoUrlEnv, + env.MirrorFeaturesRepoUsernameEnv, + env.MirrorFeaturesRepoPasswordEnv, + env.MirrorSharedRepoUrlEnv, + env.MirrorSharedRepoUsernameEnv, + env.MirrorSharedRepoPasswordEnv, env.ProxyHostEnv, env.ProxyPortEnv, env.ProxyProtocolEnv, diff --git a/pkg/k8s/object/builders/common/env/env_builder.go b/pkg/k8s/object/builders/common/env/env_builder.go index 3b272840..bcda9873 100644 --- a/pkg/k8s/object/builders/common/env/env_builder.go +++ b/pkg/k8s/object/builders/common/env/env_builder.go @@ -29,6 +29,12 @@ const ( MavenRepoURLEnv MavenRepoFeaturesPath MavenRepoSharedPath + MirrorFeaturesRepoUrlEnv + MirrorFeaturesRepoUsernameEnv + MirrorFeaturesRepoPasswordEnv + MirrorSharedRepoUrlEnv + MirrorSharedRepoUsernameEnv + MirrorSharedRepoPasswordEnv ProxyHostEnv ProxyPortEnv ProxyProtocolEnv @@ -107,6 +113,18 @@ func (e *envBuilder) build(envVar EnvVar) *corev1.EnvVar { return stringToEnvVar("INSTANA_MVN_REPOSITORY_FEATURES_PATH", e.agent.Spec.Agent.MvnRepoFeaturesPath) case MavenRepoSharedPath: return stringToEnvVar("INSTANA_MVN_REPOSITORY_SHARED_PATH", e.agent.Spec.Agent.MvnRepoSharedPath) + case MirrorFeaturesRepoUrlEnv: + return stringToEnvVar("INSTANA_FEATURES_REPOSITORY_MIRROR_URL", e.agent.Spec.Agent.MirrorFeaturesRepoUrl) + case MirrorFeaturesRepoUsernameEnv: + return stringToEnvVar("INSTANA_FEATURES_REPOSITORY_MIRROR_USERNAME", e.agent.Spec.Agent.MirrorFeaturesRepoUsername) + case MirrorSharedRepoUrlEnv: + return stringToEnvVar("INSTANA_SHARED_REPOSITORY_MIRROR_URL", e.agent.Spec.Agent.MirrorSharedRepoUrl) + case MirrorSharedRepoUsernameEnv: + return stringToEnvVar("INSTANA_SHARED_REPOSITORY_MIRROR_USERNAME", e.agent.Spec.Agent.MirrorSharedRepoUsername) + case MirrorSharedRepoPasswordEnv: + return stringToEnvVar("INSTANA_SHARED_REPOSITORY_MIRROR_PASSWORD", e.agent.Spec.Agent.MirrorSharedRepoPassword) + case MirrorFeaturesRepoPasswordEnv: + return stringToEnvVar("INSTANA_FEATURES_REPOSITORY_MIRROR_PASSWORD", e.agent.Spec.Agent.MirrorFeaturesRepoPassword) case ProxyHostEnv: return stringToEnvVar("INSTANA_AGENT_PROXY_HOST", e.agent.Spec.Agent.ProxyHost) case ProxyPortEnv: diff --git a/pkg/k8s/object/builders/common/env/env_builder_test.go b/pkg/k8s/object/builders/common/env/env_builder_test.go index acde4760..ab6c6d7f 100644 --- a/pkg/k8s/object/builders/common/env/env_builder_test.go +++ b/pkg/k8s/object/builders/common/env/env_builder_test.go @@ -40,21 +40,27 @@ func TestEnvBuilderBuild(t *testing.T) { Zone: instanav1.Name{Name: "INSTANA_AGENT_SPEC_ZONE_NAME"}, Cluster: instanav1.Name{Name: "INSTANA_AGENT_SPEC_CLUSTER_NAME"}, Agent: instanav1.BaseAgentSpec{ - EndpointHost: "INSTANA_AGENT_ENDPOINT_HOST", - EndpointPort: "INSTANA_AGENT_ENDPOINT_PORT", - MvnRepoUrl: "INSTANA_MVN_REPOSITORY_URL", - MvnRepoFeaturesPath: "INSTANA_MVN_REPOSITORY_FEATURES_PATH", - MvnRepoSharedPath: "INSTANA_MVN_REPOSITORY_SHARED_PATH", - ProxyHost: "INSTANA_AGENT_PROXY_HOST", - ProxyPort: "", - ProxyProtocol: "INSTANA_AGENT_PROXY_PROTOCOL", - ProxyUser: "INSTANA_AGENT_PROXY_USER", - ProxyPassword: "INSTANA_AGENT_PROXY_PASSWORD", - ProxyUseDNS: true, - ListenAddress: "INSTANA_AGENT_HTTP_LISTEN", - RedactKubernetesSecrets: "INSTANA_KUBERNETES_REDACT_SECRETS", - Mode: "INSTANA_BASE_AGENT_SPEC_MODE", - KeysSecret: "INSTANA_AGENT_KEYS_SECRET", + EndpointHost: "INSTANA_AGENT_ENDPOINT_HOST", + EndpointPort: "INSTANA_AGENT_ENDPOINT_PORT", + MvnRepoUrl: "INSTANA_MVN_REPOSITORY_URL", + MvnRepoFeaturesPath: "INSTANA_MVN_REPOSITORY_FEATURES_PATH", + MvnRepoSharedPath: "INSTANA_MVN_REPOSITORY_SHARED_PATH", + MirrorFeaturesRepoUrl: "INSTANA_FEATURES_REPOSITORY_MIRROR_URL", + MirrorFeaturesRepoUsername: "INSTANA_FEATURES_REPOSITORY_MIRROR_USERNAME", + MirrorFeaturesRepoPassword: "INSTANA_FEATURES_REPOSITORY_MIRROR_PASSWORD", + MirrorSharedRepoUrl: "INSTANA_SHARED_REPOSITORY_MIRROR_URL", + MirrorSharedRepoUsername: "INSTANA_SHARED_REPOSITORY_MIRROR_USERNAME", + MirrorSharedRepoPassword: "INSTANA_SHARED_REPOSITORY_MIRROR_PASSWORD", + ProxyHost: "INSTANA_AGENT_PROXY_HOST", + ProxyPort: "", + ProxyProtocol: "INSTANA_AGENT_PROXY_PROTOCOL", + ProxyUser: "INSTANA_AGENT_PROXY_USER", + ProxyPassword: "INSTANA_AGENT_PROXY_PASSWORD", + ProxyUseDNS: true, + ListenAddress: "INSTANA_AGENT_HTTP_LISTEN", + RedactKubernetesSecrets: "INSTANA_KUBERNETES_REDACT_SECRETS", + Mode: "INSTANA_BASE_AGENT_SPEC_MODE", + KeysSecret: "INSTANA_AGENT_KEYS_SECRET", Env: map[string]string{ "USER_SPECIFIED_ENV_VAR1": "USER_SPECIFIED_ENV_VAR_VAL1", "USER_SPECIFIED_ENV_VAR2": "USER_SPECIFIED_ENV_VAR_VAL2", @@ -71,6 +77,12 @@ func TestEnvBuilderBuild(t *testing.T) { MavenRepoURLEnv, MavenRepoFeaturesPath, MavenRepoSharedPath, + MirrorFeaturesRepoUrlEnv, + MirrorFeaturesRepoUsernameEnv, + MirrorFeaturesRepoPasswordEnv, + MirrorSharedRepoUrlEnv, + MirrorSharedRepoUsernameEnv, + MirrorSharedRepoPasswordEnv, ProxyHostEnv, ProxyPortEnv, ProxyProtocolEnv, @@ -107,6 +119,12 @@ func TestEnvBuilderBuild(t *testing.T) { {Name: "INSTANA_MVN_REPOSITORY_URL", Value: "INSTANA_MVN_REPOSITORY_URL"}, {Name: "INSTANA_MVN_REPOSITORY_FEATURES_PATH", Value: "INSTANA_MVN_REPOSITORY_FEATURES_PATH"}, {Name: "INSTANA_MVN_REPOSITORY_SHARED_PATH", Value: "INSTANA_MVN_REPOSITORY_SHARED_PATH"}, + {Name: "INSTANA_FEATURES_REPOSITORY_MIRROR_URL", Value: "INSTANA_FEATURES_REPOSITORY_MIRROR_URL"}, + {Name: "INSTANA_FEATURES_REPOSITORY_MIRROR_USERNAME", Value: "INSTANA_FEATURES_REPOSITORY_MIRROR_USERNAME"}, + {Name: "INSTANA_FEATURES_REPOSITORY_MIRROR_PASSWORD", Value: "INSTANA_FEATURES_REPOSITORY_MIRROR_PASSWORD"}, + {Name: "INSTANA_SHARED_REPOSITORY_MIRROR_URL", Value: "INSTANA_SHARED_REPOSITORY_MIRROR_URL"}, + {Name: "INSTANA_SHARED_REPOSITORY_MIRROR_USERNAME", Value: "INSTANA_SHARED_REPOSITORY_MIRROR_USERNAME"}, + {Name: "INSTANA_SHARED_REPOSITORY_MIRROR_PASSWORD", Value: "INSTANA_SHARED_REPOSITORY_MIRROR_PASSWORD"}, {Name: "INSTANA_AGENT_PROXY_HOST", Value: "INSTANA_AGENT_PROXY_HOST"}, {Name: "INSTANA_AGENT_PROXY_PROTOCOL", Value: "INSTANA_AGENT_PROXY_PROTOCOL"}, {Name: "INSTANA_AGENT_PROXY_USER", Value: "INSTANA_AGENT_PROXY_USER"},