Skip to content

Commit 8cbebb5

Browse files
authored
Remove Osiris from kubernetes commands (#1833)
Closes #1826
1 parent 3eb1c72 commit 8cbebb5

File tree

7 files changed

+13
-580
lines changed

7 files changed

+13
-580
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,17 @@ Using the Core Tools, you can easily configure a Kubernetes cluster and run Azur
170170

171171
### Installing Kubernetes scalers
172172

173-
This deploys [KEDA](https://github.com/kedacore/keda) and [Osiris](https://github.com/deislabs/osiris) to your cluster which allows you to deploy your functions in a scale-to-zero by default.
173+
This deploys [KEDA](https://github.com/kedacore/keda) to your cluster which allows you to deploy your functions in a scale-to-zero by default for non-http scenarios only.
174174

175175
```bash
176176
func kubernetes install --namespace {namespace}
177177
```
178178

179179
**KEDA:** Handles monitoring polling event sources currently QueueTrigger and ServiceBusTrigger.
180-
**Osiris:**: Handles Http traffic monitoring and on demand scale your deployment to and from 0
181180

182181
### Deploy to Kubernetes
183182

184-
**First make sure you have Dockerfile for your project.** You can generate one using
183+
**First make sure you have Dockerfile for your project.** You can generate one using
185184
```bash
186185
func init --docker # or --docker-only (for existing projects)
187186
```
@@ -242,16 +241,16 @@ aks-agentpool-20257154-2 Ready agent 1d v1.11.5
242241
An ACR instance can be created using the Azure Portal or the [Azure CLI](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-azure-cli#create-a-container-registry)
243242

244243
#### Login to the ACR Registry
245-
Before pushing and pulling container images, you must log in to the ACR instance.
244+
Before pushing and pulling container images, you must log in to the ACR instance.
246245

247246
```azurecli
248247
az acr login --name <acrName>
249248
```
250249

251250
#### Give the AKS cluster access to the ACR Registry
252-
The AKS cluster needs access to the ACR Registry to pull the container. Azure creates a service principal to support cluster operability with other Azure resources. This can be used for authentication with an ACR registry. See here for how to grant the right access here: [Authenticate with Azure Container Registry from Azure Kubernetes Service](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auth-aks)
251+
The AKS cluster needs access to the ACR Registry to pull the container. Azure creates a service principal to support cluster operability with other Azure resources. This can be used for authentication with an ACR registry. See here for how to grant the right access here: [Authenticate with Azure Container Registry from Azure Kubernetes Service](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auth-aks)
253252

254-
#### Run the deployment
253+
#### Run the deployment
255254
The deployment will build the docker container and upload the container image to your referenced ACR instance (Note: Specify the ACR Login Server in the --registry parameter this is usually of the form <container_registry_name>.azurecr.io) and then your AKS cluster will use that as a source to obtain the container and deploy it.
256255

257256
```bash
@@ -263,7 +262,7 @@ If the deployment is successful, you should see this:
263262
Function deployed successfully!
264263
Function IP: 40.121.21.192
265264

266-
#### Verifying your deployment
265+
#### Verifying your deployment
267266
You can verify your deployment by using the Kubernetes web dashboard. To start the Kubernetes dashboard, use the [az aks browse](https://docs.microsoft.com/en-us/cli/azure/aks?view=azure-cli-latest#az-aks-browse) command.
268267

269268
```azurecli

src/Azure.Functions.Cli/Actions/KubernetesActions/InstallKedaAction.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,15 @@
1414

1515
namespace Azure.Functions.Cli.Actions.KubernetesActions
1616
{
17-
[Action(Name = "install", Context = Context.Kubernetes, HelpText = "Install Keda (non-http scale to zero) and Osiris (http scale to zero) in the kubernetes cluster from kubectl config")]
17+
[Action(Name = "install", Context = Context.Kubernetes, HelpText = "Install Keda (non-http scale to zero) in the kubernetes cluster from kubectl config")]
1818
internal class DeployKedaAction : BaseAction
1919
{
2020
public string Namespace { get; private set; } = "default";
21-
public bool KedaOnly { get; private set; }
2221
public bool DryRun { get; private set; }
2322

2423
public override ICommandLineParserResult ParseArgs(string[] args)
2524
{
2625
SetFlag<string>("namespace", "Kubernetes namespace to deploy to. Default: default", s => Namespace = s);
27-
SetFlag<bool>("keda", "Install Keda only. By default both keda (non-http scale to zero) and osiris (http scale to zero) are installed", f => KedaOnly = f);
28-
SetFlag<bool>("keda-only", string.Empty, f => KedaOnly = f);
2926
SetFlag<bool>("dry-run", "Show the deployment template", f => DryRun = f);
3027
return base.ParseArgs(args);
3128
}
@@ -35,26 +32,15 @@ public async override Task RunAsync()
3532
if (DryRun)
3633
{
3734
ColoredConsole.WriteLine(KubernetesHelper.GetKedaResources(Namespace));
38-
if (!KedaOnly)
39-
{
40-
ColoredConsole.WriteLine(KubernetesHelper.GetOsirisResources(Namespace));
41-
}
4235
}
4336
else
4437
{
45-
var sb = new StringBuilder();
46-
sb.AppendLine(KubernetesHelper.GetKedaResources(Namespace));
47-
if (!KedaOnly)
48-
{
49-
sb.AppendLine(KubernetesHelper.GetOsirisResources(Namespace));
50-
}
51-
5238
if (!await KubernetesHelper.NamespaceExists(Namespace))
5339
{
5440
await KubernetesHelper.CreateNamespace(Namespace);
5541
}
5642

57-
await KubectlHelper.KubectlApply(sb.ToString(), showOutput: true);
43+
await KubectlHelper.KubectlApply(KubernetesHelper.GetKedaResources(Namespace), showOutput: true);
5844
}
5945
}
6046
}

src/Azure.Functions.Cli/Actions/KubernetesActions/RemoveKedaAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Azure.Functions.Cli.Actions.KubernetesActions
77
{
8-
[Action(Name = "remove", Context = Context.Kubernetes, HelpText = "Remove Keda (non-http scale to zero) and Osiris (http scale to zero) from the kubernetes")]
8+
[Action(Name = "remove", Context = Context.Kubernetes, HelpText = "Remove Keda (non-http scale to zero) from the kubernetes")]
99
internal class RemoveKedaAction : BaseAction
1010
{
1111
public string Namespace { get; private set; } = "default";

src/Azure.Functions.Cli/Azure.Functions.Cli.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@
9090
<EmbeddedResource Include="StaticResources\print-functions.sh">
9191
<LogicalName>$(AssemblyName).print-functions.sh</LogicalName>
9292
</EmbeddedResource>
93-
<EmbeddedResource Include="StaticResources\osiris.yaml">
94-
<LogicalName>$(AssemblyName).osiris.yaml</LogicalName>
95-
</EmbeddedResource>
9693
<EmbeddedResource Include="StaticResources\keda.yaml">
9794
<LogicalName>$(AssemblyName).keda.yaml</LogicalName>
9895
</EmbeddedResource>

src/Azure.Functions.Cli/Kubernetes/KubernetesHelpers.cs

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -78,56 +78,12 @@ public static void ValidateKubernetesName(string name)
7878
}
7979
}
8080

81-
internal static string GetOsirisResources(string @namespace)
82-
{
83-
var injectorCaCert = SecurityHelpers.CreateCACertificate("osiris-proxy-injector-ca");
84-
var hijackerCaCert = SecurityHelpers.CreateCACertificate("osiris-endpoints-hijacker-ca");
85-
86-
var injectorAltNames = new[]
87-
{
88-
$"osiris-osiris-edge-proxy-injector.{@namespace}",
89-
$"osiris-osiris-edge-proxy-injector.{@namespace}.svc",
90-
$"osiris-osiris-edge-proxy-injector.{@namespace}.svc.cluster",
91-
$"osiris-osiris-edge-proxy-injector.{@namespace}.svc.cluster.local",
92-
};
93-
94-
var hijackerAltnames = new[]
95-
{
96-
$"osiris-osiris-edge-endpoints-hijacker.{@namespace}",
97-
$"osiris-osiris-edge-endpoints-hijacker.{@namespace}.svc",
98-
$"osiris-osiris-edge-endpoints-hijacker.{@namespace}.svc.cluster",
99-
$"osiris-osiris-edge-endpoints-hijacker.{@namespace}.svc.cluster.local",
100-
};
101-
102-
var injectorTlsCert = SecurityHelpers.CreateCertificateFromCA(injectorCaCert, "osiris-osiris-edge-proxy-injector", injectorAltNames);
103-
var hijackerTlsCert = SecurityHelpers.CreateCertificateFromCA(hijackerCaCert, "osiris-osiris-edge-endpoints-hijacker", hijackerAltnames);
104-
105-
var caCertForEdgePointHijacker = SecurityHelpers.GetPemCert(hijackerCaCert);
106-
var tlsCertForEdgeEndpointHijacker = SecurityHelpers.GetPemCert(hijackerTlsCert);
107-
var tlsKeyForEdgeEndpointHijacker = SecurityHelpers.GetPemRsaKey(hijackerTlsCert);
108-
109-
var caCertForProxyInjector = SecurityHelpers.GetPemCert(injectorCaCert);
110-
var tlsCertForProxyInjector = SecurityHelpers.GetPemCert(injectorTlsCert);
111-
var tlsKeyForProxyInjector = SecurityHelpers.GetPemRsaKey(injectorTlsCert);
112-
113-
return StaticResources
114-
.OsirisTemplate
115-
.Result
116-
.Replace("OSIRIS_NAMESPACE_PLACEHOLDER", @namespace)
117-
.Replace("TLS_CERT_FOR_EDGE_ENDPOINTS_HIJACKER", tlsCertForEdgeEndpointHijacker)
118-
.Replace("TLS_KEY_FOR_EDGE_ENDPOINTS_HIJACKER", tlsKeyForEdgeEndpointHijacker)
119-
.Replace("CA_CERT_FOR_EDGE_ENDPOINT_HIJACKER", caCertForEdgePointHijacker)
120-
.Replace("TLS_CERT_FOR_EDGE_PROXY_INJECTOR", tlsCertForProxyInjector)
121-
.Replace("TLS_KEY_FOR_EDGE_PROXY_INJECTOR", tlsKeyForProxyInjector)
122-
.Replace("CA_CERT_FOR_EDGE_PROXY_INJECTOR", caCertForProxyInjector);
123-
}
124-
12581
internal static async Task<bool> NamespaceExists(string @namespace)
12682
{
12783
(_, _, var exitCode) = await KubectlHelper.RunKubectl($"get namespace {@namespace}", ignoreError: true, showOutput: false);
12884
return exitCode == 0;
12985
}
130-
86+
13187
internal static async Task<(string, bool)> ResourceExists(string resourceTypeName, string resourceName, string @namespace, bool returnJsonOutput = false)
13288
{
13389
var cmd = $"get {resourceTypeName} {resourceName} --namespace {@namespace}";
@@ -185,17 +141,9 @@ internal static string GetKedaResources(string @namespace)
185141
//Environment variables for the func app keys kubernetes secret
186142
var kubernetesSecretEnvironmentVariable = FuncAppKeysHelper.FuncKeysKubernetesEnvironVariables(keysSecretCollectionName, mountKeysAsContainerVolume);
187143
var additionalEnvVars = enabledFunctions.Concat(kubernetesSecretEnvironmentVariable).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
188-
var deployment = GetDeployment(name + "-http", @namespace, imageName, pullSecret, 1, additionalEnvVars, new Dictionary<string, string>
189-
{
190-
{ "osiris.deislabs.io/enabled", "true" },
191-
{ "osiris.deislabs.io/minReplicas", "1" }
192-
}, port: 80);
144+
var deployment = GetDeployment(name + "-http", @namespace, imageName, pullSecret, 1, additionalEnvVars, port: 80);
193145
deployments.Add(deployment);
194-
var service = GetService(name + "-http", @namespace, deployment, serviceType, new Dictionary<string, string>
195-
{
196-
{ "osiris.deislabs.io/enabled", "true" },
197-
{ "osiris.deislabs.io/deployment", deployment.Metadata.Name }
198-
});
146+
var service = GetService(name + "-http", @namespace, deployment, serviceType);
199147
result.Add(service);
200148
}
201149

@@ -213,7 +161,7 @@ internal static string GetKedaResources(string @namespace)
213161
{
214162
secrets[Constants.FunctionsWorkerRuntime] = GlobalCoreToolsSettings.CurrentWorkerRuntime.ToString();
215163
}
216-
164+
217165
int resourceIndex = 0;
218166
if (useConfigMap)
219167
{

src/Azure.Functions.Cli/StaticResources/StaticResources.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ private static async Task<string> GetValue(string name)
6969

7070
public static Task<string> PrintFunctionJson => GetValue("print-functions.sh");
7171

72-
public static Task<string> OsirisTemplate => GetValue("osiris.yaml");
7372

7473
public static Task<string> KedaTemplate => GetValue("keda.yaml");
7574

0 commit comments

Comments
 (0)