This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 360be86cd8c4a3b43a908cf286ae454f1ab39c46 Author: Antonin Stefanutti <[email protected]> AuthorDate: Tue Jan 11 13:32:45 2022 +0100 chore(api): Remove HTTP proxy Secret --- config/crd/bases/camel.apache.org_builds.yaml | 4 --- .../camel.apache.org_integrationplatforms.yaml | 4 --- helm/camel-k/crds/crd-build.yaml | 4 --- helm/camel-k/crds/crd-integration-platform.yaml | 4 --- pkg/apis/camel/v1/build_types.go | 16 +++++------- pkg/apis/camel/v1/integrationplatform_types.go | 1 - pkg/cmd/install.go | 7 ----- pkg/cmd/install_test.go | 7 ----- pkg/controller/build/build_pod.go | 30 ---------------------- pkg/trait/builder.go | 6 ++--- 10 files changed, 9 insertions(+), 74 deletions(-) diff --git a/config/crd/bases/camel.apache.org_builds.yaml b/config/crd/bases/camel.apache.org_builds.yaml index efac42c..d678755 100644 --- a/config/crd/bases/camel.apache.org_builds.yaml +++ b/config/crd/bases/camel.apache.org_builds.yaml @@ -98,8 +98,6 @@ spec: type: string contextDir: type: string - httpProxySecret: - type: string image: type: string name: @@ -437,8 +435,6 @@ spec: type: object contextDir: type: string - httpProxySecret: - type: string image: type: string name: diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/config/crd/bases/camel.apache.org_integrationplatforms.yaml index 1a0edd6..699fcd8 100644 --- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml +++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml @@ -76,8 +76,6 @@ spec: - routine - pod type: string - httpProxySecret: - type: string kanikoBuildCache: type: boolean maven: @@ -278,8 +276,6 @@ spec: - routine - pod type: string - httpProxySecret: - type: string kanikoBuildCache: type: boolean maven: diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml index efac42c..d678755 100644 --- a/helm/camel-k/crds/crd-build.yaml +++ b/helm/camel-k/crds/crd-build.yaml @@ -98,8 +98,6 @@ spec: type: string contextDir: type: string - httpProxySecret: - type: string image: type: string name: @@ -437,8 +435,6 @@ spec: type: object contextDir: type: string - httpProxySecret: - type: string image: type: string name: diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml index 1a0edd6..699fcd8 100644 --- a/helm/camel-k/crds/crd-integration-platform.yaml +++ b/helm/camel-k/crds/crd-integration-platform.yaml @@ -76,8 +76,6 @@ spec: - routine - pod type: string - httpProxySecret: - type: string kanikoBuildCache: type: boolean maven: @@ -278,8 +276,6 @@ spec: - routine - pod type: string - httpProxySecret: - type: string kanikoBuildCache: type: boolean maven: diff --git a/pkg/apis/camel/v1/build_types.go b/pkg/apis/camel/v1/build_types.go index 3f40acc..8b8d35a 100644 --- a/pkg/apis/camel/v1/build_types.go +++ b/pkg/apis/camel/v1/build_types.go @@ -83,19 +83,17 @@ type PublishTask struct { // BuildahTask -- type BuildahTask struct { - BaseTask `json:",inline"` - PublishTask `json:",inline"` - Verbose *bool `json:"verbose,omitempty"` - HttpProxySecret string `json:"httpProxySecret,omitempty"` + BaseTask `json:",inline"` + PublishTask `json:",inline"` + Verbose *bool `json:"verbose,omitempty"` } // KanikoTask -- type KanikoTask struct { - BaseTask `json:",inline"` - PublishTask `json:",inline"` - Verbose *bool `json:"verbose,omitempty"` - HttpProxySecret string `json:"httpProxySecret,omitempty"` - Cache KanikoTaskCache `json:"cache,omitempty"` + BaseTask `json:",inline"` + PublishTask `json:",inline"` + Verbose *bool `json:"verbose,omitempty"` + Cache KanikoTaskCache `json:"cache,omitempty"` } // KanikoTaskCache -- diff --git a/pkg/apis/camel/v1/integrationplatform_types.go b/pkg/apis/camel/v1/integrationplatform_types.go index 807cfd2..87c66ac 100644 --- a/pkg/apis/camel/v1/integrationplatform_types.go +++ b/pkg/apis/camel/v1/integrationplatform_types.go @@ -116,7 +116,6 @@ type IntegrationPlatformBuildSpec struct { Timeout *metav1.Duration `json:"timeout,omitempty"` PersistentVolumeClaim string `json:"persistentVolumeClaim,omitempty"` Maven MavenSpec `json:"maven,omitempty"` - HTTPProxySecret string `json:"httpProxySecret,omitempty"` KanikoBuildCache *bool `json:"kanikoBuildCache,omitempty"` } diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go index 6807324..99fe01f 100644 --- a/pkg/cmd/install.go +++ b/pkg/cmd/install.go @@ -104,8 +104,6 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) (*cobra.Command, *installCmdO cmd.Flags().String("build-timeout", "", "Set how long the build process can last") cmd.Flags().String("trait-profile", "", "The profile to use for traits") cmd.Flags().Bool("kaniko-build-cache", false, "To enable or disable the Kaniko cache") - cmd.Flags().String("http-proxy-secret", "", "Configure the source of the secret holding HTTP proxy server details "+ - "(HTTP_PROXY|HTTPS_PROXY|NO_PROXY)") // OLM cmd.Flags().Bool("olm", true, "Try to install everything via OLM (Operator Lifecycle Manager) if available") @@ -189,7 +187,6 @@ type installCmdOptions struct { TraitProfile string `mapstructure:"trait-profile"` Tolerations []string `mapstructure:"tolerations"` NodeSelectors []string `mapstructure:"node-selectors"` - HTTPProxySecret string `mapstructure:"http-proxy-secret"` ResourcesRequirements []string `mapstructure:"operator-resources"` EnvVars []string `mapstructure:"operator-env-vars"` @@ -422,10 +419,6 @@ func (o *installCmdOptions) install(cobraCmd *cobra.Command, _ []string) error { platform.Spec.Build.Maven.CASecret = secret } - if o.HTTPProxySecret != "" { - platform.Spec.Build.HTTPProxySecret = o.HTTPProxySecret - } - if o.ClusterType != "" { for _, c := range v1.AllIntegrationPlatformClusters { if strings.EqualFold(string(c), o.ClusterType) { diff --git a/pkg/cmd/install_test.go b/pkg/cmd/install_test.go index 8c4e587..58fe06e 100644 --- a/pkg/cmd/install_test.go +++ b/pkg/cmd/install_test.go @@ -156,13 +156,6 @@ func TestInstallHealthFlag(t *testing.T) { assert.Equal(t, int32(7777), installCmdOptions.HealthPort) } -func TestInstallHttpProxySecretFlag(t *testing.T) { - installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t) - _, err := test.ExecuteCommand(rootCmd, cmdInstall, "--http-proxy-secret", "someString") - assert.Nil(t, err) - assert.Equal(t, "someString", installCmdOptions.HTTPProxySecret) -} - func TestInstallKanikoBuildCacheFlag(t *testing.T) { installCmdOptions, rootCmd, _ := initializeInstallCmdOptions(t) _, err := test.ExecuteCommand(rootCmd, cmdInstall, "--kaniko-build-cache") diff --git a/pkg/controller/build/build_pod.go b/pkg/controller/build/build_pod.go index d5e813f..00cab13 100644 --- a/pkg/controller/build/build_pod.go +++ b/pkg/controller/build/build_pod.go @@ -303,7 +303,6 @@ func addBuildahTaskToPod(ctx context.Context, c ctrl.Reader, build *v1.Build, ta } env = append(env, proxyFromEnvironment()...) - env = append(env, proxySecretEnvVars(task.HttpProxySecret)...) args := []string{ strings.Join(bud, " "), @@ -368,7 +367,6 @@ func addKanikoTaskToPod(ctx context.Context, c ctrl.Reader, build *v1.Build, tas } env = append(env, proxyFromEnvironment()...) - env = append(env, proxySecretEnvVars(task.HttpProxySecret)...) if cache { // Co-locate with the Kaniko warmer pod for sharing the host path volume as the current @@ -548,34 +546,6 @@ func addRegistrySecret(name string, secret registrySecret, volumes *[]corev1.Vol } } -func proxySecretEnvVars(secret string) []corev1.EnvVar { - if secret == "" { - return []corev1.EnvVar{} - } - - return []corev1.EnvVar{ - proxySecretEnvVar("HTTP_PROXY", secret), - proxySecretEnvVar("HTTPS_PROXY", secret), - proxySecretEnvVar("NO_PROXY", secret), - } -} - -func proxySecretEnvVar(name string, secret string) corev1.EnvVar { - optional := true - return corev1.EnvVar{ - Name: name, - ValueFrom: &corev1.EnvVarSource{ - SecretKeyRef: &corev1.SecretKeySelector{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: secret, - }, - Key: name, - Optional: &optional, - }, - }, - } -} - func proxyFromEnvironment() []corev1.EnvVar { var envVars []corev1.EnvVar diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go index 22f970d..34cc890 100644 --- a/pkg/trait/builder.go +++ b/pkg/trait/builder.go @@ -109,8 +109,7 @@ func (t *builderTrait) Apply(e *Environment) error { Image: getImageName(e), Registry: e.Platform.Status.Build.Registry, }, - HttpProxySecret: e.Platform.Status.Build.HTTPProxySecret, - Verbose: t.Verbose, + Verbose: t.Verbose, }}) case v1.IntegrationPlatformBuildPublishStrategyKaniko: @@ -126,8 +125,7 @@ func (t *builderTrait) Apply(e *Environment) error { Enabled: e.Platform.Status.Build.KanikoBuildCache, PersistentVolumeClaim: e.Platform.Status.Build.PersistentVolumeClaim, }, - HttpProxySecret: e.Platform.Status.Build.HTTPProxySecret, - Verbose: t.Verbose, + Verbose: t.Verbose, }}) }
