Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOTNET-5871 Upgrade operator to .NET 8 #230

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"kubeops.cli": {
"version": "9.1.5",
"commands": [
"kubeops"
],
"rollForward": false
}
}
}
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "vendor/dotnet-operator-sdk"]
path = vendor/dotnet-operator-sdk
url = https://github.com/Contrast-Security-OSS/dotnet-operator-sdk.git
[submodule "vendor/dotnet-kubernetes-client"]
path = vendor/dotnet-kubernetes-client
url = https://github.com/buehler/dotnet-kubernetes-client.git
18 changes: 1 addition & 17 deletions Contrast.K8s.AgentOperator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contrast.K8s.AgentOperator"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contrast.K8s.AgentOperator.Tests", "tests\Contrast.K8s.AgentOperator.Tests\Contrast.K8s.AgentOperator.Tests.csproj", "{E1EEA671-A656-4947-A0D4-A8BD4404BBCD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "vendor", "vendor", "{A961D540-FE30-482A-8786-250181E429D7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KubeOps", "vendor\dotnet-operator-sdk\src\KubeOps\KubeOps.csproj", "{BC941F05-9141-40E4-819A-C7A4A09B1E74}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotnetKubernetesClient", "vendor\dotnet-kubernetes-client\src\DotnetKubernetesClient\DotnetKubernetesClient.csproj", "{9359E781-59C0-4CAF-8DD4-516EB575E319}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrast.K8s.AgentOperator.FunctionalTests", "tests\Contrast.K8s.AgentOperator.FunctionalTests\Contrast.K8s.AgentOperator.FunctionalTests.csproj", "{14EB0F7B-447C-4AC0-8834-57C207C5404D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contrast.K8s.AgentOperator.FunctionalTests", "tests\Contrast.K8s.AgentOperator.FunctionalTests\Contrast.K8s.AgentOperator.FunctionalTests.csproj", "{14EB0F7B-447C-4AC0-8834-57C207C5404D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3A23E9CC-CDC7-4529-981D-F1145B2C783C}"
EndProject
Expand All @@ -33,14 +27,6 @@ Global
{E1EEA671-A656-4947-A0D4-A8BD4404BBCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1EEA671-A656-4947-A0D4-A8BD4404BBCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1EEA671-A656-4947-A0D4-A8BD4404BBCD}.Release|Any CPU.Build.0 = Release|Any CPU
{BC941F05-9141-40E4-819A-C7A4A09B1E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC941F05-9141-40E4-819A-C7A4A09B1E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC941F05-9141-40E4-819A-C7A4A09B1E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC941F05-9141-40E4-819A-C7A4A09B1E74}.Release|Any CPU.Build.0 = Release|Any CPU
{9359E781-59C0-4CAF-8DD4-516EB575E319}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9359E781-59C0-4CAF-8DD4-516EB575E319}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9359E781-59C0-4CAF-8DD4-516EB575E319}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9359E781-59C0-4CAF-8DD4-516EB575E319}.Release|Any CPU.Build.0 = Release|Any CPU
{14EB0F7B-447C-4AC0-8834-57C207C5404D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14EB0F7B-447C-4AC0-8834-57C207C5404D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14EB0F7B-447C-4AC0-8834-57C207C5404D}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -52,8 +38,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{913C1CDC-1294-4793-9347-46B44BC33281} = {3A23E9CC-CDC7-4529-981D-F1145B2C783C}
{E1EEA671-A656-4947-A0D4-A8BD4404BBCD} = {B6D148E8-FAAB-4C7E-B211-D118BD54DFBC}
{BC941F05-9141-40E4-819A-C7A4A09B1E74} = {A961D540-FE30-482A-8786-250181E429D7}
{9359E781-59C0-4CAF-8DD4-516EB575E319} = {A961D540-FE30-482A-8786-250181E429D7}
{14EB0F7B-447C-4AC0-8834-57C207C5404D} = {B6D148E8-FAAB-4C7E-B211-D118BD54DFBC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Contrast Security, Inc licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.

FROM mcr.microsoft.com/dotnet/aspnet:6.0.33-bookworm-slim AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0.11-bookworm-slim AS base

# To aid in debugging.
RUN set -xe \
&& apt-get update \
&& apt-get install -y --no-install-recommends curl jq \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

FROM mcr.microsoft.com/dotnet/sdk:6.0.425-bookworm-slim AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0.404-bookworm-slim AS build
WORKDIR /source

# Restore
Expand Down
2 changes: 1 addition & 1 deletion docs/public/03-configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ spec:
- The referenced AgentConnection and AgentConfiguration must exist in the same namespace as the AgentInjector.
- If using a custom registry, both the Pod being injected and the operator must have access, either through the default pull secret, or custom pull secrets.
- Agent version `latest` is recommended when using the agent in pre-production environments.
- The AgentInjector supports selecting Deployment, StatefulSet, DaemonSet, and DeploymentConfig (on OpenShift) workloads. Injecting pods directly is not supported.
- The AgentInjector supports selecting Deployment, StatefulSet, DaemonSet, Rollout (Argo), and DeploymentConfig (on OpenShift) workloads. Injecting pods directly is not supported.
- If the selected workload creates many containers in a single Pod, `spec.selector.images` can be used to filter which containers are injected.

**labelSelector**
Expand Down
2 changes: 1 addition & 1 deletion manifests/install/all/operator/base/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ webhooks:
service:
name: contrast-agent-operator
namespace: contrast-agent-operator
path: /v1/pods/podmutationwebhook/mutate
path: /mutate/v1pod
admissionReviewVersions: [ "v1" ]
sideEffects: None
108 changes: 49 additions & 59 deletions src/Contrast.K8s.AgentOperator/Contrast.K8s.AgentOperator.csproj
Original file line number Diff line number Diff line change
@@ -1,63 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<nullable>enable</nullable>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ServerGarbageCollection>true</ServerGarbageCollection>
<!--Ignore warnings about missing XML docs.-->
<NoWarn>CS1591</NoWarn>
<IsPublicBuild Condition="'$(IsPublicBuild)' == ''">false</IsPublicBuild>
<DefineConstants Condition="'$(IsPublicBuild)' != 'False'">CONTRAST_IS_PUBLIC_TELEMETRY_BUILD;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<KubeOpsConfigRoot>$(MSBuildProjectDirectory)\Generated</KubeOpsConfigRoot>
<KubeOpsSkipDockerfile>true</KubeOpsSkipDockerfile>

<SkipKubeOpsGen Condition="'$(SkipKubeOpsGen)' == ''">true</SkipKubeOpsGen>
<KubeOpsSkipCrds>$(SkipKubeOpsGen)</KubeOpsSkipCrds>
<KubeOpsSkipRbac>$(SkipKubeOpsGen)</KubeOpsSkipRbac>
<KubeOpsSkipOperator>$(SkipKubeOpsGen)</KubeOpsSkipOperator>
<KubeOpsSkipInstaller>$(SkipKubeOpsGen)</KubeOpsSkipInstaller>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="CertificateManager" Version="1.0.8" />
<PackageReference Include="Autofac" Version="7.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />

<PackageReference Include="NLog" Version="5.1.2" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.2.2" />

<PackageReference Include="Glob" Version="1.1.9" />
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="CompareNETObjects" Version="4.79.0" />
<PackageReference Include="YamlDotNet" Version="13.0.1" />

<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />

<PackageReference Include="RestEase" Version="1.6.1" />
<PackageReference Include="RestEase.SourceGenerator" Version="1.6.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

<PackageReference Include="Sigil" Version="5.0.0" />

<!--https://github.com/dotnet/runtime/issues/60393-->
<PackageReference Include="HexMate" Version="0.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\vendor\dotnet-kubernetes-client\src\DotnetKubernetesClient\DotnetKubernetesClient.csproj" />
<ProjectReference Include="..\..\vendor\dotnet-operator-sdk\src\KubeOps\KubeOps.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>11.0</LangVersion>
<nullable>enable</nullable>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ServerGarbageCollection>true</ServerGarbageCollection>
<!--Ignore warnings about missing XML docs.-->
<NoWarn>CS1591</NoWarn>
<IsPublicBuild Condition="'$(IsPublicBuild)' == ''">false</IsPublicBuild>
<DefineConstants Condition="'$(IsPublicBuild)' != 'False'">CONTRAST_IS_PUBLIC_TELEMETRY_BUILD;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="CertificateManager" Version="1.0.9" />
<PackageReference Include="Autofac" Version="8.1.1" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />

<PackageReference Include="NLog" Version="5.3.4" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.14" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.14" />

<PackageReference Include="Glob" Version="1.1.9" />
<PackageReference Include="MediatR" Version="12.4.1" />

<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />

<PackageReference Include="RestEase" Version="1.6.4" />
<PackageReference Include="RestEase.SourceGenerator" Version="1.6.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

<PackageReference Include="Sigil" Version="5.0.0" />
<PackageReference Include="KubeOps.Operator.Web" Version="9.1.5" />
<PackageReference Include="KubeOps.Generator" Version="9.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

<!--https://github.com/dotnet/runtime/issues/60393 (can remove after .NET 9)-->
<PackageReference Include="HexMate" Version="0.0.3" />
</ItemGroup>


</Project>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading